Commit 9ba4f77d authored by 王晓倩's avatar 王晓倩

安全承诺公告

parent 414d3f77
package com.zehong.web.controller.safetyManagement;
import java.util.List;
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.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.enums.BusinessType;
import com.zehong.system.domain.TSafetyCommitmentAnnouncement;
import com.zehong.system.service.ITSafetyCommitmentAnnouncementService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;
/**
* 安全承诺公告Controller
*
* @author zehong
* @date 2022-12-21
*/
@RestController
@RequestMapping("/safetyManagement/announcement")
public class TSafetyCommitmentAnnouncementController extends BaseController
{
@Autowired
private ITSafetyCommitmentAnnouncementService tSafetyCommitmentAnnouncementService;
/**
* 查询安全承诺公告列表
*/
@PreAuthorize("@ss.hasPermi('system:announcement:list')")
@GetMapping("/list")
public TableDataInfo list(TSafetyCommitmentAnnouncement tSafetyCommitmentAnnouncement)
{
startPage();
List<TSafetyCommitmentAnnouncement> list = tSafetyCommitmentAnnouncementService.selectTSafetyCommitmentAnnouncementList(tSafetyCommitmentAnnouncement);
return getDataTable(list);
}
/**
* 导出安全承诺公告列表
*/
//@PreAuthorize("@ss.hasPermi('system:announcement:export')")
@Log(title = "安全承诺公告", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(TSafetyCommitmentAnnouncement tSafetyCommitmentAnnouncement)
{
List<TSafetyCommitmentAnnouncement> list = tSafetyCommitmentAnnouncementService.selectTSafetyCommitmentAnnouncementList(tSafetyCommitmentAnnouncement);
ExcelUtil<TSafetyCommitmentAnnouncement> util = new ExcelUtil<TSafetyCommitmentAnnouncement>(TSafetyCommitmentAnnouncement.class);
return util.exportExcel(list, "安全承诺公告数据");
}
/**
* 获取安全承诺公告详细信息
*/
//@PreAuthorize("@ss.hasPermi('system:announcement:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(tSafetyCommitmentAnnouncementService.selectTSafetyCommitmentAnnouncementById(id));
}
/**
* 新增安全承诺公告
*/
//@PreAuthorize("@ss.hasPermi('system:announcement:add')")
@Log(title = "安全承诺公告", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TSafetyCommitmentAnnouncement tSafetyCommitmentAnnouncement)
{
return toAjax(tSafetyCommitmentAnnouncementService.insertTSafetyCommitmentAnnouncement(tSafetyCommitmentAnnouncement));
}
/**
* 修改安全承诺公告
*/
//@PreAuthorize("@ss.hasPermi('system:announcement:edit')")
@Log(title = "安全承诺公告", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TSafetyCommitmentAnnouncement tSafetyCommitmentAnnouncement)
{
return toAjax(tSafetyCommitmentAnnouncementService.updateTSafetyCommitmentAnnouncement(tSafetyCommitmentAnnouncement));
}
/**
* 删除安全承诺公告
*/
//@PreAuthorize("@ss.hasPermi('system:announcement:remove')")
@Log(title = "安全承诺公告", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(tSafetyCommitmentAnnouncementService.deleteTSafetyCommitmentAnnouncementByIds(ids));
}
}
package com.zehong.system.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zehong.common.annotation.Excel;
import com.zehong.common.core.domain.BaseEntity;
/**
* 安全承诺公告对象 t_safety_commitment_announcement
*
* @author zehong
* @date 2022-12-21
*/
@Data
public class TSafetyCommitmentAnnouncement extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 安全承诺公告id */
private Long id;
/** 生产装置 */
@Excel(name = "生产装置")
private Long productionUnit;
/** 运行装置 */
@Excel(name = "运行装置")
private Long runningDevice;
/** 停产装置 */
@Excel(name = "停产装置")
private Long shutdownDevice;
/** 检修装置 */
@Excel(name = "检修装置")
private Long maintenanceDevice;
/** 动火作业 */
@Excel(name = "动火作业")
private Long hotWork;
/** 特殊动火作业 */
@Excel(name = "特殊动火作业")
private Long specialHotWork;
/** 一级动火作业 */
@Excel(name = "一级动火作业")
private Long classOneHotWork;
/** 二级动火作业 */
@Excel(name = "二级动火作业")
private Long classTwoHotWork;
/** 是否受限空间作业(0是,1否) */
@Excel(name = "是否受限空间作业", readConverterExp = "0=是,1否")
private String isConfinedSpace;
/** 是否试生产(0是,1否) */
@Excel(name = "是否试生产", readConverterExp = "0=是,1否")
private String isTrialProduction;
/** 罐装、仓库等重大危险源是否处于安全状态(0是,1否) */
@Excel(name = "罐装、仓库等重大危险源是否处于安全状态", readConverterExp = "0=是,1否")
private String isSecurityStatus;
/** 风险等级 */
@Excel(name = "风险等级")
private String assessmentLevel;
/** 主要负责人 */
@Excel(name = "主要负责人")
private String keyPerson;
/** 承诺公告 */
@Excel(name = "承诺公告")
private String announcement;
private String status;
/** 承诺日期 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "承诺日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date commitmentDate;
}
package com.zehong.system.mapper;
import java.util.List;
import com.zehong.system.domain.TSafetyCommitmentAnnouncement;
/**
* 安全承诺公告Mapper接口
*
* @author zehong
* @date 2022-12-21
*/
public interface TSafetyCommitmentAnnouncementMapper
{
/**
* 查询安全承诺公告
*
* @param id 安全承诺公告ID
* @return 安全承诺公告
*/
public TSafetyCommitmentAnnouncement selectTSafetyCommitmentAnnouncementById(Long id);
/**
* 查询安全承诺公告列表
*
* @param tSafetyCommitmentAnnouncement 安全承诺公告
* @return 安全承诺公告集合
*/
public List<TSafetyCommitmentAnnouncement> selectTSafetyCommitmentAnnouncementList(TSafetyCommitmentAnnouncement tSafetyCommitmentAnnouncement);
/**
* 新增安全承诺公告
*
* @param tSafetyCommitmentAnnouncement 安全承诺公告
* @return 结果
*/
public int insertTSafetyCommitmentAnnouncement(TSafetyCommitmentAnnouncement tSafetyCommitmentAnnouncement);
/**
* 修改安全承诺公告
*
* @param tSafetyCommitmentAnnouncement 安全承诺公告
* @return 结果
*/
public int updateTSafetyCommitmentAnnouncement(TSafetyCommitmentAnnouncement tSafetyCommitmentAnnouncement);
/**
* 删除安全承诺公告
*
* @param id 安全承诺公告ID
* @return 结果
*/
public int deleteTSafetyCommitmentAnnouncementById(Long id);
/**
* 批量删除安全承诺公告
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteTSafetyCommitmentAnnouncementByIds(Long[] ids);
}
package com.zehong.system.service;
import java.util.List;
import com.zehong.system.domain.TSafetyCommitmentAnnouncement;
/**
* 安全承诺公告Service接口
*
* @author zehong
* @date 2022-12-21
*/
public interface ITSafetyCommitmentAnnouncementService
{
/**
* 查询安全承诺公告
*
* @param id 安全承诺公告ID
* @return 安全承诺公告
*/
public TSafetyCommitmentAnnouncement selectTSafetyCommitmentAnnouncementById(Long id);
/**
* 查询安全承诺公告列表
*
* @param tSafetyCommitmentAnnouncement 安全承诺公告
* @return 安全承诺公告集合
*/
public List<TSafetyCommitmentAnnouncement> selectTSafetyCommitmentAnnouncementList(TSafetyCommitmentAnnouncement tSafetyCommitmentAnnouncement);
/**
* 新增安全承诺公告
*
* @param tSafetyCommitmentAnnouncement 安全承诺公告
* @return 结果
*/
public int insertTSafetyCommitmentAnnouncement(TSafetyCommitmentAnnouncement tSafetyCommitmentAnnouncement);
/**
* 修改安全承诺公告
*
* @param tSafetyCommitmentAnnouncement 安全承诺公告
* @return 结果
*/
public int updateTSafetyCommitmentAnnouncement(TSafetyCommitmentAnnouncement tSafetyCommitmentAnnouncement);
/**
* 批量删除安全承诺公告
*
* @param ids 需要删除的安全承诺公告ID
* @return 结果
*/
public int deleteTSafetyCommitmentAnnouncementByIds(Long[] ids);
/**
* 删除安全承诺公告信息
*
* @param id 安全承诺公告ID
* @return 结果
*/
public int deleteTSafetyCommitmentAnnouncementById(Long id);
}
package com.zehong.system.service.impl;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TSafetyCommitmentAnnouncementMapper;
import com.zehong.system.domain.TSafetyCommitmentAnnouncement;
import com.zehong.system.service.ITSafetyCommitmentAnnouncementService;
/**
* 安全承诺公告Service业务层处理
*
* @author zehong
* @date 2022-12-21
*/
@Service
public class TSafetyCommitmentAnnouncementServiceImpl implements ITSafetyCommitmentAnnouncementService
{
@Autowired
private TSafetyCommitmentAnnouncementMapper tSafetyCommitmentAnnouncementMapper;
/**
* 查询安全承诺公告
*
* @param id 安全承诺公告ID
* @return 安全承诺公告
*/
@Override
public TSafetyCommitmentAnnouncement selectTSafetyCommitmentAnnouncementById(Long id)
{
return tSafetyCommitmentAnnouncementMapper.selectTSafetyCommitmentAnnouncementById(id);
}
/**
* 查询安全承诺公告列表
*
* @param tSafetyCommitmentAnnouncement 安全承诺公告
* @return 安全承诺公告
*/
@Override
public List<TSafetyCommitmentAnnouncement> selectTSafetyCommitmentAnnouncementList(TSafetyCommitmentAnnouncement tSafetyCommitmentAnnouncement)
{
return tSafetyCommitmentAnnouncementMapper.selectTSafetyCommitmentAnnouncementList(tSafetyCommitmentAnnouncement);
}
/**
* 新增安全承诺公告
*
* @param tSafetyCommitmentAnnouncement 安全承诺公告
* @return 结果
*/
@Override
public int insertTSafetyCommitmentAnnouncement(TSafetyCommitmentAnnouncement tSafetyCommitmentAnnouncement)
{
return tSafetyCommitmentAnnouncementMapper.insertTSafetyCommitmentAnnouncement(tSafetyCommitmentAnnouncement);
}
/**
* 修改安全承诺公告
*
* @param tSafetyCommitmentAnnouncement 安全承诺公告
* @return 结果
*/
@Override
public int updateTSafetyCommitmentAnnouncement(TSafetyCommitmentAnnouncement tSafetyCommitmentAnnouncement)
{
return tSafetyCommitmentAnnouncementMapper.updateTSafetyCommitmentAnnouncement(tSafetyCommitmentAnnouncement);
}
/**
* 批量删除安全承诺公告
*
* @param ids 需要删除的安全承诺公告ID
* @return 结果
*/
@Override
public int deleteTSafetyCommitmentAnnouncementByIds(Long[] ids)
{
return tSafetyCommitmentAnnouncementMapper.deleteTSafetyCommitmentAnnouncementByIds(ids);
}
/**
* 删除安全承诺公告信息
*
* @param id 安全承诺公告ID
* @return 结果
*/
@Override
public int deleteTSafetyCommitmentAnnouncementById(Long id)
{
return tSafetyCommitmentAnnouncementMapper.deleteTSafetyCommitmentAnnouncementById(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.zehong.system.mapper.TSafetyCommitmentAnnouncementMapper">
<resultMap type="TSafetyCommitmentAnnouncement" id="TSafetyCommitmentAnnouncementResult">
<result property="id" column="id" />
<result property="productionUnit" column="production_unit" />
<result property="runningDevice" column="running_device" />
<result property="shutdownDevice" column="shutdown_device" />
<result property="maintenanceDevice" column="maintenance_device" />
<result property="hotWork" column="hot_work" />
<result property="specialHotWork" column="special_hot_work" />
<result property="classOneHotWork" column="class_one_hot_work" />
<result property="classTwoHotWork" column="class_two_hot_work" />
<result property="isConfinedSpace" column="is_confined_space" />
<result property="isTrialProduction" column="is_trial_production" />
<result property="isSecurityStatus" column="is_security_status" />
<result property="assessmentLevel" column="assessment_level" />
<result property="keyPerson" column="key_person" />
<result property="announcement" column="announcement" />
<result property="commitmentDate" column="commitment_date" />
<result property="status" column="status" />
</resultMap>
<sql id="selectTSafetyCommitmentAnnouncementVo">
select id, production_unit, running_device, shutdown_device, maintenance_device, hot_work, special_hot_work, class_one_hot_work, class_two_hot_work, is_confined_space, is_trial_production, is_security_status, assessment_level, key_person, announcement, commitment_date, status from t_safety_commitment_announcement
</sql>
<select id="selectTSafetyCommitmentAnnouncementList" parameterType="TSafetyCommitmentAnnouncement" resultMap="TSafetyCommitmentAnnouncementResult">
<include refid="selectTSafetyCommitmentAnnouncementVo"/>
<where>
<if test="productionUnit != null "> and production_unit = #{productionUnit}</if>
<if test="runningDevice != null "> and running_device = #{runningDevice}</if>
<if test="shutdownDevice != null "> and shutdown_device = #{shutdownDevice}</if>
<if test="maintenanceDevice != null "> and maintenance_device = #{maintenanceDevice}</if>
<if test="hotWork != null "> and hot_work = #{hotWork}</if>
<if test="specialHotWork != null "> and special_hot_work = #{specialHotWork}</if>
<if test="classOneHotWork != null "> and class_one_hot_work = #{classOneHotWork}</if>
<if test="classTwoHotWork != null "> and class_two_hot_work = #{classTwoHotWork}</if>
<if test="isConfinedSpace != null and isConfinedSpace != ''"> and is_confined_space = #{isConfinedSpace}</if>
<if test="isTrialProduction != null and isTrialProduction != ''"> and is_trial_production = #{isTrialProduction}</if>
<if test="isSecurityStatus != null and isSecurityStatus != ''"> and is_security_status = #{isSecurityStatus}</if>
<if test="assessmentLevel != null and assessmentLevel != ''"> and assessment_level = #{assessmentLevel}</if>
<if test="keyPerson != null and keyPerson != ''"> and key_person = #{keyPerson}</if>
<if test="announcement != null and announcement != ''"> and announcement = #{announcement}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
AND commitment_date &gt;= #{params.beginTime}
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
AND commitment_date &lt;= #{params.endTime}
</if>
</where>
order by commitment_date desc
</select>
<select id="selectTSafetyCommitmentAnnouncementById" parameterType="Long" resultMap="TSafetyCommitmentAnnouncementResult">
<include refid="selectTSafetyCommitmentAnnouncementVo"/>
where id = #{id}
</select>
<insert id="insertTSafetyCommitmentAnnouncement" parameterType="TSafetyCommitmentAnnouncement">
insert into t_safety_commitment_announcement
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="productionUnit != null">production_unit,</if>
<if test="runningDevice != null">running_device,</if>
<if test="shutdownDevice != null">shutdown_device,</if>
<if test="maintenanceDevice != null">maintenance_device,</if>
<if test="hotWork != null">hot_work,</if>
<if test="specialHotWork != null">special_hot_work,</if>
<if test="classOneHotWork != null">class_one_hot_work,</if>
<if test="classTwoHotWork != null">class_two_hot_work,</if>
<if test="isConfinedSpace != null">is_confined_space,</if>
<if test="isTrialProduction != null">is_trial_production,</if>
<if test="isSecurityStatus != null">is_security_status,</if>
<if test="assessmentLevel != null">assessment_level,</if>
<if test="keyPerson != null">key_person,</if>
<if test="announcement != null">announcement,</if>
<if test="status != null">status,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="productionUnit != null">#{productionUnit},</if>
<if test="runningDevice != null">#{runningDevice},</if>
<if test="shutdownDevice != null">#{shutdownDevice},</if>
<if test="maintenanceDevice != null">#{maintenanceDevice},</if>
<if test="hotWork != null">#{hotWork},</if>
<if test="specialHotWork != null">#{specialHotWork},</if>
<if test="classOneHotWork != null">#{classOneHotWork},</if>
<if test="classTwoHotWork != null">#{classTwoHotWork},</if>
<if test="isConfinedSpace != null">#{isConfinedSpace},</if>
<if test="isTrialProduction != null">#{isTrialProduction},</if>
<if test="isSecurityStatus != null">#{isSecurityStatus},</if>
<if test="assessmentLevel != null">#{assessmentLevel},</if>
<if test="keyPerson != null">#{keyPerson},</if>
<if test="announcement != null">#{announcement},</if>
<if test="status != null">#{status},</if>
</trim>
</insert>
<update id="updateTSafetyCommitmentAnnouncement" parameterType="TSafetyCommitmentAnnouncement">
update t_safety_commitment_announcement
<trim prefix="SET" suffixOverrides=",">
<if test="productionUnit != null">production_unit = #{productionUnit},</if>
<if test="runningDevice != null">running_device = #{runningDevice},</if>
<if test="shutdownDevice != null">shutdown_device = #{shutdownDevice},</if>
<if test="maintenanceDevice != null">maintenance_device = #{maintenanceDevice},</if>
<if test="hotWork != null">hot_work = #{hotWork},</if>
<if test="specialHotWork != null">special_hot_work = #{specialHotWork},</if>
<if test="classOneHotWork != null">class_one_hot_work = #{classOneHotWork},</if>
<if test="classTwoHotWork != null">class_two_hot_work = #{classTwoHotWork},</if>
<if test="isConfinedSpace != null">is_confined_space = #{isConfinedSpace},</if>
<if test="isTrialProduction != null">is_trial_production = #{isTrialProduction},</if>
<if test="isSecurityStatus != null">is_security_status = #{isSecurityStatus},</if>
<if test="assessmentLevel != null">assessment_level = #{assessmentLevel},</if>
<if test="keyPerson != null">key_person = #{keyPerson},</if>
<if test="announcement != null">announcement = #{announcement},</if>
<if test="status != null">status = #{status},</if>
<if test="commitmentDate != null">commitment_date = #{commitmentDate},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteTSafetyCommitmentAnnouncementById" parameterType="Long">
delete from t_safety_commitment_announcement where id = #{id}
</delete>
<delete id="deleteTSafetyCommitmentAnnouncementByIds" parameterType="String">
delete from t_safety_commitment_announcement where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
import request from '@/utils/request'
// 查询安全承诺公告列表
export function listAnnouncement(query) {
return request({
url: '/safetyManagement/announcement/list',
method: 'get',
params: query
})
}
// 查询安全承诺公告详细
export function getAnnouncement(id) {
return request({
url: '/safetyManagement/announcement/' + id,
method: 'get'
})
}
// 新增安全承诺公告
export function addAnnouncement(data) {
return request({
url: '/safetyManagement/announcement',
method: 'post',
data: data
})
}
// 修改安全承诺公告
export function updateAnnouncement(data) {
return request({
url: '/safetyManagement/announcement',
method: 'put',
data: data
})
}
// 删除安全承诺公告
export function delAnnouncement(id) {
return request({
url: '/safetyManagement/announcement/' + id,
method: 'delete'
})
}
// 导出安全承诺公告
export function exportAnnouncement(query) {
return request({
url: '/safetyManagement/announcement/export',
method: 'get',
params: query
})
}
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