Browse Source

代码修改

liubing 3 years ago
parent
commit
43666f8abd

+ 6 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/device/DeviceDao.java

@ -25,9 +25,15 @@ public interface DeviceDao extends PagingAndSortingRepository<Device, Long> {
	@Query("select count(1) from Device a where a.del = '1' and a.name=?1 ")
	Integer findTotalByName(String name);
	@Query("select count(1) from Device a where a.del = '1' and a.categoryCode=?1 and a.name=?2 ")
	Integer findTotalByCategoryCodeAndName(String categoryCode,String name);
	@Query("select count(1) from Device a where a.del = '1' and a.model=?1")
	Integer findTotalByModel(String model);
	@Query("select count(1) from Device a where a.del = '1' and a.categoryCode=?1 and a.name=?2 and a.model=?3 ")
	Integer findTotalByCodeNameModel(String categoryCode,String name,String model);
	@Query("select a from Device a where a.del = '1' and a.model=?1")
	Device findByModel(String model);
}

+ 2 - 2
svr/svr-base/src/main/java/com/yihu/jw/base/service/device/DeviceManageService.java

@ -109,12 +109,12 @@ public class DeviceManageService extends BaseJpaService<DeviceDetail,DeviceDetai
            result.put(ResponseContant.resultMsg,"设备类型不存在");
            return result;
        }
        if (0==deviceDao.findTotalByName(deviceName)){
        if (0==deviceDao.findTotalByCategoryCodeAndName(categoryCode,deviceName)){
            result.put(ResponseContant.resultFlag,ResponseContant.fail);
            result.put(ResponseContant.resultMsg,"设备名称不存在");
            return result;
        }
        if (0==deviceDao.findTotalByModel(deviceModel)){
        if (0==deviceDao.findTotalByCodeNameModel(categoryCode,deviceName,deviceModel)){
            result.put(ResponseContant.resultFlag,ResponseContant.fail);
            result.put(ResponseContant.resultMsg,"设备型号不存在");
            return result;