添加时间

This commit is contained in:
sxu 2025-07-16 17:12:23 +08:00
parent c1c56d15f9
commit 451be85559
2 changed files with 24 additions and 1 deletions

View File

@ -4,7 +4,9 @@ import java.util.List;
import java.util.Objects;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.DateUtils;
import com.bonus.common.core.utils.StringUtils;
import com.bonus.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.bonus.canteen.core.ims.mapper.ProductionPurchaseOrderMapper;
@ -53,6 +55,8 @@ public class ProductionPurchaseOrderServiceImpl implements IProductionPurchaseOr
@Override
public int insertProductionPurchaseOrder(ProductionPurchaseOrder productionPurchaseOrder) {
try {
productionPurchaseOrder.setCreateBy(SecurityUtils.getUsername());
productionPurchaseOrder.setCreateTime(DateUtils.getNowDate());
return productionPurchaseOrderMapper.insertProductionPurchaseOrder(productionPurchaseOrder);
} catch (Exception e) {
throw new ServiceException(e.getMessage());
@ -68,6 +72,8 @@ public class ProductionPurchaseOrderServiceImpl implements IProductionPurchaseOr
@Override
public int updateProductionPurchaseOrder(ProductionPurchaseOrder productionPurchaseOrder) {
try {
productionPurchaseOrder.setUpdateBy(SecurityUtils.getUsername());
productionPurchaseOrder.setUpdateTime(DateUtils.getNowDate());
return productionPurchaseOrderMapper.updateProductionPurchaseOrder(productionPurchaseOrder);
} catch (Exception e) {
throw new ServiceException(e.getMessage());

View File

@ -10,10 +10,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="goodsOrderId" column="goods_order_id" />
<result property="inspectGoodsId" column="inspect_goods_id" />
<result property="orderType" column="order_type" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectProductionPurchaseOrderVo">
select id, production_plan_id, purchase_plan_id, goods_order_id, inspect_goods_id, order_type
select id, production_plan_id, purchase_plan_id, goods_order_id, inspect_goods_id, order_type, create_by,
create_time, update_by, update_time
from ims_production_purchase_order
</sql>
@ -41,6 +46,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="goodsOrderId != null">goods_order_id,</if>
<if test="inspectGoodsId != null">inspect_goods_id,</if>
<if test="orderType != null">order_type,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="productionPlanId != null">#{productionPlanId},</if>
@ -48,6 +57,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="goodsOrderId != null">#{goodsOrderId},</if>
<if test="inspectGoodsId != null">#{inspectGoodsId},</if>
<if test="orderType != null">#{orderType},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
@ -59,6 +72,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="goodsOrderId != null">goods_order_id = #{goodsOrderId},</if>
<if test="inspectGoodsId != null">inspect_goods_id = #{inspectGoodsId},</if>
<if test="orderType != null">order_type = #{orderType},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>