Commit 7465d894 authored by 鲍德's avatar 鲍德

风险巡查岗位

parent 7c3f44df
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.CurrentRiskPost;
import com.censoft.censoftrongtong.service.ICurrentRiskPostService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 现状风险岗位Controller
*
* @author ruoyi
* @date 2023-12-01
*/
@RestController
@RequestMapping("/system/currentRiskPost")
public class CurrentRiskPostController extends BaseController
{
@Autowired
private ICurrentRiskPostService currentRiskPostService;
/**
* 查询现状风险岗位列表
*/
@PreAuthorize("@ss.hasPermi('system:currentRiskPost:list')")
@GetMapping("/list")
public TableDataInfo list(CurrentRiskPost currentRiskPost)
{
startPage();
List<CurrentRiskPost> list = currentRiskPostService.selectCurrentRiskPostList(currentRiskPost);
return getDataTable(list);
}
/**
* 导出现状风险岗位列表
*/
@PreAuthorize("@ss.hasPermi('system:currentRiskPost:export')")
@Log(title = "现状风险岗位", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, CurrentRiskPost currentRiskPost)
{
List<CurrentRiskPost> list = currentRiskPostService.selectCurrentRiskPostList(currentRiskPost);
ExcelUtil<CurrentRiskPost> util = new ExcelUtil<CurrentRiskPost>(CurrentRiskPost.class);
util.exportExcel(response, list, "现状风险岗位数据");
}
/**
* 获取现状风险岗位详细信息
*/
@PreAuthorize("@ss.hasPermi('system:currentRiskPost:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(currentRiskPostService.selectCurrentRiskPostById(id));
}
/**
* 新增现状风险岗位
*/
@PreAuthorize("@ss.hasPermi('system:currentRiskPost:add')")
@Log(title = "现状风险岗位", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody CurrentRiskPost currentRiskPost)
{
if(currentRiskPost.getId() == null){
currentRiskPostService.insertCurrentRiskPost(currentRiskPost);
}else{
currentRiskPostService.updateCurrentRiskPost(currentRiskPost);
}
return AjaxResult.success();
}
/**
* 修改现状风险岗位
*/
@PreAuthorize("@ss.hasPermi('system:currentRiskPost:edit')")
@Log(title = "现状风险岗位", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody CurrentRiskPost currentRiskPost)
{
return toAjax(currentRiskPostService.updateCurrentRiskPost(currentRiskPost));
}
/**
* 删除现状风险岗位
*/
@PreAuthorize("@ss.hasPermi('system:currentRiskPost:remove')")
@Log(title = "现状风险岗位", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(currentRiskPostService.deleteCurrentRiskPostByIds(ids));
}
}
package com.censoft.censoftrongtong.domain;
import com.ruoyi.common.core.domain.BaseEntityClean;
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
*
* @author ruoyi
* @date 2023-12-01
*/
public class CurrentRiskPost extends BaseEntityClean
{
private static final long serialVersionUID = 1L;
/** 主键 id */
private Long id;
/** 项目id */
@Excel(name = "项目id")
private Long projectId;
/** 岗位编码 */
@Excel(name = "岗位编码")
private String riskPostCode;
/** 岗位名称 */
@Excel(name = "岗位名称")
private String riskPostName;
/** 巡查类型 */
@Excel(name = "巡查类型")
private String patrolType;
/** 岗位描述 */
@Excel(name = "岗位描述")
private String riskPostDesc;
/** 用户 id */
@Excel(name = "用户 id")
private String userId;
/** 排序 */
@Excel(name = "排序")
private Long sortNum;
/** 删除标志(0代表存在 1代表删除) */
private String delFlag;
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
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.mapper;
import java.util.List;
import com.censoft.censoftrongtong.domain.CurrentRiskPost;
import com.github.yulichang.base.MPJBaseMapper;
/**
* 现状风险岗位Mapper接口
*
* @author ruoyi
* @date 2023-12-01
*/
public interface CurrentRiskPostMapper extends MPJBaseMapper<CurrentRiskPost>
{
/**
* 查询现状风险岗位
*
* @param id 现状风险岗位主键
* @return 现状风险岗位
*/
public CurrentRiskPost selectCurrentRiskPostById(Long id);
/**
* 查询现状风险岗位列表
*
* @param currentRiskPost 现状风险岗位
* @return 现状风险岗位集合
*/
public List<CurrentRiskPost> selectCurrentRiskPostList(CurrentRiskPost currentRiskPost);
/**
* 新增现状风险岗位
*
* @param currentRiskPost 现状风险岗位
* @return 结果
*/
public int insertCurrentRiskPost(CurrentRiskPost currentRiskPost);
/**
* 修改现状风险岗位
*
* @param currentRiskPost 现状风险岗位
* @return 结果
*/
public int updateCurrentRiskPost(CurrentRiskPost currentRiskPost);
/**
* 删除现状风险岗位
*
* @param id 现状风险岗位主键
* @return 结果
*/
public int deleteCurrentRiskPostById(Long id);
/**
* 批量删除现状风险岗位
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteCurrentRiskPostByIds(Long[] ids);
}
package com.censoft.censoftrongtong.service;
import java.util.List;
import com.censoft.censoftrongtong.domain.CurrentRiskPost;
import com.github.yulichang.base.MPJBaseService;
/**
* 现状风险岗位Service接口
*
* @author ruoyi
* @date 2023-12-01
*/
public interface ICurrentRiskPostService extends MPJBaseService<CurrentRiskPost>
{
/**
* 查询现状风险岗位
*
* @param id 现状风险岗位主键
* @return 现状风险岗位
*/
public CurrentRiskPost selectCurrentRiskPostById(Long id);
/**
* 查询现状风险岗位列表
*
* @param currentRiskPost 现状风险岗位
* @return 现状风险岗位集合
*/
public List<CurrentRiskPost> selectCurrentRiskPostList(CurrentRiskPost currentRiskPost);
/**
* 新增现状风险岗位
*
* @param currentRiskPost 现状风险岗位
* @return 结果
*/
public int insertCurrentRiskPost(CurrentRiskPost currentRiskPost);
/**
* 修改现状风险岗位
*
* @param currentRiskPost 现状风险岗位
* @return 结果
*/
public int updateCurrentRiskPost(CurrentRiskPost currentRiskPost);
/**
* 批量删除现状风险岗位
*
* @param ids 需要删除的现状风险岗位主键集合
* @return 结果
*/
public int deleteCurrentRiskPostByIds(Long[] ids);
/**
* 删除现状风险岗位信息
*
* @param id 现状风险岗位主键
* @return 结果
*/
public int deleteCurrentRiskPostById(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.CurrentRiskPostMapper;
import com.censoft.censoftrongtong.domain.CurrentRiskPost;
import com.censoft.censoftrongtong.service.ICurrentRiskPostService;
import com.github.yulichang.base.MPJBaseServiceImpl;
/**
* 现状风险岗位Service业务层处理
*
* @author ruoyi
* @date 2023-12-01
*/
@Service
public class CurrentRiskPostServiceImpl extends MPJBaseServiceImpl<CurrentRiskPostMapper, CurrentRiskPost> implements ICurrentRiskPostService
{
@Autowired
private CurrentRiskPostMapper currentRiskPostMapper;
/**
* 查询现状风险岗位
*
* @param id 现状风险岗位主键
* @return 现状风险岗位
*/
@Override
public CurrentRiskPost selectCurrentRiskPostById(Long id)
{
return currentRiskPostMapper.selectCurrentRiskPostById(id);
}
/**
* 查询现状风险岗位列表
*
* @param currentRiskPost 现状风险岗位
* @return 现状风险岗位
*/
@Override
public List<CurrentRiskPost> selectCurrentRiskPostList(CurrentRiskPost currentRiskPost)
{
return currentRiskPostMapper.selectCurrentRiskPostList(currentRiskPost);
}
/**
* 新增现状风险岗位
*
* @param currentRiskPost 现状风险岗位
* @return 结果
*/
@Override
public int insertCurrentRiskPost(CurrentRiskPost currentRiskPost)
{
currentRiskPost.setCreateTime(DateUtils.getNowDate());
return currentRiskPostMapper.insertCurrentRiskPost(currentRiskPost);
}
/**
* 修改现状风险岗位
*
* @param currentRiskPost 现状风险岗位
* @return 结果
*/
@Override
public int updateCurrentRiskPost(CurrentRiskPost currentRiskPost)
{
currentRiskPost.setUpdateTime(DateUtils.getNowDate());
return currentRiskPostMapper.updateCurrentRiskPost(currentRiskPost);
}
/**
* 批量删除现状风险岗位
*
* @param ids 需要删除的现状风险岗位主键
* @return 结果
*/
@Override
public int deleteCurrentRiskPostByIds(Long[] ids)
{
return currentRiskPostMapper.deleteCurrentRiskPostByIds(ids);
}
/**
* 删除现状风险岗位信息
*
* @param id 现状风险岗位主键
* @return 结果
*/
@Override
public int deleteCurrentRiskPostById(Long id)
{
return currentRiskPostMapper.deleteCurrentRiskPostById(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.CurrentRiskPostMapper">
<resultMap type="com.censoft.censoftrongtong.domain.CurrentRiskPost" id="CurrentRiskPostResult">
<result property="id" column="id" />
<result property="projectId" column="project_id" />
<result property="riskPostCode" column="risk_post_code" />
<result property="riskPostName" column="risk_post_name" />
<result property="patrolType" column="patrol_type" />
<result property="riskPostDesc" column="risk_post_desc" />
<result property="userId" column="user_id" />
<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" />
</resultMap>
<sql id="selectCurrentRiskPostVo">
select id, project_id, risk_post_code, risk_post_name, patrol_type, risk_post_desc, user_id, sort_num, del_flag, create_by, create_time, update_by, update_time, remark from current_risk_post
</sql>
<select id="selectCurrentRiskPostList" parameterType="com.censoft.censoftrongtong.domain.CurrentRiskPost" resultMap="CurrentRiskPostResult">
<include refid="selectCurrentRiskPostVo"/>
<where>
<if test="projectId != null "> and project_id = #{projectId}</if>
<if test="riskPostCode != null and riskPostCode != ''"> and risk_post_code = #{riskPostCode}</if>
<if test="riskPostName != null and riskPostName != ''"> and risk_post_name like concat('%', #{riskPostName}, '%')</if>
<if test="patrolType != null and patrolType != ''"> and patrol_type = #{patrolType}</if>
<if test="riskPostDesc != null and riskPostDesc != ''"> and risk_post_desc = #{riskPostDesc}</if>
<if test="userId != null and userId != ''"> and user_id = #{userId}</if>
<if test="sortNum != null "> and sort_num = #{sortNum}</if>
</where>
</select>
<select id="selectCurrentRiskPostById" parameterType="Long" resultMap="CurrentRiskPostResult">
<include refid="selectCurrentRiskPostVo"/>
where id = #{id}
</select>
<insert id="insertCurrentRiskPost" parameterType="com.censoft.censoftrongtong.domain.CurrentRiskPost">
insert into current_risk_post
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="projectId != null">project_id,</if>
<if test="riskPostCode != null">risk_post_code,</if>
<if test="riskPostName != null">risk_post_name,</if>
<if test="patrolType != null">patrol_type,</if>
<if test="riskPostDesc != null">risk_post_desc,</if>
<if test="userId != null">user_id,</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="id != null">#{id},</if>
<if test="projectId != null">#{projectId},</if>
<if test="riskPostCode != null">#{riskPostCode},</if>
<if test="riskPostName != null">#{riskPostName},</if>
<if test="patrolType != null">#{patrolType},</if>
<if test="riskPostDesc != null">#{riskPostDesc},</if>
<if test="userId != null">#{userId},</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="updateCurrentRiskPost" parameterType="com.censoft.censoftrongtong.domain.CurrentRiskPost">
update current_risk_post
<trim prefix="SET" suffixOverrides=",">
<if test="projectId != null">project_id = #{projectId},</if>
<if test="riskPostCode != null">risk_post_code = #{riskPostCode},</if>
<if test="riskPostName != null">risk_post_name = #{riskPostName},</if>
<if test="patrolType != null">patrol_type = #{patrolType},</if>
<if test="riskPostDesc != null">risk_post_desc = #{riskPostDesc},</if>
<if test="userId != null">user_id = #{userId},</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="deleteCurrentRiskPostById" parameterType="Long">
delete from current_risk_post where id = #{id}
</delete>
<delete id="deleteCurrentRiskPostByIds" parameterType="String">
delete from current_risk_post where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
......@@ -34,6 +34,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="projectId != null "> and project_id = #{projectId}</if>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="postId != null "> and post_id = #{postId}</if>
<if test="projectName != null "> and b.`name` like concat('%',#{projectName},'%')</if>
</where>
</select>
......
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