pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPr/PrOrder.java
@@ -59,9 +59,10 @@ */ public Integer status; /** * 创建人 */ public String creator; * 创建人 */ @JSONField(serializeUsing= ObjectWriterImplToString.class) public Long creator; /** * 创建时间 */ pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPr/PrOrderItem.java
@@ -2,6 +2,7 @@ import com.alibaba.fastjson2.annotation.JSONField; import com.alibaba.fastjson2.writer.ObjectWriterImplToString; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.dy.common.po.BaseEntity; import jakarta.validation.constraints.NotBlank; @@ -48,4 +49,7 @@ @JSONField(serialize = false) public Boolean deleted; @TableField(exist = false) public String completeRate; } pms-parent/pms-global/src/main/resources/mapper/PrOrderItemMapper.xml
@@ -83,4 +83,35 @@ </set> where id = #{id,jdbcType=BIGINT} </update> <delete id="deleteLogicById"> update pr_order_item set deleted = 1 where id = #{id} </delete> <select id="selectSome" resultMap="BaseResultMap"> select <include refid="Base_Column_List" /> from pr_order_item p where p.deleted!=1 <trim prefix="and " suffixOverrides="and"> <if test="orderId != null and orderId != ''"> p.orderId = #{orderId,jdbcType=BIGINT} and </if> </trim> order by id desc <trim prefix="limit " > <if test="start != null and count != null"> #{start}, #{count} </if> </trim> </select> <select id="selectSomeCount" resultType="java.lang.Long"> select count(1) from pr_order_item p where p.deleted!=1 <trim prefix="and " suffixOverrides="and"> <if test="orderId != null and orderId != ''"> p.orderId = #{orderId,jdbcType=BIGINT} and </if> </trim> </select> </mapper> pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/order/OrderCtrl.java
@@ -31,8 +31,6 @@ @SsoPowerAop(power = "10200001") @Log("保存订单信息") public BaseResponse<Boolean> save(@RequestBody @Valid PrOrder order){ order.id = null; order.setDeleted(false); int count = sv.save(order); if (count <= 0) { return BaseResponseUtils.buildFail("数据库存储失败"); pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/order/OrderSv.java
@@ -1,10 +1,12 @@ package com.dy.pmsProduct.order; import cn.hutool.core.codec.Base64; import com.dy.common.webFilter.UserTokenContext; import com.dy.common.webUtil.QueryResultVo; import com.dy.pmsGlobal.daoOth.OthFileMapper; import com.dy.pmsGlobal.daoPr.*; import com.dy.pmsGlobal.dyFile.FileOperate; import com.dy.pmsGlobal.pojoBa.BaUser; import com.dy.pmsGlobal.pojoPlt.PltProduct; import com.dy.pmsGlobal.pojoPr.*; import com.dy.pmsGlobal.util.UserUtil; @@ -57,10 +59,16 @@ @Transactional public int save(PrOrder p) { p.id = null; //判断产品不能重名 if (orderDao.exists(p.name, p.id)) { throw new RuntimeException("订单名称不能重复"); } p.setDeleted(false); BaUser loginUser = userUtil.getUser(UserTokenContext.get()); if(loginUser!=null){ p.creator = loginUser.id; } int count = orderDao.insertSelective(p); saveOrderItems(p); return count;