代码提交
This commit is contained in:
parent
2baec0dceb
commit
7f66ebb176
|
|
@ -11,7 +11,9 @@ import java.util.List;
|
|||
|
||||
public interface DeviceTypeMapper {
|
||||
List<DeviceTypeDto> getDeviceType(DeviceTypeDto model);
|
||||
AjaxResult add(DeviceTypeDto model);
|
||||
AjaxResult delete(DeviceTypeDto dto);
|
||||
AjaxResult update(DeviceTypeDto model);
|
||||
int add(DeviceTypeDto model);
|
||||
int delete(DeviceTypeDto dto);
|
||||
int update(DeviceTypeDto model);
|
||||
|
||||
Integer getCount(DeviceTypeDto model);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,9 @@ import java.util.List;
|
|||
|
||||
public interface ProTypeMapper {
|
||||
List<ProTypeDto> getDeviceType(ProTypeDto model);
|
||||
AjaxResult add(ProTypeDto model);
|
||||
AjaxResult delete(ProTypeDto dto);
|
||||
AjaxResult update(ProTypeDto model);
|
||||
Integer add(ProTypeDto model);
|
||||
Integer delete(ProTypeDto dto);
|
||||
Integer update(ProTypeDto model);
|
||||
|
||||
Integer getCount(ProTypeDto model);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,16 +32,41 @@ public class DeviceTypeServiceImpl implements DeviceTypeService {
|
|||
|
||||
@Override
|
||||
public AjaxResult add(DeviceTypeDto model) {
|
||||
return deviceTypeMapper.add( model);
|
||||
// 查询名称是否重复
|
||||
Integer count = deviceTypeMapper.getCount(model);
|
||||
if (count > 0) {
|
||||
return AjaxResult.error("名称已重复,请重新修改");
|
||||
}
|
||||
int add = deviceTypeMapper.add(model);
|
||||
if (add > 0) {
|
||||
return AjaxResult.success("新增成功");
|
||||
} else {
|
||||
return AjaxResult.error("新增失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult delete(DeviceTypeDto dto) {
|
||||
return deviceTypeMapper.delete(dto);
|
||||
int delete = deviceTypeMapper.delete(dto);
|
||||
if (delete > 0) {
|
||||
return AjaxResult.success("删除成功");
|
||||
} else {
|
||||
return AjaxResult.error("删除失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult update(DeviceTypeDto model) {
|
||||
return deviceTypeMapper.update( model);
|
||||
// 查询名称是否重复
|
||||
Integer count = deviceTypeMapper.getCount(model);
|
||||
if (count > 0) {
|
||||
return AjaxResult.error("名称已重复,请重新修改");
|
||||
}
|
||||
int update = deviceTypeMapper.update(model);
|
||||
if (update > 0){
|
||||
return AjaxResult.success("修改成功");
|
||||
}else {
|
||||
return AjaxResult.error("修改失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,16 +29,41 @@ public class ProTypeServiceImpl implements ProTypeService {
|
|||
|
||||
@Override
|
||||
public AjaxResult add(ProTypeDto model) {
|
||||
return proTypeMapper.add(model);
|
||||
// 查询名称是否重复
|
||||
|
||||
Integer count = proTypeMapper.getCount(model);
|
||||
if (count > 0) {
|
||||
return AjaxResult.error("名称已重复,请重新修改");
|
||||
}
|
||||
Integer add = proTypeMapper.add(model);
|
||||
if (add > 0) {
|
||||
return AjaxResult.success("新增成功");
|
||||
} else {
|
||||
return AjaxResult.error("新增失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult delete(ProTypeDto dto) {
|
||||
return proTypeMapper.delete(dto);
|
||||
Integer delete = proTypeMapper.delete(dto);
|
||||
if (delete > 0) {
|
||||
return AjaxResult.success("删除成功");
|
||||
} else {
|
||||
return AjaxResult.error("删除失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult update(ProTypeDto model) {
|
||||
return proTypeMapper.update(model);
|
||||
Integer count = proTypeMapper.getCount(model);
|
||||
if (count > 0) {
|
||||
return AjaxResult.error("名称已重复,请重新修改");
|
||||
}
|
||||
Integer update = proTypeMapper.update(model);
|
||||
if (update > 0) {
|
||||
return AjaxResult.success("修改成功");
|
||||
} else {
|
||||
return AjaxResult.error("修改失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,11 +20,20 @@
|
|||
</delete>
|
||||
|
||||
<select id="getDeviceType" resultType="com.bonus.waterdesign.domain.DeviceTypeDto">
|
||||
select * from tb_device_type
|
||||
<where>
|
||||
<if test="typeName != null and typeName != ''">
|
||||
and type_name like concat('%', #{typeName}, '%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
select id,
|
||||
type_name as typeName,
|
||||
remark
|
||||
from tb_device_type
|
||||
<where>
|
||||
<if test="typeName != null and typeName != ''">
|
||||
and type_name like concat('%', #{typeName}, '%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="getCount" resultType="java.lang.Integer">
|
||||
select count(1) from tb_device_type where type_name = #{typeName}
|
||||
<if test="id != null and id != ''">
|
||||
and id != #{id}
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -27,4 +27,10 @@
|
|||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="getCount" resultType="java.lang.Integer">
|
||||
select count(1) from tb_device_type where type_name = #{typeName}
|
||||
<if test="id != null and id != ''">
|
||||
and id != #{id}
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue