Commit 9cfb97a6 authored by 鲍德's avatar 鲍德

现状巡查岗位巡查清单

parent 2000f671
package com.censoft.censoftrongtong.controller; package com.censoft.censoftrongtong.controller;
import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.censoft.censoftrongtong.domain.CurrentRiskPostList;
import com.censoft.censoftrongtong.domain.CurrentRiskPostListSaveVO;
import com.censoft.censoftrongtong.service.ICurrentRiskPostListService;
import lombok.AllArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.PutMapping;
...@@ -28,11 +37,12 @@ import com.ruoyi.common.core.page.TableDataInfo; ...@@ -28,11 +37,12 @@ import com.ruoyi.common.core.page.TableDataInfo;
* @date 2023-12-01 * @date 2023-12-01
*/ */
@RestController @RestController
@AllArgsConstructor
@RequestMapping("/system/currentRiskPost") @RequestMapping("/system/currentRiskPost")
public class CurrentRiskPostController extends BaseController public class CurrentRiskPostController extends BaseController
{ {
@Autowired
private ICurrentRiskPostService currentRiskPostService; private ICurrentRiskPostService currentRiskPostService;
private ICurrentRiskPostListService currentRiskPostListService;
/** /**
* 查询现状风险岗位列表 * 查询现状风险岗位列表
...@@ -77,10 +87,42 @@ public class CurrentRiskPostController extends BaseController ...@@ -77,10 +87,42 @@ public class CurrentRiskPostController extends BaseController
@PostMapping("save") @PostMapping("save")
public AjaxResult add(@RequestBody CurrentRiskPost currentRiskPost) public AjaxResult add(@RequestBody CurrentRiskPost currentRiskPost)
{ {
if(currentRiskPost.getId() == null){ Long currentRiskPostId = currentRiskPost.getId();
if(currentRiskPostId == null){
currentRiskPostService.insertCurrentRiskPost(currentRiskPost); currentRiskPostService.insertCurrentRiskPost(currentRiskPost);
currentRiskPostId = currentRiskPost.getId();
}else{ }else{
currentRiskPostService.updateCurrentRiskPost(currentRiskPost); currentRiskPostService.updateCurrentRiskPost(currentRiskPost);
//删除原有岗位用户信息
QueryWrapper<CurrentRiskPostList> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("post_id",currentRiskPostId);
currentRiskPostListService.remove(queryWrapper);
}
//新增清单列表
List<CurrentRiskPostListSaveVO> list = currentRiskPost.getList();
if(!CollectionUtils.isEmpty(list)){
String userIds = currentRiskPost.getUserId();
for(String userId :userIds.split(",")){
List<CurrentRiskPostList> currentRiskPostLists = new ArrayList<>();
Long finalCurrentRiskPostId = currentRiskPostId;
list.forEach(vo ->{
//0 一岗一人 1 一岗多人
if("1".equals(currentRiskPost.getType()) && Long.parseLong(userId) != vo.getUserId()){
return;
}
CurrentRiskPostList currentRiskPostList = new CurrentRiskPostList();
currentRiskPostList.setProjectId(currentRiskPost.getProjectId());
currentRiskPostList.setPostId(finalCurrentRiskPostId);
currentRiskPostList.setUserId(Long.parseLong(userId));
currentRiskPostList.setCurrentRiskId(vo.getId());
currentRiskPostList.setPatrolType(vo.getPatrolType());
currentRiskPostList.setCreateTime(new Date());
currentRiskPostLists.add(currentRiskPostList);
});
if(!CollectionUtils.isEmpty(currentRiskPostLists)){
currentRiskPostListService.saveBatch(currentRiskPostLists);
}
}
} }
return AjaxResult.success(); return AjaxResult.success();
} }
......
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.CurrentRiskPostList;
import com.censoft.censoftrongtong.service.ICurrentRiskPostListService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 现状风险岗位用户巡查清单Controller
*
* @author bobbao
* @date 2023-12-07
*/
@RestController
@RequestMapping("/risk/riskPostList")
public class CurrentRiskPostListController extends BaseController
{
@Autowired
private ICurrentRiskPostListService currentRiskPostListService;
/**
* 查询现状风险岗位用户巡查清单列表
*/
@PreAuthorize("@ss.hasPermi('system:riskPostList:list')")
@GetMapping("/list")
public TableDataInfo list(CurrentRiskPostList currentRiskPostList)
{
startPage();
List<CurrentRiskPostList> list = currentRiskPostListService.selectCurrentRiskPostListList(currentRiskPostList);
return getDataTable(list);
}
/**
* 导出现状风险岗位用户巡查清单列表
*/
@PreAuthorize("@ss.hasPermi('system:riskPostList:export')")
@Log(title = "现状风险岗位用户巡查清单", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, CurrentRiskPostList currentRiskPostList)
{
List<CurrentRiskPostList> list = currentRiskPostListService.selectCurrentRiskPostListList(currentRiskPostList);
ExcelUtil<CurrentRiskPostList> util = new ExcelUtil<CurrentRiskPostList>(CurrentRiskPostList.class);
util.exportExcel(response, list, "现状风险岗位用户巡查清单数据");
}
/**
* 获取现状风险岗位用户巡查清单详细信息
*/
@PreAuthorize("@ss.hasPermi('system:riskPostList:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(currentRiskPostListService.selectCurrentRiskPostListById(id));
}
/**
* 新增现状风险岗位用户巡查清单
*/
@PreAuthorize("@ss.hasPermi('system:riskPostList:add')")
@Log(title = "现状风险岗位用户巡查清单", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody CurrentRiskPostList currentRiskPostList)
{
return toAjax(currentRiskPostListService.insertCurrentRiskPostList(currentRiskPostList));
}
/**
* 修改现状风险岗位用户巡查清单
*/
@PreAuthorize("@ss.hasPermi('system:riskPostList:edit')")
@Log(title = "现状风险岗位用户巡查清单", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody CurrentRiskPostList currentRiskPostList)
{
return toAjax(currentRiskPostListService.updateCurrentRiskPostList(currentRiskPostList));
}
/**
* 删除现状风险岗位用户巡查清单
*/
@PreAuthorize("@ss.hasPermi('system:riskPostList:remove')")
@Log(title = "现状风险岗位用户巡查清单", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(currentRiskPostListService.deleteCurrentRiskPostListByIds(ids));
}
}
...@@ -73,7 +73,7 @@ public class CurrentRiskUserPatrolController extends BaseController ...@@ -73,7 +73,7 @@ public class CurrentRiskUserPatrolController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('risk:riskUserPatrol:add')") @PreAuthorize("@ss.hasPermi('risk:riskUserPatrol:add')")
@Log(title = "巡查执行管理", businessType = BusinessType.INSERT) @Log(title = "巡查执行管理", businessType = BusinessType.INSERT)
@PostMapping @PostMapping("save")
public AjaxResult add(@RequestBody CurrentRiskUserPatrol currentRiskUserPatrol) public AjaxResult add(@RequestBody CurrentRiskUserPatrol currentRiskUserPatrol)
{ {
return toAjax(currentRiskUserPatrolService.insertCurrentRiskUserPatrol(currentRiskUserPatrol)); return toAjax(currentRiskUserPatrolService.insertCurrentRiskUserPatrol(currentRiskUserPatrol));
......
...@@ -74,7 +74,7 @@ public class CurrentRiskUserPatrolDetailController extends BaseController ...@@ -74,7 +74,7 @@ public class CurrentRiskUserPatrolDetailController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('risk:currentRiskPatrolDetail:add')") @PreAuthorize("@ss.hasPermi('risk:currentRiskPatrolDetail:add')")
@Log(title = "现状风险用户巡查明细", businessType = BusinessType.INSERT) @Log(title = "现状风险用户巡查明细", businessType = BusinessType.INSERT)
@PostMapping @PostMapping("save")
public AjaxResult add(@RequestBody CurrentRiskUserPatrolDetail currentRiskUserPatrolDetail) public AjaxResult add(@RequestBody CurrentRiskUserPatrolDetail currentRiskUserPatrolDetail)
{ {
return toAjax(currentRiskUserPatrolDetailService.insertCurrentRiskUserPatrolDetail(currentRiskUserPatrolDetail)); return toAjax(currentRiskUserPatrolDetailService.insertCurrentRiskUserPatrolDetail(currentRiskUserPatrolDetail));
......
package com.censoft.censoftrongtong.domain; package com.censoft.censoftrongtong.domain;
import com.ruoyi.common.core.domain.BaseEntityClean; import com.ruoyi.common.core.domain.BaseEntityClean;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity; import com.ruoyi.common.core.domain.BaseEntity;
import java.util.List;
/** /**
* 现状风险岗位对象 current_risk_post * 现状风险岗位对象 current_risk_post
* *
* @author ruoyi * @author ruoyi
* @date 2023-12-01 * @date 2023-12-01
*/ */
@Data
public class CurrentRiskPost extends BaseEntityClean public class CurrentRiskPost extends BaseEntityClean
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -52,113 +57,8 @@ public class CurrentRiskPost extends BaseEntityClean ...@@ -52,113 +57,8 @@ public class CurrentRiskPost extends BaseEntityClean
private String nickName; private String nickName;
public String getNickName() { @ApiModelProperty("0 一岗一人 1 一岗多人")
return nickName; private String type;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setProjectId(Long projectId)
{
this.projectId = projectId;
}
public Long getProjectId()
{
return projectId;
}
public void setRiskPostCode(String riskPostCode)
{
this.riskPostCode = riskPostCode;
}
public String getRiskPostCode()
{
return riskPostCode;
}
public void setRiskPostName(String riskPostName)
{
this.riskPostName = riskPostName;
}
public String getRiskPostName()
{
return riskPostName;
}
public void setPatrolType(String patrolType)
{
this.patrolType = patrolType;
}
public String getPatrolType()
{
return patrolType;
}
public void setRiskPostDesc(String riskPostDesc)
{
this.riskPostDesc = riskPostDesc;
}
public String getRiskPostDesc()
{
return riskPostDesc;
}
public void setUserId(String userId)
{
this.userId = userId;
}
public String getUserId()
{
return userId;
}
public void setSortNum(Long sortNum)
{
this.sortNum = sortNum;
}
public Long getSortNum()
{
return sortNum;
}
public void setDelFlag(String delFlag)
{
this.delFlag = delFlag;
}
public String getDelFlag()
{
return delFlag;
}
@Override private List<CurrentRiskPostListSaveVO> list;
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("projectId", getProjectId())
.append("riskPostCode", getRiskPostCode())
.append("riskPostName", getRiskPostName())
.append("patrolType", getPatrolType())
.append("riskPostDesc", getRiskPostDesc())
.append("userId", getUserId())
.append("sortNum", getSortNum())
.append("delFlag", getDelFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
} }
package com.censoft.censoftrongtong.domain;
import com.ruoyi.common.core.domain.BaseEntityClean;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 现状风险岗位用户巡查清单对象 current_risk_post_list
*
* @author bobbao
* @date 2023-12-07
*/
@Data
public class CurrentRiskPostList extends BaseEntityClean
{
private static final long serialVersionUID = 1L;
/** 主键 id */
private Long id;
/** 项目id */
@Excel(name = "项目id")
private Long projectId;
/** 岗位 id */
@Excel(name = "岗位 id")
private Long postId;
/** 用户 id */
@Excel(name = "用户 id")
private Long userId;
/** 现状风险 id */
@Excel(name = "现状风险 id")
private Long currentRiskId;
/** 巡查类型 */
@Excel(name = "巡查类型")
private String patrolType;
/** 排序 */
@Excel(name = "排序")
private Long sortNum;
/** 删除标志(0代表存在 1代表删除) */
private String delFlag;
private String currentRiskType;
}
package com.censoft.censoftrongtong.domain;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class CurrentRiskPostListSaveVO {
@ApiModelProperty("现有风险 id")
private Long id;
@ApiModelProperty("用户 id")
private Long userId;
@ApiModelProperty("巡查类型")
private String patrolType;
}
...@@ -39,4 +39,10 @@ public class CurrentRiskUserPatrolDetail extends BaseEntityClean ...@@ -39,4 +39,10 @@ public class CurrentRiskUserPatrolDetail extends BaseEntityClean
/** 删除标志(0代表存在 1代表删除) */ /** 删除标志(0代表存在 1代表删除) */
private String delFlag; private String delFlag;
private String riskSourceType;
private Long riskPostId;
private Long userId;
} }
package com.censoft.censoftrongtong.mapper;
import java.util.List;
import com.censoft.censoftrongtong.domain.CurrentRiskPostList;
import com.github.yulichang.base.MPJBaseMapper;
/**
* 现状风险岗位用户巡查清单Mapper接口
*
* @author bobbao
* @date 2023-12-07
*/
public interface CurrentRiskPostListMapper extends MPJBaseMapper<CurrentRiskPostList>
{
/**
* 查询现状风险岗位用户巡查清单
*
* @param id 现状风险岗位用户巡查清单主键
* @return 现状风险岗位用户巡查清单
*/
public CurrentRiskPostList selectCurrentRiskPostListById(Long id);
/**
* 查询现状风险岗位用户巡查清单列表
*
* @param currentRiskPostList 现状风险岗位用户巡查清单
* @return 现状风险岗位用户巡查清单集合
*/
public List<CurrentRiskPostList> selectCurrentRiskPostListList(CurrentRiskPostList currentRiskPostList);
/**
* 新增现状风险岗位用户巡查清单
*
* @param currentRiskPostList 现状风险岗位用户巡查清单
* @return 结果
*/
public int insertCurrentRiskPostList(CurrentRiskPostList currentRiskPostList);
/**
* 修改现状风险岗位用户巡查清单
*
* @param currentRiskPostList 现状风险岗位用户巡查清单
* @return 结果
*/
public int updateCurrentRiskPostList(CurrentRiskPostList currentRiskPostList);
/**
* 删除现状风险岗位用户巡查清单
*
* @param id 现状风险岗位用户巡查清单主键
* @return 结果
*/
public int deleteCurrentRiskPostListById(Long id);
/**
* 批量删除现状风险岗位用户巡查清单
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteCurrentRiskPostListByIds(Long[] ids);
}
package com.censoft.censoftrongtong.service;
import java.util.List;
import com.censoft.censoftrongtong.domain.CurrentRiskPostList;
import com.github.yulichang.base.MPJBaseService;
/**
* 现状风险岗位用户巡查清单Service接口
*
* @author bobbao
* @date 2023-12-07
*/
public interface ICurrentRiskPostListService extends MPJBaseService<CurrentRiskPostList>
{
/**
* 查询现状风险岗位用户巡查清单
*
* @param id 现状风险岗位用户巡查清单主键
* @return 现状风险岗位用户巡查清单
*/
public CurrentRiskPostList selectCurrentRiskPostListById(Long id);
/**
* 查询现状风险岗位用户巡查清单列表
*
* @param currentRiskPostList 现状风险岗位用户巡查清单
* @return 现状风险岗位用户巡查清单集合
*/
public List<CurrentRiskPostList> selectCurrentRiskPostListList(CurrentRiskPostList currentRiskPostList);
/**
* 新增现状风险岗位用户巡查清单
*
* @param currentRiskPostList 现状风险岗位用户巡查清单
* @return 结果
*/
public int insertCurrentRiskPostList(CurrentRiskPostList currentRiskPostList);
/**
* 修改现状风险岗位用户巡查清单
*
* @param currentRiskPostList 现状风险岗位用户巡查清单
* @return 结果
*/
public int updateCurrentRiskPostList(CurrentRiskPostList currentRiskPostList);
/**
* 批量删除现状风险岗位用户巡查清单
*
* @param ids 需要删除的现状风险岗位用户巡查清单主键集合
* @return 结果
*/
public int deleteCurrentRiskPostListByIds(Long[] ids);
/**
* 删除现状风险岗位用户巡查清单信息
*
* @param id 现状风险岗位用户巡查清单主键
* @return 结果
*/
public int deleteCurrentRiskPostListById(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.CurrentRiskPostListMapper;
import com.censoft.censoftrongtong.domain.CurrentRiskPostList;
import com.censoft.censoftrongtong.service.ICurrentRiskPostListService;
import com.github.yulichang.base.MPJBaseServiceImpl;
/**
* 现状风险岗位用户巡查清单Service业务层处理
*
* @author bobbao
* @date 2023-12-07
*/
@Service
public class CurrentRiskPostListServiceImpl extends MPJBaseServiceImpl<CurrentRiskPostListMapper, CurrentRiskPostList> implements ICurrentRiskPostListService
{
@Autowired
private CurrentRiskPostListMapper currentRiskPostListMapper;
/**
* 查询现状风险岗位用户巡查清单
*
* @param id 现状风险岗位用户巡查清单主键
* @return 现状风险岗位用户巡查清单
*/
@Override
public CurrentRiskPostList selectCurrentRiskPostListById(Long id)
{
return currentRiskPostListMapper.selectCurrentRiskPostListById(id);
}
/**
* 查询现状风险岗位用户巡查清单列表
*
* @param currentRiskPostList 现状风险岗位用户巡查清单
* @return 现状风险岗位用户巡查清单
*/
@Override
public List<CurrentRiskPostList> selectCurrentRiskPostListList(CurrentRiskPostList currentRiskPostList)
{
return currentRiskPostListMapper.selectCurrentRiskPostListList(currentRiskPostList);
}
/**
* 新增现状风险岗位用户巡查清单
*
* @param currentRiskPostList 现状风险岗位用户巡查清单
* @return 结果
*/
@Override
public int insertCurrentRiskPostList(CurrentRiskPostList currentRiskPostList)
{
currentRiskPostList.setCreateTime(DateUtils.getNowDate());
return currentRiskPostListMapper.insertCurrentRiskPostList(currentRiskPostList);
}
/**
* 修改现状风险岗位用户巡查清单
*
* @param currentRiskPostList 现状风险岗位用户巡查清单
* @return 结果
*/
@Override
public int updateCurrentRiskPostList(CurrentRiskPostList currentRiskPostList)
{
currentRiskPostList.setUpdateTime(DateUtils.getNowDate());
return currentRiskPostListMapper.updateCurrentRiskPostList(currentRiskPostList);
}
/**
* 批量删除现状风险岗位用户巡查清单
*
* @param ids 需要删除的现状风险岗位用户巡查清单主键
* @return 结果
*/
@Override
public int deleteCurrentRiskPostListByIds(Long[] ids)
{
return currentRiskPostListMapper.deleteCurrentRiskPostListByIds(ids);
}
/**
* 删除现状风险岗位用户巡查清单信息
*
* @param id 现状风险岗位用户巡查清单主键
* @return 结果
*/
@Override
public int deleteCurrentRiskPostListById(Long id)
{
return currentRiskPostListMapper.deleteCurrentRiskPostListById(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.CurrentRiskPostListMapper">
<resultMap type="com.censoft.censoftrongtong.domain.CurrentRiskPostList" id="CurrentRiskPostListResult">
<result property="id" column="id" />
<result property="projectId" column="project_id" />
<result property="postId" column="post_id" />
<result property="userId" column="user_id" />
<result property="currentRiskId" column="current_risk_id" />
<result property="patrolType" column="patrol_type" />
<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="currentRiskType" column="currentRiskType" />
</resultMap>
<sql id="selectCurrentRiskPostListVo">
select id, project_id, post_id, user_id, current_risk_id, patrol_type, sort_num, del_flag, create_by, create_time, update_by, update_time, remark from current_risk_post_list
</sql>
<select id="selectCurrentRiskPostListList" parameterType="com.censoft.censoftrongtong.domain.CurrentRiskPostList" resultMap="CurrentRiskPostListResult">
SELECT
a.id,
a.project_id,
a.post_id,
a.user_id,
a.current_risk_id,
a.patrol_type,
a.sort_num,
a.del_flag,
a.create_by,
a.create_time,
a.update_by,
a.update_time,
a.remark,
b.type currentRiskType
FROM
current_risk_post_list a
LEFT JOIN risk_plan_existing_list b on a.current_risk_id = b.id
<where>
<if test="projectId != null "> and a.project_id = #{projectId}</if>
<if test="postId != null "> and a.post_id = #{postId}</if>
<if test="userId != null "> and a.user_id = #{userId}</if>
<if test="currentRiskId != null "> and a.current_risk_id = #{currentRiskId}</if>
<if test="patrolType != null and patrolType != ''"> and a.patrol_type = #{patrolType}</if>
<if test="sortNum != null "> and a.sort_num = #{sortNum}</if>
</where>
</select>
<select id="selectCurrentRiskPostListById" parameterType="Long" resultMap="CurrentRiskPostListResult">
<include refid="selectCurrentRiskPostListVo"/>
where id = #{id}
</select>
<insert id="insertCurrentRiskPostList" parameterType="com.censoft.censoftrongtong.domain.CurrentRiskPostList" useGeneratedKeys="true" keyProperty="id">
insert into current_risk_post_list
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="projectId != null">project_id,</if>
<if test="postId != null">post_id,</if>
<if test="userId != null">user_id,</if>
<if test="currentRiskId != null">current_risk_id,</if>
<if test="patrolType != null">patrol_type,</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="projectId != null">#{projectId},</if>
<if test="postId != null">#{postId},</if>
<if test="userId != null">#{userId},</if>
<if test="currentRiskId != null">#{currentRiskId},</if>
<if test="patrolType != null">#{patrolType},</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="updateCurrentRiskPostList" parameterType="com.censoft.censoftrongtong.domain.CurrentRiskPostList">
update current_risk_post_list
<trim prefix="SET" suffixOverrides=",">
<if test="projectId != null">project_id = #{projectId},</if>
<if test="postId != null">post_id = #{postId},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="currentRiskId != null">current_risk_id = #{currentRiskId},</if>
<if test="patrolType != null">patrol_type = #{patrolType},</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="deleteCurrentRiskPostListById" parameterType="Long">
delete from current_risk_post_list where id = #{id}
</delete>
<delete id="deleteCurrentRiskPostListByIds" parameterType="String">
delete from current_risk_post_list where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
where id = #{id} where id = #{id}
</select> </select>
<insert id="insertCurrentRiskPost" parameterType="com.censoft.censoftrongtong.domain.CurrentRiskPost"> <insert id="insertCurrentRiskPost" parameterType="com.censoft.censoftrongtong.domain.CurrentRiskPost" useGeneratedKeys="true">
insert into current_risk_post insert into current_risk_post
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if> <if test="id != null">id,</if>
......
<?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.CurrentRiskUserPatrolDetailMapper">
<resultMap type="com.censoft.censoftrongtong.domain.CurrentRiskUserPatrolDetail" id="CurrentRiskUserPatrolDetailResult">
<result property="id" column="id" />
<result property="patrolId" column="patrol_id" />
<result property="currentRiskId" column="current_risk_id" />
<result property="status" column="status" />
<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="riskSourceType" column="riskSourceType" />
</resultMap>
<sql id="selectCurrentRiskUserPatrolDetailVo">
select id, patrol_id, current_risk_id, status, sort_num, del_flag, create_by, create_time, update_by, update_time, remark from current_risk_user_patrol_detail
</sql>
<select id="selectCurrentRiskUserPatrolDetailList" parameterType="com.censoft.censoftrongtong.domain.CurrentRiskUserPatrolDetail" resultMap="CurrentRiskUserPatrolDetailResult">
SELECT
a.id,
a.patrol_id,
a.current_risk_id,
a.STATUS,
a.sort_num,
a.del_flag,
a.create_by,
a.create_time,
a.update_by,
a.update_time,
a.remark,
c.type riskSourceType
FROM
current_risk_user_patrol_detail a
INNER JOIN current_risk_user_patrol b ON a.patrol_id = b.id
INNER JOIN risk_plan_existing_list c ON a.current_risk_id = c.id
<where>
<if test="riskPostId != null "> and b.risk_post_id = #{riskPostId}</if>
<if test="userId != null "> and b.user_id = #{userId}</if>
<if test="patrolId != null "> and a.patrol_id = #{patrolId}</if>
<if test="currentRiskId != null "> and a.current_risk_id = #{currentRiskId}</if>
<if test="status != null and status != ''"> and a.status = #{status}</if>
<if test="sortNum != null "> and a.sort_num = #{sortNum}</if>
</where>
</select>
<select id="selectCurrentRiskUserPatrolDetailById" parameterType="Long" resultMap="CurrentRiskUserPatrolDetailResult">
<include refid="selectCurrentRiskUserPatrolDetailVo"/>
where id = #{id}
</select>
<insert id="insertCurrentRiskUserPatrolDetail" parameterType="com.censoft.censoftrongtong.domain.CurrentRiskUserPatrolDetail" useGeneratedKeys="true" keyProperty="id">
insert into current_risk_user_patrol_detail
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="patrolId != null">patrol_id,</if>
<if test="currentRiskId != null">current_risk_id,</if>
<if test="status != null">status,</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="patrolId != null">#{patrolId},</if>
<if test="currentRiskId != null">#{currentRiskId},</if>
<if test="status != null">#{status},</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="updateCurrentRiskUserPatrolDetail" parameterType="com.censoft.censoftrongtong.domain.CurrentRiskUserPatrolDetail">
update current_risk_user_patrol_detail
<trim prefix="SET" suffixOverrides=",">
<if test="patrolId != null">patrol_id = #{patrolId},</if>
<if test="currentRiskId != null">current_risk_id = #{currentRiskId},</if>
<if test="status != null">status = #{status},</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="deleteCurrentRiskUserPatrolDetailById" parameterType="Long">
delete from current_risk_user_patrol_detail where id = #{id}
</delete>
<delete id="deleteCurrentRiskUserPatrolDetailByIds" parameterType="String">
delete from current_risk_user_patrol_detail 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