Commit f6fb659d authored by 鲍德's avatar 鲍德

巡查执行管理

parent 5d6db25f
package com.censoft.censoftrongtong.controller;
import java.util.List;
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.censoft.censoftrongtong.domain.CurrentRiskUserPatrol;
import com.censoft.censoftrongtong.service.ICurrentRiskUserPatrolService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 巡查执行管理Controller
*
* @author baode
* @date 2023-12-05
*/
@RestController
@RequestMapping("/risk/riskUserPatrol")
public class CurrentRiskUserPatrolController extends BaseController
{
@Autowired
private ICurrentRiskUserPatrolService currentRiskUserPatrolService;
/**
* 查询巡查执行管理列表
*/
@PreAuthorize("@ss.hasPermi('risk:riskUserPatrol:list')")
@GetMapping("/list")
public TableDataInfo list(CurrentRiskUserPatrol currentRiskUserPatrol)
{
startPage();
List<CurrentRiskUserPatrol> list = currentRiskUserPatrolService.selectCurrentRiskUserPatrolList(currentRiskUserPatrol);
return getDataTable(list);
}
/**
* 导出巡查执行管理列表
*/
@PreAuthorize("@ss.hasPermi('risk:riskUserPatrol:export')")
@Log(title = "巡查执行管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, CurrentRiskUserPatrol currentRiskUserPatrol)
{
List<CurrentRiskUserPatrol> list = currentRiskUserPatrolService.selectCurrentRiskUserPatrolList(currentRiskUserPatrol);
ExcelUtil<CurrentRiskUserPatrol> util = new ExcelUtil<CurrentRiskUserPatrol>(CurrentRiskUserPatrol.class);
util.exportExcel(response, list, "巡查执行管理数据");
}
/**
* 获取巡查执行管理详细信息
*/
@PreAuthorize("@ss.hasPermi('risk:riskUserPatrol:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(currentRiskUserPatrolService.selectCurrentRiskUserPatrolById(id));
}
/**
* 新增巡查执行管理
*/
@PreAuthorize("@ss.hasPermi('risk:riskUserPatrol:add')")
@Log(title = "巡查执行管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody CurrentRiskUserPatrol currentRiskUserPatrol)
{
return toAjax(currentRiskUserPatrolService.insertCurrentRiskUserPatrol(currentRiskUserPatrol));
}
/**
* 修改巡查执行管理
*/
@PreAuthorize("@ss.hasPermi('risk:riskUserPatrol:edit')")
@Log(title = "巡查执行管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody CurrentRiskUserPatrol currentRiskUserPatrol)
{
return toAjax(currentRiskUserPatrolService.updateCurrentRiskUserPatrol(currentRiskUserPatrol));
}
/**
* 删除巡查执行管理
*/
@PreAuthorize("@ss.hasPermi('risk:riskUserPatrol:remove')")
@Log(title = "巡查执行管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(currentRiskUserPatrolService.deleteCurrentRiskUserPatrolByIds(ids));
}
}
package com.censoft.censoftrongtong.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.domain.BaseEntityClean;
import lombok.Data;
import com.ruoyi.common.annotation.Excel;
/**
* 巡查执行管理对象 current_risk_user_patrol
*
* @author baode
* @date 2023-12-05
*/
@Data
public class CurrentRiskUserPatrol extends BaseEntityClean
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 用户 id */
@Excel(name = "用户 id")
private Long userId;
/** 项目 id */
@Excel(name = "项目 id")
private Long projectId;
/** 现状风险岗位 id */
@Excel(name = "现状风险岗位 id")
private Long riskPostId;
/** 巡查类型 0 日查 1 周查 2 月查 3 季查 4 年查 */
@Excel(name = "巡查类型 0 日查 1 周查 2 月查 3 季查 4 年查")
private Integer patrolType;
/** 状态 0 未巡查 1 已巡查 */
@Excel(name = "状态 0 未巡查 1 已巡查")
private String status;
/** 开始巡查时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "开始巡查时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date startTime;
/** 结束巡查时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "结束巡查时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date endTime;
/** 排序 */
@Excel(name = "排序")
private Long sortNum;
/** 删除标志(0代表存在 1代表删除) */
private String delFlag;
private String riskPostName;
private String nickName;
}
package com.censoft.censoftrongtong.mapper;
import java.util.List;
import com.censoft.censoftrongtong.domain.CurrentRiskUserPatrol;
import com.github.yulichang.base.MPJBaseMapper;
/**
* 巡查执行管理Mapper接口
*
* @author baode
* @date 2023-12-05
*/
public interface CurrentRiskUserPatrolMapper extends MPJBaseMapper<CurrentRiskUserPatrol>
{
/**
* 查询巡查执行管理
*
* @param id 巡查执行管理主键
* @return 巡查执行管理
*/
public CurrentRiskUserPatrol selectCurrentRiskUserPatrolById(Long id);
/**
* 查询巡查执行管理列表
*
* @param currentRiskUserPatrol 巡查执行管理
* @return 巡查执行管理集合
*/
public List<CurrentRiskUserPatrol> selectCurrentRiskUserPatrolList(CurrentRiskUserPatrol currentRiskUserPatrol);
/**
* 新增巡查执行管理
*
* @param currentRiskUserPatrol 巡查执行管理
* @return 结果
*/
public int insertCurrentRiskUserPatrol(CurrentRiskUserPatrol currentRiskUserPatrol);
/**
* 修改巡查执行管理
*
* @param currentRiskUserPatrol 巡查执行管理
* @return 结果
*/
public int updateCurrentRiskUserPatrol(CurrentRiskUserPatrol currentRiskUserPatrol);
/**
* 删除巡查执行管理
*
* @param id 巡查执行管理主键
* @return 结果
*/
public int deleteCurrentRiskUserPatrolById(Long id);
/**
* 批量删除巡查执行管理
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteCurrentRiskUserPatrolByIds(Long[] ids);
}
package com.censoft.censoftrongtong.service;
import java.util.List;
import com.censoft.censoftrongtong.domain.CurrentRiskUserPatrol;
import com.github.yulichang.base.MPJBaseService;
/**
* 巡查执行管理Service接口
*
* @author baode
* @date 2023-12-05
*/
public interface ICurrentRiskUserPatrolService extends MPJBaseService<CurrentRiskUserPatrol>
{
/**
* 查询巡查执行管理
*
* @param id 巡查执行管理主键
* @return 巡查执行管理
*/
public CurrentRiskUserPatrol selectCurrentRiskUserPatrolById(Long id);
/**
* 查询巡查执行管理列表
*
* @param currentRiskUserPatrol 巡查执行管理
* @return 巡查执行管理集合
*/
public List<CurrentRiskUserPatrol> selectCurrentRiskUserPatrolList(CurrentRiskUserPatrol currentRiskUserPatrol);
/**
* 新增巡查执行管理
*
* @param currentRiskUserPatrol 巡查执行管理
* @return 结果
*/
public int insertCurrentRiskUserPatrol(CurrentRiskUserPatrol currentRiskUserPatrol);
/**
* 修改巡查执行管理
*
* @param currentRiskUserPatrol 巡查执行管理
* @return 结果
*/
public int updateCurrentRiskUserPatrol(CurrentRiskUserPatrol currentRiskUserPatrol);
/**
* 批量删除巡查执行管理
*
* @param ids 需要删除的巡查执行管理主键集合
* @return 结果
*/
public int deleteCurrentRiskUserPatrolByIds(Long[] ids);
/**
* 删除巡查执行管理信息
*
* @param id 巡查执行管理主键
* @return 结果
*/
public int deleteCurrentRiskUserPatrolById(Long id);
}
package com.censoft.censoftrongtong.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.censoft.censoftrongtong.mapper.CurrentRiskUserPatrolMapper;
import com.censoft.censoftrongtong.domain.CurrentRiskUserPatrol;
import com.censoft.censoftrongtong.service.ICurrentRiskUserPatrolService;
import com.github.yulichang.base.MPJBaseServiceImpl;
/**
* 巡查执行管理Service业务层处理
*
* @author baode
* @date 2023-12-05
*/
@Service
public class CurrentRiskUserPatrolServiceImpl extends MPJBaseServiceImpl<CurrentRiskUserPatrolMapper, CurrentRiskUserPatrol> implements ICurrentRiskUserPatrolService
{
@Autowired
private CurrentRiskUserPatrolMapper currentRiskUserPatrolMapper;
/**
* 查询巡查执行管理
*
* @param id 巡查执行管理主键
* @return 巡查执行管理
*/
@Override
public CurrentRiskUserPatrol selectCurrentRiskUserPatrolById(Long id)
{
return currentRiskUserPatrolMapper.selectCurrentRiskUserPatrolById(id);
}
/**
* 查询巡查执行管理列表
*
* @param currentRiskUserPatrol 巡查执行管理
* @return 巡查执行管理
*/
@Override
public List<CurrentRiskUserPatrol> selectCurrentRiskUserPatrolList(CurrentRiskUserPatrol currentRiskUserPatrol)
{
return currentRiskUserPatrolMapper.selectCurrentRiskUserPatrolList(currentRiskUserPatrol);
}
/**
* 新增巡查执行管理
*
* @param currentRiskUserPatrol 巡查执行管理
* @return 结果
*/
@Override
public int insertCurrentRiskUserPatrol(CurrentRiskUserPatrol currentRiskUserPatrol)
{
currentRiskUserPatrol.setCreateTime(DateUtils.getNowDate());
return currentRiskUserPatrolMapper.insertCurrentRiskUserPatrol(currentRiskUserPatrol);
}
/**
* 修改巡查执行管理
*
* @param currentRiskUserPatrol 巡查执行管理
* @return 结果
*/
@Override
public int updateCurrentRiskUserPatrol(CurrentRiskUserPatrol currentRiskUserPatrol)
{
currentRiskUserPatrol.setUpdateTime(DateUtils.getNowDate());
return currentRiskUserPatrolMapper.updateCurrentRiskUserPatrol(currentRiskUserPatrol);
}
/**
* 批量删除巡查执行管理
*
* @param ids 需要删除的巡查执行管理主键
* @return 结果
*/
@Override
public int deleteCurrentRiskUserPatrolByIds(Long[] ids)
{
return currentRiskUserPatrolMapper.deleteCurrentRiskUserPatrolByIds(ids);
}
/**
* 删除巡查执行管理信息
*
* @param id 巡查执行管理主键
* @return 结果
*/
@Override
public int deleteCurrentRiskUserPatrolById(Long id)
{
return currentRiskUserPatrolMapper.deleteCurrentRiskUserPatrolById(id);
}
}
<?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.censoft.censoftrongtong.mapper.CurrentRiskUserPatrolMapper">
<resultMap type="com.censoft.censoftrongtong.domain.CurrentRiskUserPatrol" id="CurrentRiskUserPatrolResult">
<result property="id" column="id" />
<result property="userId" column="user_id" />
<result property="projectId" column="project_id" />
<result property="riskPostId" column="risk_post_id" />
<result property="patrolType" column="patrol_type" />
<result property="status" column="status" />
<result property="startTime" column="start_time" />
<result property="endTime" column="end_time" />
<result property="sortNum" column="sort_num" />
<result property="delFlag" column="del_flag" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="riskPostName" column="risk_post_name" />
<result property="nickName" column="nick_name" />
</resultMap>
<sql id="selectCurrentRiskUserPatrolVo">
select a.id, user_id, project_id, risk_post_id, patrol_type, status, start_time, end_time, sort_num,
del_flag, create_by, create_time, update_by, update_time, remark from current_risk_user_patrol a
</sql>
<select id="selectCurrentRiskUserPatrolList" parameterType="com.censoft.censoftrongtong.domain.CurrentRiskUserPatrol" resultMap="CurrentRiskUserPatrolResult">
SELECT
a.id,
a.user_id,
a.project_id,
a.risk_post_id,
a.patrol_type,
a.STATUS,
a.start_time,
a.end_time,
a.sort_num,
a.del_flag,
a.create_by,
a.create_time,
a.update_by,
a.update_time,
a.remark,
b.risk_post_name,
c.nick_name
FROM
current_risk_user_patrol a
LEFT JOIN current_risk_post b on a.risk_post_id = b.id
LEFT JOIN sys_user c on a.user_id = c.user_id
<where>
<if test="userId != null "> and a.user_id = #{userId}</if>
<if test="projectId != null "> and a.project_id = #{projectId}</if>
<if test="riskPostId != null "> and a.risk_post_id = #{riskPostId}</if>
<if test="patrolType != null "> and a.patrol_type = #{patrolType}</if>
<if test="status != null and status != ''"> and a.status = #{status}</if>
<if test="startTime != null "> and a.start_time = #{startTime}</if>
<if test="endTime != null "> and a.end_time = #{endTime}</if>
<if test="sortNum != null "> and a.sort_num = #{sortNum}</if>
</where>
</select>
<select id="selectCurrentRiskUserPatrolById" parameterType="Long" resultMap="CurrentRiskUserPatrolResult">
<include refid="selectCurrentRiskUserPatrolVo"/>
where id = #{id}
</select>
<insert id="insertCurrentRiskUserPatrol" parameterType="com.censoft.censoftrongtong.domain.CurrentRiskUserPatrol" useGeneratedKeys="true" keyProperty="id">
insert into current_risk_user_patrol
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">user_id,</if>
<if test="projectId != null">project_id,</if>
<if test="riskPostId != null">risk_post_id,</if>
<if test="patrolType != null">patrol_type,</if>
<if test="status != null">status,</if>
<if test="startTime != null">start_time,</if>
<if test="endTime != null">end_time,</if>
<if test="sortNum != null">sort_num,</if>
<if test="delFlag != null">del_flag,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">#{userId},</if>
<if test="projectId != null">#{projectId},</if>
<if test="riskPostId != null">#{riskPostId},</if>
<if test="patrolType != null">#{patrolType},</if>
<if test="status != null">#{status},</if>
<if test="startTime != null">#{startTime},</if>
<if test="endTime != null">#{endTime},</if>
<if test="sortNum != null">#{sortNum},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateCurrentRiskUserPatrol" parameterType="com.censoft.censoftrongtong.domain.CurrentRiskUserPatrol">
update current_risk_user_patrol
<trim prefix="SET" suffixOverrides=",">
<if test="userId != null">user_id = #{userId},</if>
<if test="projectId != null">project_id = #{projectId},</if>
<if test="riskPostId != null">risk_post_id = #{riskPostId},</if>
<if test="patrolType != null">patrol_type = #{patrolType},</if>
<if test="status != null">status = #{status},</if>
<if test="startTime != null">start_time = #{startTime},</if>
<if test="endTime != null">end_time = #{endTime},</if>
<if test="sortNum != null">sort_num = #{sortNum},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteCurrentRiskUserPatrolById" parameterType="Long">
delete from current_risk_user_patrol where id = #{id}
</delete>
<delete id="deleteCurrentRiskUserPatrolByIds" parameterType="String">
delete from current_risk_user_patrol where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment