金属元素缩写重复校验,生产订单定时任务获取
This commit is contained in:
@@ -36,4 +36,9 @@ public interface ElementMapper extends BaseMapperX<ElementDO> {
|
|||||||
.eq(ElementDO::getIsEnable, 1)
|
.eq(ElementDO::getIsEnable, 1)
|
||||||
.orderByDesc(ElementDO::getSort));
|
.orderByDesc(ElementDO::getSort));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default ElementDO getElementName(String code){
|
||||||
|
return selectOne(new LambdaQueryWrapperX<ElementDO>()
|
||||||
|
.eq(ElementDO::getAbbreviation, code));
|
||||||
|
};
|
||||||
}
|
}
|
||||||
@@ -35,6 +35,8 @@ public class ElementServiceImpl implements ElementService {
|
|||||||
public ElementRespVO createElement(ElementSaveReqVO createReqVO) {
|
public ElementRespVO createElement(ElementSaveReqVO createReqVO) {
|
||||||
// 插入
|
// 插入
|
||||||
ElementDO element = BeanUtils.toBean(createReqVO, ElementDO.class);
|
ElementDO element = BeanUtils.toBean(createReqVO, ElementDO.class);
|
||||||
|
// 校验存在
|
||||||
|
validateElementCodeExists(createReqVO.getAbbreviation());
|
||||||
//金属编码自动生成,格式 JSYS-00001,依次新增
|
//金属编码自动生成,格式 JSYS-00001,依次新增
|
||||||
String maxCode = elementMapper.selectMaxCode();
|
String maxCode = elementMapper.selectMaxCode();
|
||||||
if (maxCode == null) {
|
if (maxCode == null) {
|
||||||
@@ -55,6 +57,8 @@ public class ElementServiceImpl implements ElementService {
|
|||||||
public void updateElement(ElementSaveReqVO updateReqVO) {
|
public void updateElement(ElementSaveReqVO updateReqVO) {
|
||||||
// 校验存在
|
// 校验存在
|
||||||
validateElementExists(updateReqVO.getId());
|
validateElementExists(updateReqVO.getId());
|
||||||
|
// 校验存在
|
||||||
|
validateElementCodeExists(updateReqVO.getAbbreviation());
|
||||||
// 更新
|
// 更新
|
||||||
ElementDO updateObj = BeanUtils.toBean(updateReqVO, ElementDO.class);
|
ElementDO updateObj = BeanUtils.toBean(updateReqVO, ElementDO.class);
|
||||||
elementMapper.updateById(updateObj);
|
elementMapper.updateById(updateObj);
|
||||||
@@ -89,6 +93,13 @@ public class ElementServiceImpl implements ElementService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void validateElementCodeExists(String code) {
|
||||||
|
ElementDO elementDO = elementMapper.getElementName(code);
|
||||||
|
if (elementDO == null) {
|
||||||
|
throw exception(ELEMENT_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ElementDO getElement(Long id) {
|
public ElementDO getElement(Long id) {
|
||||||
return elementMapper.selectById(id);
|
return elementMapper.selectById(id);
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
|||||||
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpCustomerPageReqVO;
|
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpCustomerPageReqVO;
|
||||||
import com.zt.plat.module.erp.dal.dataobject.erp.ErpCustomerDO;
|
import com.zt.plat.module.erp.dal.dataobject.erp.ErpCustomerDO;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ERP客商主数据 Mapper
|
* ERP客商主数据 Mapper
|
||||||
@@ -29,4 +32,5 @@ public interface ErpCustomerMapper extends BaseMapperX<ErpCustomerDO> {
|
|||||||
.orderByDesc(ErpCustomerDO::getId));
|
.orderByDesc(ErpCustomerDO::getId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void updateBatchByNumber(@Param("toUpdate") List<ErpCustomerDO> toUpdate);
|
||||||
}
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -8,4 +8,22 @@
|
|||||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||||
-->
|
-->
|
||||||
|
<update id="updateBatchByNumber">
|
||||||
|
<foreach collection="toUpdate" item="item" separator=";" open="BEGIN" close=";END;">
|
||||||
|
UPDATE sply_erp_cstm
|
||||||
|
<set>
|
||||||
|
<if test="item.number != null">NUM = #{item.number},</if>
|
||||||
|
<if test="item.name != null">NAME = #{item.name},</if>
|
||||||
|
<if test="item.accountGroup != null">ACCT_GRP = #{item.accountGroup},</if>
|
||||||
|
<if test="item.description != null">DSP = #{item.description},</if>
|
||||||
|
<if test="item.centerNumber != null">CTR_NUM = #{item.centerNumber},</if>
|
||||||
|
<if test="item.createDate != null">CRT_DT = #{item.createDate},</if>
|
||||||
|
<if test="item.repairDate != null">RPR_DT = #{item.repairDate},</if>
|
||||||
|
<if test="item.isGiveback != null">IS_GIV = #{item.isGiveback},</if>
|
||||||
|
<if test="item.isProvisional != null">IS_PRVS = #{item.isProvisional},</if>
|
||||||
|
<if test="item.taxNumber != null">TAX_NUM = #{item.taxNumber},</if>
|
||||||
|
</set>
|
||||||
|
WHERE NUM = #{item.downCenterNumber}
|
||||||
|
</foreach>
|
||||||
|
</update>
|
||||||
</mapper>
|
</mapper>
|
||||||
Reference in New Issue
Block a user