1.添加搜索条件

2.修改判断名称重复查询sql
main
862857010@qq.com 2 years ago
parent 824efb0737
commit 5e85229465
  1. 2
      cjy-module-traceability/cjy-module-traceability-biz/src/main/java/com/cjy/traceability/module/traceability/dal/mysql/custom/CustomMapper.java
  2. 2
      cjy-module-traceability/cjy-module-traceability-biz/src/main/java/com/cjy/traceability/module/traceability/dal/mysql/logistics/LogisticsMapper.java
  3. 2
      cjy-module-traceability/cjy-module-traceability-biz/src/main/java/com/cjy/traceability/module/traceability/dal/mysql/processingworkshop/ProcessingWorkshopMapper.java
  4. 4
      cjy-module-traceability/cjy-module-traceability-biz/src/main/java/com/cjy/traceability/module/traceability/service/custom/CustomServiceImpl.java
  5. 4
      cjy-module-traceability/cjy-module-traceability-biz/src/main/java/com/cjy/traceability/module/traceability/service/logistics/LogisticsServiceImpl.java
  6. 4
      cjy-module-traceability/cjy-module-traceability-biz/src/main/java/com/cjy/traceability/module/traceability/service/processingworkshop/ProcessingWorkshopServiceImpl.java
  7. 19
      cjy-module-traceability/cjy-module-traceability-biz/src/main/resources/mapper/custom/CustomMapper.xml
  8. 18
      cjy-module-traceability/cjy-module-traceability-biz/src/main/resources/mapper/logistics/LogisticsMapper.xml
  9. 19
      cjy-module-traceability/cjy-module-traceability-biz/src/main/resources/mapper/processingworkshop/ProcessingWorkshopMapper.xml

@ -50,5 +50,5 @@ public interface CustomMapper extends BaseMapperX<CustomDO> {
List<Map<String,Object>> getAllClient();
Integer getDataByLogisticsName(String logisticsName);
Integer getDataByLogisticsName(@Param("logisticsName")String logisticsName,@Param("id")Integer id );
}

@ -44,5 +44,5 @@ public interface LogisticsMapper extends BaseMapperX<LogisticsDO> {
List<Map<String,Object>> getAllDeliveryCompany();
Integer getDataByLogisticsName(String logisticsName);
Integer getDataByLogisticsName(@Param("logisticsName")String logisticsName,@Param("id")Integer id );
}

@ -73,5 +73,5 @@ public interface ProcessingWorkshopMapper extends BaseMapperX<ProcessingWorkshop
* @param workshopName
* @return
*/
Integer getDataByWorkshopName(String workshopName );
Integer getDataByWorkshopName(@Param("workshopName") String workshopName ,@Param("id")Integer id );
}

