代码提交
This commit is contained in:
parent
84d2cfae51
commit
2baec0dceb
|
|
@ -35,17 +35,17 @@ public class DeviceTypeController extends BaseController {
|
|||
}
|
||||
@PreAuthorize("@ss.hasPermi('device:type:add')")
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(DeviceTypeDto dto) {
|
||||
public AjaxResult add(@RequestBody DeviceTypeDto dto) {
|
||||
return deviceTypeService.add(dto);
|
||||
}
|
||||
@PreAuthorize("@ss.hasPermi('device:type:update')")
|
||||
@GetMapping("/update")
|
||||
public AjaxResult update(DeviceTypeDto dto) {
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@RequestBody DeviceTypeDto dto) {
|
||||
return deviceTypeService.update(dto);
|
||||
}
|
||||
@PreAuthorize("@ss.hasPermi('device:type:del')")
|
||||
@GetMapping("/del")
|
||||
public AjaxResult del(DeviceTypeDto dto) {
|
||||
@PostMapping("/del")
|
||||
public AjaxResult del(@RequestBody DeviceTypeDto dto) {
|
||||
return deviceTypeService.delete(dto);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,53 @@
|
|||
package com.bonus.waterdesign.controller.water;
|
||||
|
||||
import com.bonus.common.core.controller.BaseController;
|
||||
import com.bonus.common.core.domain.AjaxResult;
|
||||
import com.bonus.common.core.page.TableDataInfo;
|
||||
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 java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:liang.chao
|
||||
* @Date:2025/11/11 - 9:50
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/owner")
|
||||
public class OwnerController extends BaseController {
|
||||
@Autowired
|
||||
private OwnerService ownerService;
|
||||
@PreAuthorize("@ss.hasPermi('owner:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(OwnerDto dto) {
|
||||
startPage();
|
||||
List<OwnerDto> list = ownerService.list(dto);
|
||||
return getDataTable(list);
|
||||
}
|
||||
@GetMapping("/listSelect")
|
||||
public AjaxResult listSelect(OwnerDto dto) {
|
||||
List<OwnerDto> list = ownerService.list(dto);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
@PreAuthorize("@ss.hasPermi('owner:add')")
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(OwnerDto dto) {
|
||||
return ownerService.add(dto);
|
||||
}
|
||||
@PreAuthorize("@ss.hasPermi('owner:update')")
|
||||
@GetMapping("/update")
|
||||
public AjaxResult update(OwnerDto dto) {
|
||||
return ownerService.update(dto);
|
||||
}
|
||||
@PreAuthorize("@ss.hasPermi('owner:del')")
|
||||
@GetMapping("/del")
|
||||
public AjaxResult del(OwnerDto dto) {
|
||||
return ownerService.delete(dto);
|
||||
}
|
||||
}
|
||||
|
|
@ -9,10 +9,7 @@ import com.bonus.waterdesign.service.DeviceTypeService;
|
|||
import com.bonus.waterdesign.service.ProTypeService;
|
||||
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;
|
||||
|
||||
|
|
@ -35,17 +32,17 @@ public class ProTypeController extends BaseController {
|
|||
}
|
||||
@PreAuthorize("@ss.hasPermi('pro:type:add')")
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(ProTypeDto dto) {
|
||||
public AjaxResult add(@RequestBody ProTypeDto dto) {
|
||||
return proTypeService.add(dto);
|
||||
}
|
||||
@PreAuthorize("@ss.hasPermi('pro:type:update')")
|
||||
@GetMapping("/update")
|
||||
public AjaxResult update(ProTypeDto dto) {
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@RequestBody ProTypeDto dto) {
|
||||
return proTypeService.update(dto);
|
||||
}
|
||||
@PreAuthorize("@ss.hasPermi('pro:type:del')")
|
||||
@GetMapping("/del")
|
||||
public AjaxResult del(ProTypeDto dto) {
|
||||
@PostMapping("/del")
|
||||
public AjaxResult del(@RequestBody ProTypeDto dto) {
|
||||
return proTypeService.delete(dto);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
package com.bonus.waterdesign.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author:liang.chao
|
||||
* @Date:2025/11/11 - 9:57
|
||||
*/
|
||||
@Data
|
||||
public class OwnerDto {
|
||||
private Integer id;
|
||||
private String unitName;
|
||||
private String unitMan;
|
||||
private String phone;
|
||||
private String address;
|
||||
private String remark;
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.bonus.waterdesign.mapper;
|
||||
|
||||
import com.bonus.waterdesign.domain.OwnerDto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:liang.chao
|
||||
* @Date:2025/11/11 - 10:00
|
||||
*/
|
||||
public interface OwnerMapper {
|
||||
List<OwnerDto> list(OwnerDto model);
|
||||
int add(OwnerDto model);
|
||||
int deleteById(OwnerDto model);
|
||||
int update(OwnerDto model);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.bonus.waterdesign.service;
|
||||
|
||||
import com.bonus.common.core.domain.AjaxResult;
|
||||
import com.bonus.waterdesign.domain.OwnerDto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:liang.chao
|
||||
* @Date:2025/11/10 - 10:34
|
||||
*/
|
||||
public interface OwnerService {
|
||||
List<OwnerDto> list(OwnerDto model);
|
||||
AjaxResult add(OwnerDto model);
|
||||
AjaxResult delete(OwnerDto dto);
|
||||
AjaxResult update(OwnerDto model);
|
||||
}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
package com.bonus.waterdesign.service.impl;
|
||||
|
||||
import com.bonus.common.core.domain.AjaxResult;
|
||||
import com.bonus.waterdesign.domain.OwnerDto;
|
||||
import com.bonus.waterdesign.mapper.OwnerMapper;
|
||||
import com.bonus.waterdesign.service.OwnerService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:liang.chao
|
||||
* @Date:2025/11/11 - 9:59
|
||||
*/
|
||||
@Service
|
||||
public class OwnerServiceImpl implements OwnerService {
|
||||
|
||||
@Resource
|
||||
private OwnerMapper ownerMapper;
|
||||
|
||||
@Override
|
||||
public List<OwnerDto> list(OwnerDto model) {
|
||||
return ownerMapper.list(model);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult add(OwnerDto model) {
|
||||
int add = ownerMapper.add(model);
|
||||
if (add > 0) {
|
||||
return AjaxResult.success("新增成功");
|
||||
} else {
|
||||
return AjaxResult.error("新增失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult delete(OwnerDto dto) {
|
||||
int i = ownerMapper.deleteById(dto);
|
||||
if (i > 0) {
|
||||
return AjaxResult.success("删除成功");
|
||||
} else {
|
||||
return AjaxResult.error("删除失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult update(OwnerDto model) {
|
||||
int update = ownerMapper.update(model);
|
||||
if (update > 0) {
|
||||
return AjaxResult.success("修改成功");
|
||||
} else {
|
||||
return AjaxResult.error("修改失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.waterdesign.mapper.OwnerMapper">
|
||||
<insert id="add">
|
||||
insert into tb_owner(unit_name,unit_man,phone,address,remark) values(#{unitName},#{unitMan},#{phone},#{address},#{remark})
|
||||
</insert>
|
||||
|
||||
<update id="update">
|
||||
UPDATE tb_owner
|
||||
<set>
|
||||
<if test="unitName != null and unitName != ''">
|
||||
unit_name = #{unitName},
|
||||
</if>
|
||||
<if test="unitMan != null and unitMan != ''">
|
||||
unit_man = #{unitMan},
|
||||
</if>
|
||||
<if test="phone != null and phone != ''">
|
||||
phone = #{phone},
|
||||
</if>
|
||||
<if test="address != null and address != ''">
|
||||
address = #{address},
|
||||
</if>
|
||||
<if test="remark != null and remark != ''">
|
||||
remark = #{remark},
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteById">
|
||||
delete
|
||||
from tb_owner
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
<select id="list" resultType="com.bonus.waterdesign.domain.OwnerDto">
|
||||
select * from tb_owner
|
||||
<where>
|
||||
<if test="unitName != null and unitName != ''" >
|
||||
and unit_Name like concat('%', #{unitName}, '%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -26,8 +26,8 @@
|
|||
SELECT
|
||||
tp.id,
|
||||
tp.pro_name,
|
||||
sdd.dict_label as pro_type,
|
||||
tp.unit_name,
|
||||
sdd.type_name as pro_type,
|
||||
oo.unit_name,
|
||||
tp.user_name,
|
||||
tp.pro_location,
|
||||
tp.lon,
|
||||
|
|
@ -38,7 +38,8 @@
|
|||
FROM
|
||||
tb_project tp
|
||||
LEFT JOIN sys_level_config sc ON sc.config_id = tp.LEVEL
|
||||
left join sys_dict_data sdd ON sdd.dict_value = tp.pro_type and sdd.dict_type = 'pro_type'
|
||||
LEFT JOIN tb_pro_type sdd ON sdd.id = tp.pro_type
|
||||
LEFT JOIN tb_owner oo on oo.id = tp.unit_id
|
||||
WHERE
|
||||
del_flag = '0'
|
||||
</sql>
|
||||
|
|
@ -52,7 +53,7 @@
|
|||
AND pro_name like concat('%', #{proName}, '%')
|
||||
</if>
|
||||
<if test="unit != null and unit != ''">
|
||||
AND unit_name = #{unit}
|
||||
AND unit_id = #{unit}
|
||||
</if>
|
||||
<if test="chargePerson != null and chargePerson != ''">
|
||||
AND user_name like concat('%', #{chargePerson}, '%')
|
||||
|
|
@ -61,13 +62,15 @@
|
|||
</select>
|
||||
|
||||
<select id="selectProjectById" parameterType="Long" resultMap="ProjectResult">
|
||||
select id, pro_name, pro_type, unit_name, user_name, pro_location, remark,lon,lat
|
||||
from tb_project
|
||||
where del_flag = '0' and id = #{proId}
|
||||
select tp.id, tp.pro_name, tp.pro_type, oo.unit_name,tp.user_name, tp.pro_location, tp.remark,tp.lon,tp.lat
|
||||
from tb_project tp
|
||||
LEFT JOIN tb_pro_type sdd ON sdd.id = tp.pro_type
|
||||
LEFT JOIN tb_owner oo on oo.id = tp.unit_id
|
||||
where tp.del_flag = '0' and tp.id = #{proId}
|
||||
</select>
|
||||
|
||||
<select id="checkProjectNameUnique" parameterType="String" resultMap="ProjectResult">
|
||||
select id, pro_name, pro_type, unit_name, user_name, pro_location, remark
|
||||
select id, pro_name, pro_type, user_name, pro_location, remark
|
||||
from tb_project
|
||||
where del_flag = '0' and pro_name=#{proName} limit 1
|
||||
</select>
|
||||
|
|
@ -122,7 +125,7 @@
|
|||
<set>
|
||||
<if test="proName != null and proName != ''">pro_name = #{proName},</if>
|
||||
<if test="proType != null and proType != ''">pro_type = #{proType},</if>
|
||||
<if test="unit != null and unit != ''">unit_name = #{unit},</if>
|
||||
<if test="unit != null and unit != ''">unit_id = #{unit},</if>
|
||||
<if test="chargePerson != null and chargePerson != ''">user_name = #{chargePerson},</if>
|
||||
<if test="location != null and location != ''">pro_location = #{location},</if>
|
||||
<if test="longitude != null and longitude != ''">lon = #{longitude},</if>
|
||||
|
|
@ -139,7 +142,7 @@
|
|||
<if test="proId != null and proId != 0">id,</if>
|
||||
<if test="proName != null and proName != ''">pro_name,</if>
|
||||
<if test="proType != null and proType != ''">pro_type,</if>
|
||||
<if test="unit != null and unit != ''">unit_name,</if>
|
||||
<if test="unit != null and unit != ''">unit_id,</if>
|
||||
<if test="chargePerson != null and chargePerson != ''">user_name,</if>
|
||||
<if test="location != null and location != ''">pro_location,</if>
|
||||
<if test="longitude != null and longitude != ''">lon,</if>
|
||||
|
|
|
|||
Loading…
Reference in New Issue