Commit 0771b49f authored by wuqinghua's avatar wuqinghua

2022-4-1 吴卿华

parent 7617257a
package com.zehong.web.controller.supervise;
import java.util.List;
import com.zehong.common.core.domain.entity.SysUser;
import com.zehong.common.utils.SecurityUtils;
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.THiddenTroubleInfo;
import com.zehong.system.service.ITHiddenTroubleInfoService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;
/**
* 燃气隐患Controller
*
* @author zehong
* @date 2022-03-31
*/
@RestController
@RequestMapping("/system/info")
public class THiddenTroubleInfoSController extends BaseController
{
@Autowired
private ITHiddenTroubleInfoService tHiddenTroubleInfoService;
/**
* 查询燃气隐患列表
*/
@PreAuthorize("@ss.hasPermi('system:info:list')")
@GetMapping("/list")
public TableDataInfo list(THiddenTroubleInfo tHiddenTroubleInfo)
{
//获取用户信息
SysUser user = SecurityUtils.getLoginUser().getUser();
tHiddenTroubleInfo.setBeyondEnterpriseId(user.getDeptId());
startPage();
List<THiddenTroubleInfo> list = tHiddenTroubleInfoService.selectTHiddenTroubleInfoList(tHiddenTroubleInfo);
return getDataTable(list);
}
/**
* 导出燃气隐患列表
*/
@PreAuthorize("@ss.hasPermi('system:info:export')")
@Log(title = "燃气隐患", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(THiddenTroubleInfo tHiddenTroubleInfo)
{
List<THiddenTroubleInfo> list = tHiddenTroubleInfoService.selectTHiddenTroubleInfoExcelList(tHiddenTroubleInfo);
ExcelUtil<THiddenTroubleInfo> util = new ExcelUtil<THiddenTroubleInfo>(THiddenTroubleInfo.class);
return util.exportExcel(list, "燃气隐患数据");
}
/**
* 获取燃气隐患详细信息
*/
@PreAuthorize("@ss.hasPermi('system:info:query')")
@GetMapping(value = "/{hiddenTroubleId}")
public AjaxResult getInfo(@PathVariable("hiddenTroubleId") Long hiddenTroubleId)
{
return AjaxResult.success(tHiddenTroubleInfoService.selectTHiddenTroubleInfoById(hiddenTroubleId));
}
/**
* 新增燃气隐患
*/
@PreAuthorize("@ss.hasPermi('system:info:add')")
@Log(title = "燃气隐患", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody THiddenTroubleInfo tHiddenTroubleInfo)
{
//获取用户信息
SysUser user = SecurityUtils.getLoginUser().getUser();
tHiddenTroubleInfo.setBeyondEnterpriseId(user.getDeptId());
return toAjax(tHiddenTroubleInfoService.insertTHiddenTroubleInfo(tHiddenTroubleInfo));
}
/**
* 修改燃气隐患
*/
@PreAuthorize("@ss.hasPermi('system:info:edit')")
@Log(title = "燃气隐患", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody THiddenTroubleInfo tHiddenTroubleInfo)
{
return toAjax(tHiddenTroubleInfoService.updateTHiddenTroubleInfo(tHiddenTroubleInfo));
}
/**
* 删除燃气隐患
*/
@PreAuthorize("@ss.hasPermi('system:info:remove')")
@Log(title = "燃气隐患", businessType = BusinessType.DELETE)
@DeleteMapping("/{hiddenTroubleIds}")
public AjaxResult remove(@PathVariable Long[] hiddenTroubleIds)
{
return toAjax(tHiddenTroubleInfoService.deleteTHiddenTroubleInfoByIds(hiddenTroubleIds));
}
}
......@@ -5,15 +5,15 @@ import com.zehong.system.domain.THiddenTroubleInfo;
/**
* 燃气隐患Mapper接口
*
*
* @author zehong
* @date 2022-03-24
*/
public interface THiddenTroubleInfoMapper
public interface THiddenTroubleInfoMapper
{
/**
* 查询燃气隐患
*
*
* @param hiddenTroubleId 燃气隐患ID
* @return 燃气隐患
*/
......@@ -21,7 +21,7 @@ public interface THiddenTroubleInfoMapper
/**
* 查询燃气隐患列表
*
*
* @param tHiddenTroubleInfo 燃气隐患
* @return 燃气隐患集合
*/
......@@ -29,7 +29,7 @@ public interface THiddenTroubleInfoMapper
/**
* 新增燃气隐患
*
*
* @param tHiddenTroubleInfo 燃气隐患
* @return 结果
*/
......@@ -37,7 +37,7 @@ public interface THiddenTroubleInfoMapper
/**
* 修改燃气隐患
*
*
* @param tHiddenTroubleInfo 燃气隐患
* @return 结果
*/
......@@ -45,7 +45,7 @@ public interface THiddenTroubleInfoMapper
/**
* 删除燃气隐患
*
*
* @param hiddenTroubleId 燃气隐患ID
* @return 结果
*/
......@@ -53,9 +53,16 @@ public interface THiddenTroubleInfoMapper
/**
* 批量删除燃气隐患
*
*
* @param hiddenTroubleIds 需要删除的数据ID
* @return 结果
*/
public int deleteTHiddenTroubleInfoByIds(Long[] hiddenTroubleIds);
/**
* Excel数据导出查询接口
* @param tHiddenTroubleInfo
* @return
*/
List<THiddenTroubleInfo> selectTHiddenTroubleInfoExcelList(THiddenTroubleInfo tHiddenTroubleInfo);
}
......@@ -5,15 +5,15 @@ import com.zehong.system.domain.THiddenTroubleInfo;
/**
* 燃气隐患Service接口
*
*
* @author zehong
* @date 2022-03-24
*/
public interface ITHiddenTroubleInfoService
public interface ITHiddenTroubleInfoService
{
/**
* 查询燃气隐患
*
*
* @param hiddenTroubleId 燃气隐患ID
* @return 燃气隐患
*/
......@@ -21,7 +21,7 @@ public interface ITHiddenTroubleInfoService
/**
* 查询燃气隐患列表
*
*
* @param tHiddenTroubleInfo 燃气隐患
* @return 燃气隐患集合
*/
......@@ -29,7 +29,7 @@ public interface ITHiddenTroubleInfoService
/**
* 新增燃气隐患
*
*
* @param tHiddenTroubleInfo 燃气隐患
* @return 结果
*/
......@@ -37,7 +37,7 @@ public interface ITHiddenTroubleInfoService
/**
* 修改燃气隐患
*
*
* @param tHiddenTroubleInfo 燃气隐患
* @return 结果
*/
......@@ -45,7 +45,7 @@ public interface ITHiddenTroubleInfoService
/**
* 批量删除燃气隐患
*
*
* @param hiddenTroubleIds 需要删除的燃气隐患ID
* @return 结果
*/
......@@ -53,9 +53,16 @@ public interface ITHiddenTroubleInfoService
/**
* 删除燃气隐患信息
*
*
* @param hiddenTroubleId 燃气隐患ID
* @return 结果
*/
public int deleteTHiddenTroubleInfoById(Long hiddenTroubleId);
/**
* Excel数据导出查询接口
* @param tHiddenTroubleInfo
* @return
*/
List<THiddenTroubleInfo> selectTHiddenTroubleInfoExcelList(THiddenTroubleInfo tHiddenTroubleInfo);
}
......@@ -10,19 +10,19 @@ import org.springframework.transaction.annotation.Transactional;
/**
* 燃气隐患Service业务层处理
*
*
* @author zehong
* @date 2022-03-24
*/
@Service
public class THiddenTroubleInfoServiceImpl implements ITHiddenTroubleInfoService
public class THiddenTroubleInfoServiceImpl implements ITHiddenTroubleInfoService
{
@Autowired
private THiddenTroubleInfoMapper tHiddenTroubleInfoMapper;
/**
* 查询燃气隐患
*
*
* @param hiddenTroubleId 燃气隐患ID
* @return 燃气隐患
*/
......@@ -34,7 +34,7 @@ public class THiddenTroubleInfoServiceImpl implements ITHiddenTroubleInfoService
/**
* 查询燃气隐患列表
*
*
* @param tHiddenTroubleInfo 燃气隐患
* @return 燃气隐患
*/
......@@ -46,7 +46,7 @@ public class THiddenTroubleInfoServiceImpl implements ITHiddenTroubleInfoService
/**
* 新增燃气隐患
*
*
* @param tHiddenTroubleInfo 燃气隐患
* @return 结果
*/
......@@ -59,7 +59,7 @@ public class THiddenTroubleInfoServiceImpl implements ITHiddenTroubleInfoService
/**
* 修改燃气隐患
*
*
* @param tHiddenTroubleInfo 燃气隐患
* @return 结果
*/
......@@ -71,7 +71,7 @@ public class THiddenTroubleInfoServiceImpl implements ITHiddenTroubleInfoService
/**
* 批量删除燃气隐患
*
*
* @param hiddenTroubleIds 需要删除的燃气隐患ID
* @return 结果
*/
......@@ -83,7 +83,7 @@ public class THiddenTroubleInfoServiceImpl implements ITHiddenTroubleInfoService
/**
* 删除燃气隐患信息
*
*
* @param hiddenTroubleId 燃气隐患ID
* @return 结果
*/
......@@ -92,4 +92,14 @@ public class THiddenTroubleInfoServiceImpl implements ITHiddenTroubleInfoService
{
return tHiddenTroubleInfoMapper.deleteTHiddenTroubleInfoById(hiddenTroubleId);
}
/**
* Excel数据导出查询接口
* @param tHiddenTroubleInfo
* @return
*/
@Override
public List<THiddenTroubleInfo> selectTHiddenTroubleInfoExcelList(THiddenTroubleInfo tHiddenTroubleInfo) {
return tHiddenTroubleInfoMapper.selectTHiddenTroubleInfoExcelList(tHiddenTroubleInfo);
}
}
......@@ -3,9 +3,10 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zehong.system.mapper.THiddenTroubleInfoMapper">
<resultMap type="THiddenTroubleInfo" id="THiddenTroubleInfoResult">
<result property="hiddenTroubleId" column="hidden_trouble_id" />
<result property="beyondEnterpriseId" column="beyond_enterprise_id" />
<result property="workId" column="work_id" />
<result property="hiddenTroubleName" column="hidden_trouble_name" />
<result property="hiddenTroubleLevel" column="hidden_trouble_level" />
......@@ -30,34 +31,44 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectTHiddenTroubleInfoList" parameterType="THiddenTroubleInfo" resultMap="THiddenTroubleInfoResult">
<include refid="selectTHiddenTroubleInfoVo"/>
<where>
<if test="workId != null "> and work_id = #{workId}</if>
<where>
is_del='0'
<if test="beyondEnterpriseId != null and beyondEnterpriseId != -2"> and beyond_enterprise_id = #{beyondEnterpriseId}</if>
<if test="hiddenTroubleName != null and hiddenTroubleName != ''"> and hidden_trouble_name like concat('%', #{hiddenTroubleName}, '%')</if>
<if test="hiddenTroubleLevel != null and hiddenTroubleLevel != ''"> and hidden_trouble_level = #{hiddenTroubleLevel}</if>
<if test="hiddenTroubleType != null and hiddenTroubleType != ''"> and hidden_trouble_type = #{hiddenTroubleType}</if>
<if test="longitude != null "> and longitude = #{longitude}</if>
<if test="latitude != null "> and latitude = #{latitude}</if>
<if test="pictureUrl != null and pictureUrl != ''"> and picture_url = #{pictureUrl}</if>
<if test="hiddenTroubleDescribe != null and hiddenTroubleDescribe != ''"> and hidden_trouble_describe = #{hiddenTroubleDescribe}</if>
<if test="reportTime != null "> and report_time = #{reportTime}</if>
<if test="reportPerson != null and reportPerson != ''"> and report_person = #{reportPerson}</if>
<if test="hiddenTroubleDealStatus != null and hiddenTroubleDealStatus != ''"> and hidden_trouble_deal_status = #{hiddenTroubleDealStatus}</if>
<if test="hiddenTroubleDealCondition != null and hiddenTroubleDealCondition != ''"> and hidden_trouble_deal_condition = #{hiddenTroubleDealCondition}</if>
<if test="hiddenTroubleDealFinishTime != null "> and hidden_trouble_deal_finish_time = #{hiddenTroubleDealFinishTime}</if>
<if test="isDel != null and isDel != ''"> and is_del = #{isDel}</if>
<if test="remarks != null and remarks != ''"> and remarks = #{remarks}</if>
</where>
group by hidden_trouble_id desc
</select>
<select id="selectTHiddenTroubleInfoById" parameterType="Long" resultMap="THiddenTroubleInfoResult">
<include refid="selectTHiddenTroubleInfoVo"/>
where hidden_trouble_id = #{hiddenTroubleId}
</select>
<!--Excel数据导出查询接口-->
<select id="selectTHiddenTroubleInfoExcelList" resultMap="THiddenTroubleInfoResult" parameterType="THiddenTroubleInfo">
select hidden_trouble_id, work_id, hidden_trouble_name,
(CASE hidden_trouble_level WHEN '1' THEN 'I级' WHEN '2' THEN 'II级'WHEN '3' THEN 'III级'end) as hidden_trouble_level,
(CASE hidden_trouble_type WHEN '1' THEN '漏气' WHEN '2' THEN '腐蚀'WHEN '3' THEN '裂缝' WHEN '4' THEN '设备故障' WHEN '5' THEN '安全距离不足' WHEN '6' THEN '管道承重'WHEN '7' THEN '其他'end) as hidden_trouble_type,
longitude, latitude, picture_url, hidden_trouble_describe,
report_time, (select u.user_name from sys_user u where u.user_id = report_person) AS report_person_name, report_person,
(CASE hidden_trouble_deal_status WHEN '1' THEN '待处理' WHEN '2' THEN '处理中'WHEN '3' THEN '已完成'end) as hidden_trouble_deal_status,
hidden_trouble_deal_condition, hidden_trouble_deal_finish_time, is_del, remarks
from t_hidden_trouble_info
<where>
is_del='0'
<if test="beyondEnterpriseId != null and beyondEnterpriseId != -2"> and beyond_enterprise_id = #{beyondEnterpriseId}</if>
<if test="hiddenTroubleName != null and hiddenTroubleName != ''"> and hidden_trouble_name like concat('%', #{hiddenTroubleName}, '%')</if>
<if test="reportPerson != null and reportPerson != ''"> and report_person = #{reportPerson}</if>
</where>
group by hidden_trouble_id desc
</select>
<insert id="insertTHiddenTroubleInfo" parameterType="THiddenTroubleInfo" useGeneratedKeys="true" keyProperty="hiddenTroubleId">
insert into t_hidden_trouble_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="workId != null">work_id,</if>
<if test="beyondEnterpriseId != null">beyond_enterprise_id,</if>
<if test="hiddenTroubleName != null">hidden_trouble_name,</if>
<if test="hiddenTroubleLevel != null">hidden_trouble_level,</if>
<if test="hiddenTroubleType != null">hidden_trouble_type,</if>
......@@ -70,11 +81,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="hiddenTroubleDealStatus != null">hidden_trouble_deal_status,</if>
<if test="hiddenTroubleDealCondition != null">hidden_trouble_deal_condition,</if>
<if test="hiddenTroubleDealFinishTime != null">hidden_trouble_deal_finish_time,</if>
<if test="isDel != null">is_del,</if>
<if test="remarks != null">remarks,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="workId != null">#{workId},</if>
<if test="beyondEnterpriseId != null">#{beyondEnterpriseId},</if>
<if test="hiddenTroubleName != null">#{hiddenTroubleName},</if>
<if test="hiddenTroubleLevel != null">#{hiddenTroubleLevel},</if>
<if test="hiddenTroubleType != null">#{hiddenTroubleType},</if>
......@@ -87,7 +98,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="hiddenTroubleDealStatus != null">#{hiddenTroubleDealStatus},</if>
<if test="hiddenTroubleDealCondition != null">#{hiddenTroubleDealCondition},</if>
<if test="hiddenTroubleDealFinishTime != null">#{hiddenTroubleDealFinishTime},</if>
<if test="isDel != null">#{isDel},</if>
<if test="remarks != null">#{remarks},</if>
</trim>
</insert>
......@@ -114,14 +124,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where hidden_trouble_id = #{hiddenTroubleId}
</update>
<delete id="deleteTHiddenTroubleInfoById" parameterType="Long">
delete from t_hidden_trouble_info where hidden_trouble_id = #{hiddenTroubleId}
</delete>
<update id="deleteTHiddenTroubleInfoById" parameterType="Long">
update t_hidden_trouble_info set is_del='1' where hidden_trouble_id = #{hiddenTroubleId}
</update>
<delete id="deleteTHiddenTroubleInfoByIds" parameterType="String">
delete from t_hidden_trouble_info where hidden_trouble_id in
<update id="deleteTHiddenTroubleInfoByIds" parameterType="String">
update t_hidden_trouble_info set is_del='1' where hidden_trouble_id in
<foreach item="hiddenTroubleId" collection="array" open="(" separator="," close=")">
#{hiddenTroubleId}
</foreach>
</delete>
</mapper>
\ No newline at end of file
</update>
</mapper>
import request from '@/utils/request'
// 查询燃气隐患列表
export function listInfo(query) {
return request({
url: '/system/info/list',
method: 'get',
params: query
})
}
// 查询燃气隐患详细
export function getInfo(hiddenTroubleId) {
return request({
url: '/system/info/' + hiddenTroubleId,
method: 'get'
})
}
// 新增燃气隐患
export function addInfo(data) {
return request({
url: '/system/info',
method: 'post',
data: data
})
}
// 修改燃气隐患
export function updateInfo(data) {
return request({
url: '/system/info',
method: 'put',
data: data
})
}
// 删除燃气隐患
export function delInfo(hiddenTroubleId) {
return request({
url: '/system/info/' + hiddenTroubleId,
method: 'delete'
})
}
// 导出燃气隐患
export function exportInfo(query) {
return request({
url: '/system/info/export',
method: 'get',
params: query
})
}
\ No newline at end of file
This diff is collapsed.
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