代码提交
This commit is contained in:
parent
7f66ebb176
commit
3d45c677f4
|
|
@ -7,10 +7,7 @@ import com.bonus.waterdesign.domain.OwnerDto;
|
|||
import com.bonus.waterdesign.service.OwnerService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -37,17 +34,17 @@ public class OwnerController extends BaseController {
|
|||
}
|
||||
@PreAuthorize("@ss.hasPermi('owner:add')")
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(OwnerDto dto) {
|
||||
public AjaxResult add(@RequestBody OwnerDto dto) {
|
||||
return ownerService.add(dto);
|
||||
}
|
||||
@PreAuthorize("@ss.hasPermi('owner:update')")
|
||||
@GetMapping("/update")
|
||||
public AjaxResult update(OwnerDto dto) {
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@RequestBody OwnerDto dto) {
|
||||
return ownerService.update(dto);
|
||||
}
|
||||
@PreAuthorize("@ss.hasPermi('owner:del')")
|
||||
@GetMapping("/del")
|
||||
public AjaxResult del(OwnerDto dto) {
|
||||
@PostMapping("/del")
|
||||
public AjaxResult del(@RequestBody OwnerDto dto) {
|
||||
return ownerService.delete(dto);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ public class ProTypeController extends BaseController {
|
|||
@GetMapping("/list")
|
||||
public TableDataInfo list(ProTypeDto dto) {
|
||||
startPage();
|
||||
List<ProTypeDto> list = proTypeService.getDeviceType(dto);
|
||||
List<ProTypeDto> list = proTypeService.getProType(dto);
|
||||
return getDataTable(list);
|
||||
}
|
||||
@PreAuthorize("@ss.hasPermi('pro:type:add')")
|
||||
|
|
|
|||
|
|
@ -24,4 +24,6 @@ public interface DeviceMapper {
|
|||
DeviceRecord getLastUse();
|
||||
|
||||
List<DeviceRecord> getRecordList();
|
||||
|
||||
int getCount(DeviceDto model);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,4 +14,5 @@ public interface OwnerMapper {
|
|||
int deleteById(OwnerDto model);
|
||||
int update(OwnerDto model);
|
||||
|
||||
Integer getCount(OwnerDto model);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,4 +13,6 @@ public interface ProTypeMapper {
|
|||
Integer update(ProTypeDto model);
|
||||
|
||||
Integer getCount(ProTypeDto model);
|
||||
|
||||
List<ProTypeDto> getProType(ProTypeDto model);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import java.util.List;
|
|||
* @Date:2025/11/10 - 10:34
|
||||
*/
|
||||
public interface ProTypeService {
|
||||
List<ProTypeDto> getDeviceType(ProTypeDto model);
|
||||
List<ProTypeDto> getProType(ProTypeDto model);
|
||||
AjaxResult add(ProTypeDto model);
|
||||
AjaxResult delete(ProTypeDto dto);
|
||||
AjaxResult update(ProTypeDto model);
|
||||
|
|
|
|||
|
|
@ -24,6 +24,11 @@ public class DeviceServiceImpl implements DeviceService {
|
|||
|
||||
@Override
|
||||
public AjaxResult add(DeviceDto model) {
|
||||
// 查询设备编号是否存在
|
||||
int count = deviceMapper.getCount(model);
|
||||
if (count > 0) {
|
||||
return AjaxResult.error("设备编号已存在");
|
||||
}
|
||||
int add = deviceMapper.add(model);
|
||||
if (add > 0) {
|
||||
return AjaxResult.success("新增成功");
|
||||
|
|
@ -44,6 +49,11 @@ public class DeviceServiceImpl implements DeviceService {
|
|||
|
||||
@Override
|
||||
public AjaxResult update(DeviceDto model) {
|
||||
// 查询设备编号是否存在
|
||||
int count = deviceMapper.getCount(model);
|
||||
if (count > 0) {
|
||||
return AjaxResult.error("设备编号已存在");
|
||||
}
|
||||
int add = deviceMapper.update(model);
|
||||
if (add > 0) {
|
||||
return AjaxResult.success("修改成功");
|
||||
|
|
|
|||
|
|
@ -26,6 +26,11 @@ public class OwnerServiceImpl implements OwnerService {
|
|||
|
||||
@Override
|
||||
public AjaxResult add(OwnerDto model) {
|
||||
// 验证名称是否重复
|
||||
Integer count = ownerMapper.getCount(model);
|
||||
if (count > 0) {
|
||||
return AjaxResult.error("名称已重复,请重新修改");
|
||||
}
|
||||
int add = ownerMapper.add(model);
|
||||
if (add > 0) {
|
||||
return AjaxResult.success("新增成功");
|
||||
|
|
@ -46,6 +51,11 @@ public class OwnerServiceImpl implements OwnerService {
|
|||
|
||||
@Override
|
||||
public AjaxResult update(OwnerDto model) {
|
||||
// 验证名称是否重复
|
||||
Integer count = ownerMapper.getCount(model);
|
||||
if (count > 0) {
|
||||
return AjaxResult.error("名称已重复,请重新修改");
|
||||
}
|
||||
int update = ownerMapper.update(model);
|
||||
if (update > 0) {
|
||||
return AjaxResult.success("修改成功");
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@ public class ProTypeServiceImpl implements ProTypeService {
|
|||
private ProTypeMapper proTypeMapper;
|
||||
|
||||
@Override
|
||||
public List<ProTypeDto> getDeviceType(ProTypeDto model) {
|
||||
return proTypeMapper.getDeviceType(model);
|
||||
public List<ProTypeDto> getProType(ProTypeDto model) {
|
||||
return proTypeMapper.getProType(model);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -50,22 +50,37 @@
|
|||
</delete>
|
||||
|
||||
<select id="get" resultType="com.bonus.waterdesign.domain.DeviceDto">
|
||||
select * from tb_device where id = #{id}
|
||||
</select>
|
||||
select
|
||||
device_name as deviceName,
|
||||
device_type as deviceType,
|
||||
device_code as deviceCode,
|
||||
user_id as userId,
|
||||
status,
|
||||
remark
|
||||
from tb_device
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="list" resultType="com.bonus.waterdesign.domain.DeviceDto">
|
||||
select * from tb_device
|
||||
where del_flag = 0
|
||||
<if test="deviceCode != null and deviceCode != ''">
|
||||
and device_code like concat ('%',#{deviceCode},'%')
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
and status = #{status}
|
||||
</if>
|
||||
<if test="deviceType != null and deviceType != ''">
|
||||
and device_type = #{deviceType}
|
||||
</if>
|
||||
</select>
|
||||
select
|
||||
device_name as deviceName,
|
||||
device_type as deviceType,
|
||||
device_code as deviceCode,
|
||||
user_id as userId,
|
||||
status,
|
||||
remark
|
||||
from tb_device
|
||||
where del_flag = 0
|
||||
<if test="deviceCode != null and deviceCode != ''">
|
||||
and device_code like concat ('%',#{deviceCode},'%')
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
and status = #{status}
|
||||
</if>
|
||||
<if test="deviceType != null and deviceType != ''">
|
||||
and device_type = #{deviceType}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getDeviceType" resultType="com.bonus.waterdesign.domain.SelectDto">
|
||||
select id,
|
||||
|
|
@ -107,4 +122,11 @@
|
|||
</if>
|
||||
order by id desc
|
||||
</select>
|
||||
<select id="getCount" resultType="java.lang.Integer">
|
||||
select count(1) from tb_device
|
||||
where del_flag = 0 and device_code = #{deviceCode}
|
||||
<if test="id != null and id != ''">
|
||||
and id != #{id}
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
from tb_device_type
|
||||
<where>
|
||||
<if test="typeName != null and typeName != ''">
|
||||
and type_name like concat('%', #{typeName}, '%')
|
||||
type_name like concat('%', #{typeName}, '%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -36,11 +36,17 @@
|
|||
</delete>
|
||||
|
||||
<select id="list" resultType="com.bonus.waterdesign.domain.OwnerDto">
|
||||
select * from tb_owner
|
||||
select id,unit_name as unitName,unit_man as unitMan,phone,address,remark from tb_owner
|
||||
<where>
|
||||
<if test="unitName != null and unitName != ''" >
|
||||
and unit_Name like concat('%', #{unitName}, '%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="getCount" resultType="java.lang.Integer">
|
||||
select count(1) from tb_owner where unit_name = #{unitName}
|
||||
<if test="id != null and id != ''">
|
||||
and id != #{id}
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -5,32 +5,32 @@
|
|||
<mapper namespace="com.bonus.waterdesign.mapper.ProTypeMapper">
|
||||
|
||||
<insert id="add">
|
||||
insert into tb_device_type(type_name,remark) values(#{typeName},#{remark})
|
||||
insert into tb_pro_type(type_name,remark) values(#{typeName},#{remark})
|
||||
</insert>
|
||||
|
||||
<update id="update">
|
||||
update tb_device_type
|
||||
update tb_pro_type
|
||||
set type_name=#{typeName},
|
||||
remark=#{remark}
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="delete">
|
||||
delete from tb_device_type where id=#{id}
|
||||
delete from tb_pro_type where id=#{id}
|
||||
</delete>
|
||||
|
||||
<select id="getDeviceType" resultType="com.bonus.waterdesign.domain.ProTypeDto">
|
||||
select * 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}
|
||||
select count(1) from tb_pro_type where type_name = #{typeName}
|
||||
<if test="id != null and id != ''">
|
||||
and id != #{id}
|
||||
</if>
|
||||
</select>
|
||||
<select id="getProType" resultType="com.bonus.waterdesign.domain.ProTypeDto">
|
||||
select id,type_name as typeName,remark from tb_pro_type
|
||||
<where>
|
||||
<if test="typeName != null and typeName != ''">
|
||||
type_name like concat('%', #{typeName}, '%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue