From b122b06488e74117e7e298dbbf7fadfc1affa91b Mon Sep 17 00:00:00 2001 From: dongdingding <207595406@qq.com> Date: Wed, 20 Sep 2023 14:16:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=89=E5=85=A8=E9=9A=90=E6=82=A3=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E6=A8=A1=E5=9D=97=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/TcSafetyCountyController.java | 106 ++++++++++++++++++ .../ruoyi/zongzhi/domain/TcSafetyCounty.java | 61 ++++++++++ .../zongzhi/mapper/TcSafetyCountyMapper.java | 61 ++++++++++ .../service/ITcSafetyCountyService.java | 61 ++++++++++ .../impl/TcSafetyCountyServiceImpl.java | 96 ++++++++++++++++ .../mapper/zongzhi/TcSafetyCountyMapper.xml | 96 ++++++++++++++++ 6 files changed, 481 insertions(+) create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/zongzhi/controller/TcSafetyCountyController.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/zongzhi/domain/TcSafetyCounty.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/zongzhi/mapper/TcSafetyCountyMapper.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/zongzhi/service/ITcSafetyCountyService.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/zongzhi/service/impl/TcSafetyCountyServiceImpl.java create mode 100644 ruoyi-system/src/main/resources/mapper/zongzhi/TcSafetyCountyMapper.xml diff --git a/ruoyi-admin/src/main/java/com/ruoyi/zongzhi/controller/TcSafetyCountyController.java b/ruoyi-admin/src/main/java/com/ruoyi/zongzhi/controller/TcSafetyCountyController.java new file mode 100644 index 0000000..929e972 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/zongzhi/controller/TcSafetyCountyController.java @@ -0,0 +1,106 @@ +package com.ruoyi.zongzhi.controller; + +import java.util.List; +import io.swagger.annotations.Api; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.zongzhi.domain.TcSafetyCounty; +import com.ruoyi.zongzhi.service.ITcSafetyCountyService; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 安全隐患统计Controller + * + * @author ruoyi + * @date 2023-09-20 + */ +@RestController +@RequestMapping("/zongzhi/county") +@Api(tags = " 安全隐患统计") +public class TcSafetyCountyController extends BaseController +{ + @Autowired + private ITcSafetyCountyService tcSafetyCountyService; + + /** + * 查询安全隐患统计列表 + */ + @PreAuthorize("@ss.hasPermi('zongzhi:county:list')") + @GetMapping("/list") + public TableDataInfo list(TcSafetyCounty tcSafetyCounty) + { + startPage(); + List list = tcSafetyCountyService.selectTcSafetyCountyList(tcSafetyCounty); + return getDataTable(list); + } + + /** + * 导出安全隐患统计列表 + */ + @PreAuthorize("@ss.hasPermi('zongzhi:county:export')") + @Log(title = "安全隐患统计", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, TcSafetyCounty tcSafetyCounty) + { + List list = tcSafetyCountyService.selectTcSafetyCountyList(tcSafetyCounty); + ExcelUtil util = new ExcelUtil(TcSafetyCounty.class); + util.exportExcel(response, list, "安全隐患统计数据"); + } + + /** + * 获取安全隐患统计详细信息 + */ + @PreAuthorize("@ss.hasPermi('zongzhi:county:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(tcSafetyCountyService.selectTcSafetyCountyById(id)); + } + + /** + * 新增安全隐患统计 + */ + @PreAuthorize("@ss.hasPermi('zongzhi:county:add')") + @Log(title = "安全隐患统计", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody TcSafetyCounty tcSafetyCounty) + { + return toAjax(tcSafetyCountyService.insertTcSafetyCounty(tcSafetyCounty)); + } + + /** + * 修改安全隐患统计 + */ + @PreAuthorize("@ss.hasPermi('zongzhi:county:edit')") + @Log(title = "安全隐患统计", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody TcSafetyCounty tcSafetyCounty) + { + return toAjax(tcSafetyCountyService.updateTcSafetyCounty(tcSafetyCounty)); + } + + /** + * 删除安全隐患统计 + */ + @PreAuthorize("@ss.hasPermi('zongzhi:county:remove')") + @Log(title = "安全隐患统计", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(tcSafetyCountyService.deleteTcSafetyCountyByIds(ids)); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/zongzhi/domain/TcSafetyCounty.java b/ruoyi-admin/src/main/java/com/ruoyi/zongzhi/domain/TcSafetyCounty.java new file mode 100644 index 0000000..c6118eb --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/zongzhi/domain/TcSafetyCounty.java @@ -0,0 +1,61 @@ +package com.ruoyi.zongzhi.domain; + +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 安全隐患统计对象 tc_safety_county + * + * @author ruoyi + * @date 2023-09-20 + */ +@Data +public class TcSafetyCounty extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** + * $column.columnComment + */ + private Long id; + + /** + * 区域id + */ + @Excel(name = "区域id") + @ApiModelProperty(value = "区域id") + private Long areaId; + + /** + * 类型名称 + */ + @Excel(name = "类型名称") + @ApiModelProperty(value = "类型名称") + private String typeName; + + /** + * 数量 + */ + @Excel(name = "数量") + @ApiModelProperty(value = "数量") + private Long totalNum; + + /** + * 创建人id + */ + @Excel(name = "创建人id") + @ApiModelProperty(value = "创建人id") + private Long createId; + + /** + * 修改人id + */ + @Excel(name = "修改人id") + @ApiModelProperty(value = "修改人id") + private Long updateId; + + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/zongzhi/mapper/TcSafetyCountyMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/zongzhi/mapper/TcSafetyCountyMapper.java new file mode 100644 index 0000000..39b05e5 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/zongzhi/mapper/TcSafetyCountyMapper.java @@ -0,0 +1,61 @@ +package com.ruoyi.zongzhi.mapper; + +import java.util.List; +import com.ruoyi.zongzhi.domain.TcSafetyCounty; + +/** + * 安全隐患统计Mapper接口 + * + * @author ruoyi + * @date 2023-09-20 + */ +public interface TcSafetyCountyMapper +{ + /** + * 查询安全隐患统计 + * + * @param id 安全隐患统计主键 + * @return 安全隐患统计 + */ + public TcSafetyCounty selectTcSafetyCountyById(Long id); + + /** + * 查询安全隐患统计列表 + * + * @param tcSafetyCounty 安全隐患统计 + * @return 安全隐患统计集合 + */ + public List selectTcSafetyCountyList(TcSafetyCounty tcSafetyCounty); + + /** + * 新增安全隐患统计 + * + * @param tcSafetyCounty 安全隐患统计 + * @return 结果 + */ + public int insertTcSafetyCounty(TcSafetyCounty tcSafetyCounty); + + /** + * 修改安全隐患统计 + * + * @param tcSafetyCounty 安全隐患统计 + * @return 结果 + */ + public int updateTcSafetyCounty(TcSafetyCounty tcSafetyCounty); + + /** + * 删除安全隐患统计 + * + * @param id 安全隐患统计主键 + * @return 结果 + */ + public int deleteTcSafetyCountyById(Long id); + + /** + * 批量删除安全隐患统计 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteTcSafetyCountyByIds(Long[] ids); +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/zongzhi/service/ITcSafetyCountyService.java b/ruoyi-admin/src/main/java/com/ruoyi/zongzhi/service/ITcSafetyCountyService.java new file mode 100644 index 0000000..0d3c7e1 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/zongzhi/service/ITcSafetyCountyService.java @@ -0,0 +1,61 @@ +package com.ruoyi.zongzhi.service; + +import java.util.List; +import com.ruoyi.zongzhi.domain.TcSafetyCounty; + +/** + * 安全隐患统计Service接口 + * + * @author ruoyi + * @date 2023-09-20 + */ +public interface ITcSafetyCountyService +{ + /** + * 查询安全隐患统计 + * + * @param id 安全隐患统计主键 + * @return 安全隐患统计 + */ + public TcSafetyCounty selectTcSafetyCountyById(Long id); + + /** + * 查询安全隐患统计列表 + * + * @param tcSafetyCounty 安全隐患统计 + * @return 安全隐患统计集合 + */ + public List selectTcSafetyCountyList(TcSafetyCounty tcSafetyCounty); + + /** + * 新增安全隐患统计 + * + * @param tcSafetyCounty 安全隐患统计 + * @return 结果 + */ + public int insertTcSafetyCounty(TcSafetyCounty tcSafetyCounty); + + /** + * 修改安全隐患统计 + * + * @param tcSafetyCounty 安全隐患统计 + * @return 结果 + */ + public int updateTcSafetyCounty(TcSafetyCounty tcSafetyCounty); + + /** + * 批量删除安全隐患统计 + * + * @param ids 需要删除的安全隐患统计主键集合 + * @return 结果 + */ + public int deleteTcSafetyCountyByIds(Long[] ids); + + /** + * 删除安全隐患统计信息 + * + * @param id 安全隐患统计主键 + * @return 结果 + */ + public int deleteTcSafetyCountyById(Long id); +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/zongzhi/service/impl/TcSafetyCountyServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/zongzhi/service/impl/TcSafetyCountyServiceImpl.java new file mode 100644 index 0000000..a8d57ac --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/zongzhi/service/impl/TcSafetyCountyServiceImpl.java @@ -0,0 +1,96 @@ +package com.ruoyi.zongzhi.service.impl; + +import java.util.List; +import com.ruoyi.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.zongzhi.mapper.TcSafetyCountyMapper; +import com.ruoyi.zongzhi.domain.TcSafetyCounty; +import com.ruoyi.zongzhi.service.ITcSafetyCountyService; + +/** + * 安全隐患统计Service业务层处理 + * + * @author ruoyi + * @date 2023-09-20 + */ +@Service +public class TcSafetyCountyServiceImpl implements ITcSafetyCountyService +{ + @Autowired + private TcSafetyCountyMapper tcSafetyCountyMapper; + + /** + * 查询安全隐患统计 + * + * @param id 安全隐患统计主键 + * @return 安全隐患统计 + */ + @Override + public TcSafetyCounty selectTcSafetyCountyById(Long id) + { + return tcSafetyCountyMapper.selectTcSafetyCountyById(id); + } + + /** + * 查询安全隐患统计列表 + * + * @param tcSafetyCounty 安全隐患统计 + * @return 安全隐患统计 + */ + @Override + public List selectTcSafetyCountyList(TcSafetyCounty tcSafetyCounty) + { + return tcSafetyCountyMapper.selectTcSafetyCountyList(tcSafetyCounty); + } + + /** + * 新增安全隐患统计 + * + * @param tcSafetyCounty 安全隐患统计 + * @return 结果 + */ + @Override + public int insertTcSafetyCounty(TcSafetyCounty tcSafetyCounty) + { + tcSafetyCounty.setCreateTime(DateUtils.getNowDate()); + return tcSafetyCountyMapper.insertTcSafetyCounty(tcSafetyCounty); + } + + /** + * 修改安全隐患统计 + * + * @param tcSafetyCounty 安全隐患统计 + * @return 结果 + */ + @Override + public int updateTcSafetyCounty(TcSafetyCounty tcSafetyCounty) + { + tcSafetyCounty.setUpdateTime(DateUtils.getNowDate()); + return tcSafetyCountyMapper.updateTcSafetyCounty(tcSafetyCounty); + } + + /** + * 批量删除安全隐患统计 + * + * @param ids 需要删除的安全隐患统计主键 + * @return 结果 + */ + @Override + public int deleteTcSafetyCountyByIds(Long[] ids) + { + return tcSafetyCountyMapper.deleteTcSafetyCountyByIds(ids); + } + + /** + * 删除安全隐患统计信息 + * + * @param id 安全隐患统计主键 + * @return 结果 + */ + @Override + public int deleteTcSafetyCountyById(Long id) + { + return tcSafetyCountyMapper.deleteTcSafetyCountyById(id); + } +} diff --git a/ruoyi-system/src/main/resources/mapper/zongzhi/TcSafetyCountyMapper.xml b/ruoyi-system/src/main/resources/mapper/zongzhi/TcSafetyCountyMapper.xml new file mode 100644 index 0000000..c313d27 --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/zongzhi/TcSafetyCountyMapper.xml @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + select id, area_id, type_name, total_num, create_id, create_by, create_time, update_id, update_by, update_time, remark from tc_safety_county + + + + + + + + insert into tc_safety_county + + area_id, + type_name, + total_num, + create_id, + create_by, + create_time, + update_id, + update_by, + update_time, + remark, + + + #{areaId}, + #{typeName}, + #{totalNum}, + #{createId}, + #{createBy}, + #{createTime}, + #{updateId}, + #{updateBy}, + #{updateTime}, + #{remark}, + + + + + update tc_safety_county + + area_id = #{areaId}, + type_name = #{typeName}, + total_num = #{totalNum}, + create_id = #{createId}, + create_by = #{createBy}, + create_time = #{createTime}, + update_id = #{updateId}, + update_by = #{updateBy}, + update_time = #{updateTime}, + remark = #{remark}, + + where id = #{id} + + + + delete from tc_safety_county where id = #{id} + + + + delete from tc_safety_county where id in + + #{id} + + + \ No newline at end of file