Commit de29c57c authored by 罗林杰's avatar 罗林杰

修改客户验重

parent 16da0210
......@@ -22,5 +22,7 @@ public interface CustInfoRepository extends CyBaseMapper<CustInfo> {
*
*/
IPage<CustInfo> queryCustInfosPaged(CyPageInfo cyPageInfo,@Param("entity") CustInfo custInfo);
CustInfo selectByCustomerTelephone(String customerTelephone);
}
......@@ -3,6 +3,8 @@ package org.rcisoft.bus.custinfo.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.rcisoft.bean.AdminProperties;
import org.rcisoft.bus.wmsgoodsprice.entity.WmsGoodsPrice;
import org.rcisoft.core.exception.CyServiceException;
import org.rcisoft.core.util.CyUserUtil;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.bus.custinfo.dao.CustInfoRepository;
......@@ -45,6 +47,11 @@ public class CustInfoServiceImpl extends ServiceImpl<CustInfoRepository,CustInfo
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public CyPersistModel persist(CustInfo custInfo){
CustInfo existingRecord = baseMapper.selectByCustomerTelephone(custInfo.getCustomerTelephone());
if (existingRecord != null) {
throw new CyServiceException(1001, "电话号码已存在");
}
//增加操作
custInfo.setStoreId(CyUserUtil.getAuthenDept());
int line = baseMapper.insert(custInfo);
......@@ -90,6 +97,12 @@ public class CustInfoServiceImpl extends ServiceImpl<CustInfoRepository,CustInfo
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public CyPersistModel merge(CustInfo custInfo){
CustInfo existingRecord = baseMapper.selectByCustomerTelephone(custInfo.getCustomerTelephone());
if (existingRecord != null && !existingRecord.getBusinessId().equals(custInfo.getBusinessId())) {
throw new CyServiceException(1001, "电话号码已存在");
}
int line = baseMapper.updateById(custInfo);
log.debug(CyUserUtil.getAuthenUsername()+"修改了ID为"+ custInfo.getBusinessId()+"的客户信息表信息");
return new CyPersistModel(line);
......
......@@ -117,4 +117,10 @@
</if>
ORDER BY cio.business_id DESC
</select>
<select id="selectByCustomerTelephone" resultType="org.rcisoft.bus.custinfo.entity.CustInfo">
select * from cust_info
where 1=1
and cust_info.del_flag = '0'
and customer_telephone = #{customerTelephone}
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment