Commit ef5afa2e authored by jichao's avatar jichao

项目维护--设备类型维护,验重的bug

parent 42f2dd98
......@@ -51,7 +51,7 @@ public class BusDeviceTpServiceImpl implements BusDeviceTpService {
public PersistModel save(BusDeviceTp busDeviceTp){
int line = 0;
// 验重
Integer repeat = this.repeat(null, busDeviceTp.getDevTpNm());
Integer repeat = this.repeat(null, busDeviceTp.getDevTpNm(), busDeviceTp.getProId());
if (repeat > 0)
return new PersistModel(line, "设备类型名称不能重复");
//增加操作
......@@ -93,7 +93,7 @@ public class BusDeviceTpServiceImpl implements BusDeviceTpService {
int line = 0;
if (StringUtils.isNotEmpty(busDeviceTp.getDevTpNm())) {
// 验重
Integer repeat = this.repeat(busDeviceTp.getDevTpId(), busDeviceTp.getDevTpNm());
Integer repeat = this.repeat(busDeviceTp.getDevTpId(), busDeviceTp.getDevTpNm(), busDeviceTp.getProId());
if (repeat > 0)
return new PersistModel(line, "设备类型名称不能重复");
}
......@@ -152,10 +152,11 @@ public class BusDeviceTpServiceImpl implements BusDeviceTpService {
* @param devTpNm
* @return
*/
private Integer repeat(String devTpId, String devTpNm) {
private Integer repeat(String devTpId, String devTpNm, String proId) {
Example example = new Example(BusDeviceTp.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("devTpNm", devTpNm);
criteria.andEqualTo("proId", proId);
if (StringUtils.isNotEmpty(devTpId))
criteria.andNotEqualTo("devTpId", devTpId);
return busDeviceTpRepository.selectCountByExample(example);
......
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