@ -40,7 +40,7 @@ public class CustomServiceImpl implements CustomService {
public Integer createCustom(CustomSaveReqVO createReqVO) {
// 插入
CustomDO custom = BeanUtils.toBean(createReqVO, CustomDO.class);
if (customMapper.getDataByLogisticsName(createReqVO.getLogisticsName()) > 0) {
if (customMapper.getDataByLogisticsName(createReqVO.getLogisticsName(),0) > 0) {
return -1;
}
customMapper.insert(custom);
@ -52,7 +52,7 @@ public class CustomServiceImpl implements CustomService {
public Integer updateCustom(CustomSaveReqVO updateReqVO) {
// 校验存在
validateCustomExists(updateReqVO.getId());
if (customMapper.getDataByLogisticsName(updateReqVO.getLogisticsName()) > 0) {
if (customMapper.getDataByLogisticsName(updateReqVO.getLogisticsName(),updateReqVO.getId()) > 0) {
return -1;
}
// 更新

@ -38,7 +38,7 @@ public class LogisticsServiceImpl implements LogisticsService {
public Integer createLogistics(LogisticsSaveReqVO createReqVO) {
// 插入
LogisticsDO logistics = BeanUtils.toBean(createReqVO, LogisticsDO.class);
if(logisticsMapper.getDataByLogisticsName(createReqVO.getLogisticsName())>0){
if(logisticsMapper.getDataByLogisticsName(createReqVO.getLogisticsName(),0)>0){
return -1;
}
logisticsMapper.insert(logistics);
@ -50,7 +50,7 @@ public class LogisticsServiceImpl implements LogisticsService {
public Integer updateLogistics(LogisticsSaveReqVO updateReqVO) {
// 校验存在
validateLogisticsExists(updateReqVO.getId());
if(logisticsMapper.getDataByLogisticsName(updateReqVO.getLogisticsName())>0){
if(logisticsMapper.getDataByLogisticsName(updateReqVO.getLogisticsName(),updateReqVO.getId())>0){
return -1;
}
// 更新

@ -37,7 +37,7 @@ public class ProcessingWorkshopServiceImpl implements ProcessingWorkshopService
public Integer createProcessingWorkshop(ProcessingWorkshopSaveReqVO createReqVO) {
// 插入
ProcessingWorkshopDO processingWorkshop = BeanUtils.toBean(createReqVO, ProcessingWorkshopDO.class);
if(processingWorkshopMapper.getDataByWorkshopName(createReqVO.getWorkshopName())>0){
if(processingWorkshopMapper.getDataByWorkshopName(createReqVO.getWorkshopName(),0)>0){
return -1;
}
processingWorkshopMapper.insert(processingWorkshop);
@ -50,7 +50,7 @@ public class ProcessingWorkshopServiceImpl implements ProcessingWorkshopService
// 校验存在
validateProcessingWorkshopExists(updateReqVO.getId());
// 更新
if(processingWorkshopMapper.getDataByWorkshopName(updateReqVO.getWorkshopName())>0){
if(processingWorkshopMapper.getDataByWorkshopName(updateReqVO.getWorkshopName(),updateReqVO.getId())>0){
return -1;
}
ProcessingWorkshopDO updateObj = BeanUtils.toBean(updateReqVO, ProcessingWorkshopDO.class);

@ -26,7 +26,21 @@
updater,
deleted
FROM traceability_custom
WHERE deleted = 0
WHERE 1=1
and deleted = 0
<if test="reqVO.logisticsName !=null and reqVO.logisticsName !=''">
and logistics_name like concat('%', #{reqVO.logisticsName}, '%')
</if>
<if test="reqVO.logisticsLeader !=null and reqVO.logisticsLeader!=''">
and logistics_leader like concat('%', #{reqVO.logisticsLeader}, '%')
</if>
<if test="reqVO.logisticsPhone !=null and reqVO.logisticsPhone!=''">
and logistics_phone like concat('%', #{reqVO.logisticsPhone}, '%')
</if>
<if test="reqVO.logisticsStatus !=null and reqVO.logisticsStatus!=''">
and logistics_status =#{reqVO.logisticsStatus}
</if>
order by create_time desc
</select>
<select id="getAllClient" resultType="java.util.Map">
@ -42,5 +56,8 @@
<select id="getDataByLogisticsName" resultType="java.lang.Integer">
select count(*) from traceability_custom
where logistics_name=#{logisticsName} and deleted=0
<if test="id !=0">
and id !=#{id}
</if>
</select>
</mapper>

@ -26,7 +26,20 @@
t1.updater,
t1.deleted
FROM traceability_logistics t1
WHERE t1.deleted = 0
WHERE 1=1
and t1.deleted = 0
<if test="reqVO.logisticsName !=null and reqVO.logisticsName !=''">
and t1.logistics_name like concat('%', #{reqVO.logisticsName}, '%')
</if>
<if test="reqVO.logisticsLeader !=null and reqVO.logisticsLeader!=''">
and t1.logistics_leader like concat('%', #{reqVO.logisticsLeader}, '%')
</if>
<if test="reqVO.logisticsPhone !=null and reqVO.logisticsPhone!=''">
and t1.logistics_phone like concat('%', #{reqVO.logisticsPhone}, '%')
</if>
<if test="reqVO.logisticsStatus !=null and reqVO.logisticsStatus!=''">
and t1.logistics_status =#{reqVO.logisticsStatus}
</if>
order by t1.create_time desc
</select>
<select id="getAllDeliveryCompany" resultType="java.util.Map">
@ -35,6 +48,9 @@
<select id="getDataByLogisticsName" resultType="java.lang.Integer">
select count(*) found traceability_logistics
where logistics_name=#{logisticsName} and deleted =0
<if test="id !=0">
and id !=#{id}
</if>
</select>
</mapper>

@ -30,7 +30,20 @@
updater,
deleted
FROM traceability_workshop
WHERE deleted = 0
WHERE 1=1
and deleted = 0
<if test="reqVO.workshopName !=null and reqVO.workshopName !=''">
and workshop_name like concat('%', #{reqVO.workshopName}, '%')
</if>
<if test="reqVO.workshopLeader !=null and reqVO.workshopLeader!=''">
and workshop_leader like concat('%', #{reqVO.workshopLeader}, '%')
</if>
<if test="reqVO.workshopPhone !=null and reqVO.workshopPhone!=''">
and workshop_phone like concat('%', #{reqVO.workshopPhone}, '%')
</if>
<if test="reqVO.workshopStatus !=null and reqVO.workshopStatus!=''">
and workshop_status =#{reqVO.workshopStatus}
</if>
ORDER BY create_time desc
</select>
<select id="getAllProcessingWorkshop" resultType="java.util.Map">
@ -52,6 +65,10 @@
<select id="getDataByWorkshopName" resultType="java.lang.Integer">
select count(*) from traceability_workshop
where workshop_name=#{workshopName} and deleted =0
<if test="id !=0">
and id !=#{id}
</if>
</select>
</mapper>
Loading…
Cancel
Save