Commit 3fdbfd3c authored by 吴卿华's avatar 吴卿华

化工巡检

parent 9e71c079
package com.zehong.web.controller.system;
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.TNfcSetting;
import com.zehong.system.service.ITNfcSettingService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;
/**
* settingController
*
* @author zehong
* @date 2022-10-17
*/
@RestController
@RequestMapping("/system/inspection")
public class TNfcSettingController extends BaseController
{
@Autowired
private ITNfcSettingService tNfcSettingService;
/**
* 查询巡检列表
*/
//@PreAuthorize("@ss.hasPermi('system:setting:list')")
@GetMapping("/list")
public TableDataInfo list(TNfcSetting tNfcSetting)
{
startPage();
List<TNfcSetting> list = tNfcSettingService.selectTNfcSettingList(tNfcSetting);
return getDataTable(list);
}
/**
* 导出巡检列表
*/
//@PreAuthorize("@ss.hasPermi('system:setting:export')")
@Log(title = "setting", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(TNfcSetting tNfcSetting)
{
List<TNfcSetting> list = tNfcSettingService.selectTNfcSettingList(tNfcSetting);
ExcelUtil<TNfcSetting> util = new ExcelUtil<TNfcSetting>(TNfcSetting.class);
return util.exportExcel(list, "setting数据");
}
/**
* 获取巡检详细信息
*/
//@PreAuthorize("@ss.hasPermi('system:setting:query')")
@GetMapping(value = "/{nfcId}")
public AjaxResult getInfo(@PathVariable("nfcId") Long nfcId)
{
return AjaxResult.success(tNfcSettingService.selectTNfcSettingById(nfcId));
}
/**
* 新增巡检
*/
//@PreAuthorize("@ss.hasPermi('system:setting:add')")
@Log(title = "setting", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TNfcSetting tNfcSetting)
{
return toAjax(tNfcSettingService.insertTNfcSetting(tNfcSetting));
}
/**
* 修改巡检
*/
//@PreAuthorize("@ss.hasPermi('system:setting:edit')")
@Log(title = "setting", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TNfcSetting tNfcSetting)
{
return toAjax(tNfcSettingService.updateTNfcSetting(tNfcSetting));
}
/**
* 删除巡检
*/
//@PreAuthorize("@ss.hasPermi('system:setting:remove')")
@Log(title = "setting", businessType = BusinessType.DELETE)
@DeleteMapping("/{nfcIds}")
public AjaxResult remove(@PathVariable Long[] nfcIds)
{
return toAjax(tNfcSettingService.deleteTNfcSettingByIds(nfcIds));
}
}
package com.zehong.system.domain;
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;
/**
* setting对象 t_nfc_setting
*
* @author zehong
* @date 2022-10-17
*/
public class TNfcSetting extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** nfc_id */
private Long nfcId;
/** 排序 */
@Excel(name = "排序")
private Integer patrolSort;
/** 巡检地点 */
@Excel(name = "巡检地点")
private String patrolAddress;
/** 巡检内容 */
@Excel(name = "巡检内容")
private String patrolComent;
/** 巡检频次 */
@Excel(name = "巡检频次")
private String patrolFrequency;
/** nfc编号 */
@Excel(name = "nfc编号")
private String nfcNum;
/** 是否删除 0否 1是 */
private Integer isDel;
/**
* 区域 0氨合成 1罐区
*/
private String region;
public static long getSerialVersionUID() {
return serialVersionUID;
}
public String getRegion() {
return region;
}
public void setRegion(String region) {
this.region = region;
}
public void setNfcId(Long nfcId)
{
this.nfcId = nfcId;
}
public Long getNfcId()
{
return nfcId;
}
public void setPatrolSort(Integer patrolSort)
{
this.patrolSort = patrolSort;
}
public Integer getPatrolSort()
{
return patrolSort;
}
public void setPatrolAddress(String patrolAddress)
{
this.patrolAddress = patrolAddress;
}
public String getPatrolAddress()
{
return patrolAddress;
}
public void setPatrolComent(String patrolComent)
{
this.patrolComent = patrolComent;
}
public String getPatrolComent()
{
return patrolComent;
}
public void setPatrolFrequency(String patrolFrequency)
{
this.patrolFrequency = patrolFrequency;
}
public String getPatrolFrequency()
{
return patrolFrequency;
}
public void setNfcNum(String nfcNum)
{
this.nfcNum = nfcNum;
}
public String getNfcNum()
{
return nfcNum;
}
public void setIsDel(Integer isDel)
{
this.isDel = isDel;
}
public Integer getIsDel()
{
return isDel;
}
@Override
public String toString() {
return "TNfcSetting{" +
"nfcId=" + nfcId +
", patrolSort=" + patrolSort +
", patrolAddress='" + patrolAddress + '\'' +
", patrolComent='" + patrolComent + '\'' +
", patrolFrequency='" + patrolFrequency + '\'' +
", nfcNum='" + nfcNum + '\'' +
", isDel=" + isDel +
", region='" + region + '\'' +
'}';
}
}
package com.zehong.system.mapper;
import java.util.List;
import com.zehong.system.domain.TNfcSetting;
/**
* settingMapper接口
*
* @author zehong
* @date 2022-10-17
*/
public interface TNfcSettingMapper
{
/**
* 查询setting
*
* @param nfcId settingID
* @return setting
*/
public TNfcSetting selectTNfcSettingById(Long nfcId);
/**
* 查询setting列表
*
* @param tNfcSetting setting
* @return setting集合
*/
public List<TNfcSetting> selectTNfcSettingList(TNfcSetting tNfcSetting);
/**
* 新增setting
*
* @param tNfcSetting setting
* @return 结果
*/
public int insertTNfcSetting(TNfcSetting tNfcSetting);
/**
* 修改setting
*
* @param tNfcSetting setting
* @return 结果
*/
public int updateTNfcSetting(TNfcSetting tNfcSetting);
/**
* 删除setting
*
* @param nfcId settingID
* @return 结果
*/
public int deleteTNfcSettingById(Long nfcId);
/**
* 批量删除setting
*
* @param nfcIds 需要删除的数据ID
* @return 结果
*/
public int deleteTNfcSettingByIds(Long[] nfcIds);
}
package com.zehong.system.service;
import java.util.List;
import com.zehong.system.domain.TNfcSetting;
/**
* settingService接口
*
* @author zehong
* @date 2022-10-17
*/
public interface ITNfcSettingService
{
/**
* 查询setting
*
* @param nfcId settingID
* @return setting
*/
public TNfcSetting selectTNfcSettingById(Long nfcId);
/**
* 查询setting列表
*
* @param tNfcSetting setting
* @return setting集合
*/
public List<TNfcSetting> selectTNfcSettingList(TNfcSetting tNfcSetting);
/**
* 新增setting
*
* @param tNfcSetting setting
* @return 结果
*/
public int insertTNfcSetting(TNfcSetting tNfcSetting);
/**
* 修改setting
*
* @param tNfcSetting setting
* @return 结果
*/
public int updateTNfcSetting(TNfcSetting tNfcSetting);
/**
* 批量删除setting
*
* @param nfcIds 需要删除的settingID
* @return 结果
*/
public int deleteTNfcSettingByIds(Long[] nfcIds);
/**
* 删除setting信息
*
* @param nfcId settingID
* @return 结果
*/
public int deleteTNfcSettingById(Long nfcId);
}
package com.zehong.system.service.impl;
import java.util.List;
import com.zehong.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TNfcSettingMapper;
import com.zehong.system.domain.TNfcSetting;
import com.zehong.system.service.ITNfcSettingService;
/**
* settingService业务层处理
*
* @author zehong
* @date 2022-10-17
*/
@Service
public class TNfcSettingServiceImpl implements ITNfcSettingService
{
@Autowired
private TNfcSettingMapper tNfcSettingMapper;
/**
* 查询setting
*
* @param nfcId settingID
* @return setting
*/
@Override
public TNfcSetting selectTNfcSettingById(Long nfcId)
{
return tNfcSettingMapper.selectTNfcSettingById(nfcId);
}
/**
* 查询setting列表
*
* @param tNfcSetting setting
* @return setting
*/
@Override
public List<TNfcSetting> selectTNfcSettingList(TNfcSetting tNfcSetting)
{
return tNfcSettingMapper.selectTNfcSettingList(tNfcSetting);
}
/**
* 新增setting
*
* @param tNfcSetting setting
* @return 结果
*/
@Override
public int insertTNfcSetting(TNfcSetting tNfcSetting)
{
tNfcSetting.setCreateTime(DateUtils.getNowDate());
return tNfcSettingMapper.insertTNfcSetting(tNfcSetting);
}
/**
* 修改setting
*
* @param tNfcSetting setting
* @return 结果
*/
@Override
public int updateTNfcSetting(TNfcSetting tNfcSetting)
{
return tNfcSettingMapper.updateTNfcSetting(tNfcSetting);
}
/**
* 批量删除setting
*
* @param nfcIds 需要删除的settingID
* @return 结果
*/
@Override
public int deleteTNfcSettingByIds(Long[] nfcIds)
{
return tNfcSettingMapper.deleteTNfcSettingByIds(nfcIds);
}
/**
* 删除setting信息
*
* @param nfcId settingID
* @return 结果
*/
@Override
public int deleteTNfcSettingById(Long nfcId)
{
return tNfcSettingMapper.deleteTNfcSettingById(nfcId);
}
}
<?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.TNfcSettingMapper">
<resultMap type="TNfcSetting" id="TNfcSettingResult">
<result property="nfcId" column="nfc_id" />
<result property="patrolSort" column="patrol_sort" />
<result property="patrolAddress" column="patrol_address" />
<result property="patrolComent" column="patrol_coment" />
<result property="patrolFrequency" column="patrol_frequency" />
<result property="nfcNum" column="nfc_num" />
<result property="createTime" column="create_time" />
<result property="isDel" column="is_del" />
</resultMap>
<sql id="selectTNfcSettingVo">
select nfc_id, patrol_sort, patrol_address, patrol_coment, patrol_frequency, nfc_num, create_time, is_del from t_nfc_setting
</sql>
<select id="selectTNfcSettingList" parameterType="TNfcSetting" resultMap="TNfcSettingResult">
<include refid="selectTNfcSettingVo"/>
<where>
region = #{region}
<if test="patrolAddress != null and patrolAddress != ''"> and patrol_address = #{patrolAddress}</if>
<if test="nfcNum != null and nfcNum != ''"> and nfc_num = #{nfcNum}</if>
</where>
order by patrol_sort
</select>
<select id="selectTNfcSettingById" parameterType="Long" resultMap="TNfcSettingResult">
<include refid="selectTNfcSettingVo"/>
where nfc_id = #{nfcId}
</select>
<insert id="insertTNfcSetting" parameterType="TNfcSetting" useGeneratedKeys="true" keyProperty="nfcId">
insert into t_nfc_setting
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="patrolSort != null">patrol_sort,</if>
<if test="patrolAddress != null">patrol_address,</if>
<if test="patrolComent != null">patrol_coment,</if>
<if test="patrolFrequency != null">patrol_frequency,</if>
<if test="nfcNum != null">nfc_num,</if>
<if test="createTime != null">create_time,</if>
<if test="isDel != null">is_del,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="patrolSort != null">#{patrolSort},</if>
<if test="patrolAddress != null">#{patrolAddress},</if>
<if test="patrolComent != null">#{patrolComent},</if>
<if test="patrolFrequency != null">#{patrolFrequency},</if>
<if test="nfcNum != null">#{nfcNum},</if>
<if test="createTime != null">#{createTime},</if>
<if test="isDel != null">#{isDel},</if>
</trim>
</insert>
<update id="updateTNfcSetting" parameterType="TNfcSetting">
update t_nfc_setting
<trim prefix="SET" suffixOverrides=",">
<if test="patrolSort != null">patrol_sort = #{patrolSort},</if>
<if test="patrolAddress != null">patrol_address = #{patrolAddress},</if>
<if test="patrolComent != null">patrol_coment = #{patrolComent},</if>
<if test="patrolFrequency != null">patrol_frequency = #{patrolFrequency},</if>
<if test="nfcNum != null">nfc_num = #{nfcNum},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="isDel != null">is_del = #{isDel},</if>
</trim>
where nfc_id = #{nfcId}
</update>
<delete id="deleteTNfcSettingById" parameterType="Long">
delete from t_nfc_setting where nfc_id = #{nfcId}
</delete>
<delete id="deleteTNfcSettingByIds" parameterType="String">
delete from t_nfc_setting where nfc_id in
<foreach item="nfcId" collection="array" open="(" separator="," close=")">
#{nfcId}
</foreach>
</delete>
</mapper>
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