名称重复性校验
This commit is contained in:
parent
03ae671f7b
commit
9e9fb2da60
|
|
@ -1,6 +1,5 @@
|
|||
package com.bonus.sgzb.base.controller;
|
||||
|
||||
|
||||
import com.bonus.sgzb.base.domain.BmProjectInfo;
|
||||
import com.bonus.sgzb.base.service.BmProjectInfoService;
|
||||
import com.bonus.sgzb.common.core.utils.poi.ExcelUtil;
|
||||
|
|
@ -89,7 +88,7 @@ public class BmProjectInfoController extends BaseController{
|
|||
@PostMapping
|
||||
public AjaxResult projectInfoAdd(@Validated @RequestBody BmProjectInfo bmProjectInfo)
|
||||
{
|
||||
return toAjax(bmProjectInfoService.projectInfoAdd(bmProjectInfo));
|
||||
return bmProjectInfoService.projectInfoAdd(bmProjectInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
package com.bonus.sgzb.base.controller;
|
||||
|
||||
|
||||
import com.bonus.sgzb.base.domain.BmProjectInfo;
|
||||
import com.bonus.sgzb.base.domain.BmProjectLot;
|
||||
import com.bonus.sgzb.base.service.BmProjectLotService;
|
||||
import com.bonus.sgzb.common.core.utils.poi.ExcelUtil;
|
||||
|
|
@ -65,7 +63,7 @@ public class BmProjectLotController extends BaseController {
|
|||
@Log(title = "参数管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult projectLotAdd(@Validated @RequestBody BmProjectLot bmProjectLot) {
|
||||
return toAjax(bmProjectLotService.projectLotAdd(bmProjectLot));
|
||||
return bmProjectLotService.projectLotAdd(bmProjectLot);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -20,4 +20,6 @@ public interface BmProjectInfoMapper {
|
|||
public int updateBmProjectInfo(BmProjectInfo bmProjectInfo);
|
||||
|
||||
public int deleteProjectInfoById(Long proId);
|
||||
|
||||
int selectByName(String proName);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,4 +19,6 @@ public interface BmProjectLotMapper {
|
|||
public int updateBmProjectLot(BmProjectLot bmProjectLot);
|
||||
|
||||
public int deleteProjectLotById(Long lotId);
|
||||
|
||||
int selectByName(String lotName);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.bonus.sgzb.base.service;
|
||||
|
||||
import com.bonus.sgzb.base.domain.BmProjectInfo;
|
||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -11,7 +12,7 @@ public interface BmProjectInfoService {
|
|||
|
||||
public List<BmProjectInfo> getProjectLot();
|
||||
|
||||
public int projectInfoAdd(BmProjectInfo bmProjectInfo);
|
||||
public AjaxResult projectInfoAdd(BmProjectInfo bmProjectInfo);
|
||||
|
||||
public void remove(Long[] proIds);
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.bonus.sgzb.base.service;
|
|||
|
||||
|
||||
import com.bonus.sgzb.base.domain.BmProjectLot;
|
||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -10,7 +11,7 @@ public interface BmProjectLotService {
|
|||
|
||||
public List<BmProjectLot> getProjectLot(BmProjectLot bmProjectLot);
|
||||
|
||||
public int projectLotAdd(BmProjectLot bmProjectLot);
|
||||
public AjaxResult projectLotAdd(BmProjectLot bmProjectLot);
|
||||
|
||||
public void remove(Long[] proIds);
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.bonus.sgzb.base.mapper.BmProjectInfoMapper;
|
|||
import com.bonus.sgzb.base.service.BmProjectInfoService;
|
||||
import com.bonus.sgzb.common.core.exception.ServiceException;
|
||||
import com.bonus.sgzb.common.core.utils.StringUtils;
|
||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
|
@ -32,8 +33,12 @@ public class BmProjectInfoServiceImpl implements BmProjectInfoService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int projectInfoAdd(BmProjectInfo bmProjectInfo) {
|
||||
return bmProjectInfoMapper.projectInfoAdd(bmProjectInfo);
|
||||
public AjaxResult projectInfoAdd(BmProjectInfo bmProjectInfo) {
|
||||
int count = bmProjectInfoMapper.selectByName(bmProjectInfo.getProName());
|
||||
if (count != 0) {
|
||||
return AjaxResult.error("新增工程项目名称重复,请重新提交!!!");
|
||||
}
|
||||
return AjaxResult.success(bmProjectInfoMapper.projectInfoAdd(bmProjectInfo));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ package com.bonus.sgzb.base.service.impl;
|
|||
import com.bonus.sgzb.base.domain.BmProjectLot;
|
||||
import com.bonus.sgzb.base.mapper.BmProjectLotMapper;
|
||||
import com.bonus.sgzb.base.service.BmProjectLotService;
|
||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
|
@ -28,8 +29,12 @@ public class BmProjectLotServiceImpl implements BmProjectLotService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int projectLotAdd(BmProjectLot bmProjectLot) {
|
||||
return bmProjectLotMapper.projectLotAdd(bmProjectLot);
|
||||
public AjaxResult projectLotAdd(BmProjectLot bmProjectLot) {
|
||||
int count = bmProjectLotMapper.selectByName(bmProjectLot.getLotName());
|
||||
if (count != 0) {
|
||||
return AjaxResult.error("新增标段工程名称重复,请重新提交!!!");
|
||||
}
|
||||
return AjaxResult.success(bmProjectLotMapper.projectLotAdd(bmProjectLot));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -138,9 +138,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
and a.company_id = #{companyId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectByName" resultType="java.lang.Integer">
|
||||
select count(*) from bm_project_info
|
||||
where
|
||||
1 = 1
|
||||
<if test="proName != null and proName != ''">and pro_name = #{proName}</if>
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<insert id="projectInfoAdd" parameterType="com.bonus.sgzb.base.domain.BmProjectInfo">
|
||||
insert into bm_project_info (
|
||||
<if test="proName != null and proName != '' ">pro_name,</if>
|
||||
|
|
|
|||
|
|
@ -86,6 +86,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</if>
|
||||
ORDER BY a.lot_id DESC
|
||||
</select>
|
||||
<select id="selectByName" resultType="java.lang.Integer">
|
||||
select count(*) from bm_project_lot
|
||||
where
|
||||
1 = 1
|
||||
<if test="lotName != null and lotName != ''">and lot_name = #{lotName}</if>
|
||||
</select>
|
||||
<insert id="projectLotAdd" parameterType="com.bonus.sgzb.base.domain.BmProjectLot">
|
||||
insert into bm_project_lot (
|
||||
<if test="lotName != null and lotName != '' ">lot_name,</if>
|
||||
|
|
|
|||
Loading…
Reference in New Issue