Browse Source

[feat]销售管理子表查询取消用del_flag做删除标志,同时修改时改为先删除旧子表数据在根据新传输的子表数据插入。

dev
zhangsiqi 4 months ago
parent
commit
07f444268f
  1. 4
      ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysSalesOrderChildMapper.java
  2. 2
      ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysSalesOrderChildService.java
  3. 4
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSalesOrderChildServiceImpl.java
  4. 9
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSalesOrderServiceImpl.java
  5. 11
      ruoyi-admin/src/main/resources/mapper/system/SysSalesOrderChildMapper.xml
  6. 7
      ruoyi-admin/src/main/resources/mapper/system/SysSalesOrderMapper.xml

4
ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysSalesOrderChildMapper.java

@ -21,7 +21,7 @@ public interface SysSalesOrderChildMapper {
int deleteSysSalesOrderChildByIds(String[] ids);
/*删除ids中的quoteId的所有子项*/
int deleteSysSalesOrderChildByQuoteIds(String[] ids);
int deleteSysSalesOrderChildByQuoteIds(String[] salesOrderCodes);
SysSalesOrderChild selectOneByQuoteIdAndMaterialCode(@Param("quoteId") String quoteId, @Param("materialCode") String materialCode);
/*
@ -45,5 +45,5 @@ public interface SysSalesOrderChildMapper {
* @return
*/
Integer updateSysSalesOrderChildByQuoteId(String salesOrderCode);
Integer deleteSysSalesOrderChildByQuoteId(String salesOrderCode);
}

2
ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysSalesOrderChildService.java

@ -33,5 +33,5 @@ public interface ISysSalesOrderChildService {
* @param salesOrderCode
* @return
*/
Integer updateSysSalesOrderChildByQuoteId(String salesOrderCode);
Integer deleteSysSalesOrderChildByQuoteId(String salesOrderCode);
}

4
ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSalesOrderChildServiceImpl.java

@ -62,7 +62,7 @@ public class SysSalesOrderChildServiceImpl implements ISysSalesOrderChildService
}
@Override
public Integer updateSysSalesOrderChildByQuoteId(String salesOrderCode) {
return sysCustomerQuoteChildMapper.updateSysSalesOrderChildByQuoteId(salesOrderCode);
public Integer deleteSysSalesOrderChildByQuoteId(String salesOrderCode) {
return sysCustomerQuoteChildMapper.deleteSysSalesOrderChildByQuoteId(salesOrderCode);
}
}

9
ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSalesOrderServiceImpl.java

@ -216,15 +216,10 @@ public class SysSalesOrderServiceImpl implements ISysSalesOrderService
//1.1.销售订单物料的前台上传新的报价列表,修改后台存在的报价猎豹,以报价编号为索引
//获取传输的销售订单物料报价信息
List<SysSalesOrderChild> sysSalesOrderChildList = sysSalesOrder.getSysSalesOrderChildList();
sysSalesOrderChildService.updateSysSalesOrderChildByQuoteId(sysSalesOrder.getSalesOrderCode());
sysSalesOrderChildService.deleteSysSalesOrderChildByQuoteId(sysSalesOrder.getSalesOrderCode());
for (int i = 0; i < sysSalesOrderChildList.size(); i++) {
SysSalesOrderChild sysSalesOrderChild = sysSalesOrderChildList.get(i);
sysSalesOrderChild.setQuoteId(sysSalesOrder.getSalesOrderCode());
sysSalesOrderChild.setCreateBy(loginName);
sysSalesOrderChild.setCreateTime(DateUtils.getNowDate());
sysSalesOrderChild.setUpdateBy(loginName);
sysSalesOrderChild.setUpdateTime(DateUtils.getNowDate());
sysSalesOrderChildService.insertSysSalesOrderChild(sysSalesOrderChild);
sysSalesOrderChildService.updateSysSalesOrderChild(sysSalesOrderChild);
}
}
int result = sysSalesOrderMapper.updateSysSalesOrder(sysSalesOrder);

11
ruoyi-admin/src/main/resources/mapper/system/SysSalesOrderChildMapper.xml

@ -56,12 +56,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
,b.id as bom_id
from sys_sales_order_child a
left join erp_bom b
on a.materialCode = b.material_no and b.del_flag = '0'
on a.materialCode = b.material_no
</sql>
<select id="selectSysSalesOrderChildList" parameterType="SysSalesOrderChild" resultMap="SysSalesOrderChildResult">
<include refid="selectSysSalesOrderChild"/>
<where>
a.del_flag = '0'
<if test="quoteId != null and quoteId !='' "> and a.quoteId = #{quoteId}</if>
<if test="materialId != null "> and a.materialId = #{materialId}</if>
<if test="materialCode != null and materialCode != ''"> and a.materialCode like concat('%', #{materialCode}, '%')</if>
@ -288,11 +287,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteSysSalesOrderChildByQuoteIds" parameterType="String">
delete from sys_sales_order_child where quoteId in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
<foreach item="salesOrderCode" collection="array" open="(" separator="," close=")">
#{salesOrderCode}
</foreach>
</delete>
<update id="updateSysSalesOrderChildByQuoteId" parameterType="String">
update sys_sales_order_child set del_flag = '1' where quoteId = #{salesOrderCode}
<update id="deleteSysSalesOrderChildByQuoteId" parameterType="String">
delete from sys_sales_order_child where quoteId = #{salesOrderCode}
</update>
</mapper>

7
ruoyi-admin/src/main/resources/mapper/system/SysSalesOrderMapper.xml

@ -108,7 +108,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
) as p
on s.instance_type = p.dict_value
<where>
s.del_flag = '0'
<if test="createBy != null and createBy !=''"> and s.create_by = #{createBy}</if>
<if test="salesOrderCode != null and salesOrderCode != ''"> and s.sales_order_code like concat('%', #{salesOrderCode}, '%')</if>
<if test="salesOrderNumber != null and salesOrderNumber != ''"> and s.sales_order_number like concat('%', #{salesOrderNumber}, '%')</if>
@ -396,13 +395,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where sales_order_code = #{salesOrderCode}
</update>
<delete id="deleteSysSalesOrderById" parameterType="Long">
update sys_sales_order set del_flag = '1' where sales_order_id = #{salesOrderId}
delete from sys_sales_order where sales_order_id = #{salesOrderId}
</delete>
<delete id="deleteSysSalesOrderByIds" parameterType="String">
update sys_sales_order set del_flag = '1' where sales_order_id in
delete from sys_sales_order where sales_order_id in
<foreach item="salesOrderId" collection="array" open="(" separator="," close=")">
#{salesOrderId}
</foreach>

Loading…
Cancel
Save