6 changed files with 486 additions and 2 deletions
@ -0,0 +1,106 @@ |
|||
package com.zc.business.controller; |
|||
|
|||
import com.zc.business.service.IDcWarningService; |
|||
import com.ruoyi.common.annotation.Log; |
|||
import com.ruoyi.common.core.controller.BaseController; |
|||
import com.ruoyi.common.core.domain.AjaxResult; |
|||
import com.ruoyi.common.core.page.TableDataInfo; |
|||
import com.ruoyi.common.enums.BusinessType; |
|||
import com.ruoyi.common.utils.poi.ExcelUtil; |
|||
import com.zc.business.domain.DcWarning; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.web.bind.annotation.DeleteMapping; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.PathVariable; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.PutMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 预警信息Controller |
|||
* |
|||
* @author ruoyi |
|||
* @date 2024-01-26 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("/business/warning") |
|||
public class DcWarningController extends BaseController |
|||
{ |
|||
@Autowired |
|||
private IDcWarningService dcWarningService; |
|||
|
|||
/** |
|||
* 查询预警信息列表 |
|||
*/ |
|||
@PreAuthorize("@ss.hasPermi('business:warning:list')") |
|||
@GetMapping("/list") |
|||
public TableDataInfo list(DcWarning dcWarning) |
|||
{ |
|||
startPage(); |
|||
List<HashMap<String,Object>> list = dcWarningService.selectDcWarningList(dcWarning); |
|||
return getDataTable(list); |
|||
} |
|||
|
|||
/** |
|||
* 导出预警信息列表 |
|||
*/ |
|||
@PreAuthorize("@ss.hasPermi('business:warning:export')") |
|||
@Log(title = "预警信息", businessType = BusinessType.EXPORT) |
|||
@PostMapping("/export") |
|||
public void export(HttpServletResponse response, DcWarning dcWarning) |
|||
{ |
|||
List<DcWarning> list = dcWarningService.export(dcWarning); |
|||
ExcelUtil<DcWarning> util = new ExcelUtil<>(DcWarning.class); |
|||
util.exportExcel(response, list, "预警信息数据"); |
|||
} |
|||
|
|||
/** |
|||
* 获取预警信息详细信息 |
|||
*/ |
|||
@PreAuthorize("@ss.hasPermi('business:warning:query')") |
|||
@GetMapping(value = "/{id}") |
|||
public AjaxResult getInfo(@PathVariable("id") Integer id) |
|||
{ |
|||
return AjaxResult.success(dcWarningService.selectDcWarningById(id)); |
|||
} |
|||
|
|||
/** |
|||
* 新增预警信息 |
|||
*/ |
|||
@PreAuthorize("@ss.hasPermi('business:warning:add')") |
|||
@Log(title = "预警信息", businessType = BusinessType.INSERT) |
|||
@PostMapping |
|||
public AjaxResult add(@RequestBody DcWarning dcWarning) |
|||
{ |
|||
return toAjax(dcWarningService.insertDcWarning(dcWarning)); |
|||
} |
|||
|
|||
/** |
|||
* 修改预警信息 |
|||
*/ |
|||
@PreAuthorize("@ss.hasPermi('business:warning:edit')") |
|||
@Log(title = "预警信息", businessType = BusinessType.UPDATE) |
|||
@PutMapping |
|||
public AjaxResult edit(@RequestBody DcWarning dcWarning) |
|||
{ |
|||
return toAjax(dcWarningService.updateDcWarning(dcWarning)); |
|||
} |
|||
|
|||
/** |
|||
* 删除预警信息 |
|||
*/ |
|||
@PreAuthorize("@ss.hasPermi('business:warning:remove')") |
|||
@Log(title = "预警信息", businessType = BusinessType.DELETE) |
|||
@DeleteMapping("/{ids}") |
|||
public AjaxResult remove(@PathVariable Integer[] ids) |
|||
{ |
|||
return toAjax(dcWarningService.deleteDcWarningByIds(ids)); |
|||
} |
|||
} |
@ -0,0 +1,63 @@ |
|||
package com.zc.business.mapper; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import com.zc.business.domain.DcWarning; |
|||
|
|||
/** |
|||
* 预警信息Mapper接口 |
|||
* |
|||
* @author ruoyi |
|||
* @date 2024-01-26 |
|||
*/ |
|||
public interface DcWarningMapper |
|||
{ |
|||
/** |
|||
* 查询预警信息 |
|||
* |
|||
* @param id 预警信息主键 |
|||
* @return 预警信息 |
|||
*/ |
|||
public HashMap<String,Object> selectDcWarningById(Integer id); |
|||
|
|||
/** |
|||
* 查询预警信息列表 |
|||
* |
|||
* @param dcWarning 预警信息 |
|||
* @return 预警信息集合 |
|||
*/ |
|||
List<HashMap<String,Object>> selectDcWarningList(DcWarning dcWarning); |
|||
//导出
|
|||
List<DcWarning> export(DcWarning dcWarning); |
|||
/** |
|||
* 新增预警信息 |
|||
* |
|||
* @param dcWarning 预警信息 |
|||
* @return 结果 |
|||
*/ |
|||
int insertDcWarning(DcWarning dcWarning); |
|||
|
|||
/** |
|||
* 修改预警信息 |
|||
* |
|||
* @param dcWarning 预警信息 |
|||
* @return 结果 |
|||
*/ |
|||
int updateDcWarning(DcWarning dcWarning); |
|||
|
|||
/** |
|||
* 删除预警信息 |
|||
* |
|||
* @param id 预警信息主键 |
|||
* @return 结果 |
|||
*/ |
|||
int deleteDcWarningById(Integer id); |
|||
|
|||
/** |
|||
* 批量删除预警信息 |
|||
* |
|||
* @param ids 需要删除的数据主键集合 |
|||
* @return 结果 |
|||
*/ |
|||
int deleteDcWarningByIds(Integer[] ids); |
|||
} |
@ -0,0 +1,64 @@ |
|||
package com.zc.business.service; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
|
|||
import com.zc.business.domain.DcWarning; |
|||
|
|||
/** |
|||
* 预警信息Service接口 |
|||
* |
|||
* @author ruoyi |
|||
* @date 2024-01-26 |
|||
*/ |
|||
public interface IDcWarningService |
|||
{ |
|||
/** |
|||
* 查询预警信息 |
|||
* |
|||
* @param id 预警信息主键 |
|||
* @return 预警信息 |
|||
*/ |
|||
public HashMap<String,Object> selectDcWarningById(Integer id); |
|||
|
|||
/** |
|||
* 查询预警信息列表 |
|||
* |
|||
* @param dcWarning 预警信息 |
|||
* @return 预警信息集合 |
|||
*/ |
|||
List<HashMap<String,Object>> selectDcWarningList(DcWarning dcWarning); |
|||
//导出
|
|||
List<DcWarning> export(DcWarning dcWarning); |
|||
/** |
|||
* 新增预警信息 |
|||
* |
|||
* @param dcWarning 预警信息 |
|||
* @return 结果 |
|||
*/ |
|||
int insertDcWarning(DcWarning dcWarning); |
|||
|
|||
/** |
|||
* 修改预警信息 |
|||
* |
|||
* @param dcWarning 预警信息 |
|||
* @return 结果 |
|||
*/ |
|||
int updateDcWarning(DcWarning dcWarning); |
|||
|
|||
/** |
|||
* 批量删除预警信息 |
|||
* |
|||
* @param ids 需要删除的预警信息主键集合 |
|||
* @return 结果 |
|||
*/ |
|||
int deleteDcWarningByIds(Integer[] ids); |
|||
|
|||
/** |
|||
* 删除预警信息信息 |
|||
* |
|||
* @param id 预警信息主键 |
|||
* @return 结果 |
|||
*/ |
|||
int deleteDcWarningById(Integer id); |
|||
} |
@ -0,0 +1,103 @@ |
|||
package com.zc.business.service.impl; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import com.ruoyi.common.utils.DateUtils; |
|||
import com.zc.business.mapper.DcWarningMapper; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import com.zc.business.domain.DcWarning; |
|||
import com.zc.business.service.IDcWarningService; |
|||
|
|||
/** |
|||
* 预警信息Service业务层处理 |
|||
* |
|||
* @author ruoyi |
|||
* @date 2024-01-26 |
|||
*/ |
|||
@Service |
|||
public class DcWarningServiceImpl implements IDcWarningService |
|||
{ |
|||
@Autowired |
|||
private DcWarningMapper dcWarningMapper; |
|||
|
|||
/** |
|||
* 查询预警信息 |
|||
* |
|||
* @param id 预警信息主键 |
|||
* @return 预警信息 |
|||
*/ |
|||
@Override |
|||
public HashMap<String, Object> selectDcWarningById(Integer id) |
|||
{ |
|||
return dcWarningMapper.selectDcWarningById(id); |
|||
} |
|||
|
|||
/** |
|||
* 查询预警信息列表 |
|||
* |
|||
* @param dcWarning 预警信息 |
|||
* @return 预警信息 |
|||
*/ |
|||
@Override |
|||
public List<HashMap<String,Object>> selectDcWarningList(DcWarning dcWarning) |
|||
{ |
|||
return dcWarningMapper.selectDcWarningList(dcWarning); |
|||
} |
|||
//导出
|
|||
@Override |
|||
public List<DcWarning> export(DcWarning dcWarning) { |
|||
return dcWarningMapper.export(dcWarning); |
|||
} |
|||
|
|||
/** |
|||
* 新增预警信息 |
|||
* |
|||
* @param dcWarning 预警信息 |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int insertDcWarning(DcWarning dcWarning) |
|||
{ |
|||
dcWarning.setCreateTime(DateUtils.getNowDate()); |
|||
return dcWarningMapper.insertDcWarning(dcWarning); |
|||
} |
|||
|
|||
/** |
|||
* 修改预警信息 |
|||
* |
|||
* @param dcWarning 预警信息 |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int updateDcWarning(DcWarning dcWarning) |
|||
{ |
|||
dcWarning.setUpdateTime(DateUtils.getNowDate()); |
|||
return dcWarningMapper.updateDcWarning(dcWarning); |
|||
} |
|||
|
|||
/** |
|||
* 批量删除预警信息 |
|||
* |
|||
* @param ids 需要删除的预警信息主键 |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int deleteDcWarningByIds(Integer[] ids) |
|||
{ |
|||
return dcWarningMapper.deleteDcWarningByIds(ids); |
|||
} |
|||
|
|||
/** |
|||
* 删除预警信息信息 |
|||
* |
|||
* @param id 预警信息主键 |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int deleteDcWarningById(Integer id) |
|||
{ |
|||
return dcWarningMapper.deleteDcWarningById(id); |
|||
} |
|||
} |
@ -0,0 +1,145 @@ |
|||
<?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.zc.business.mapper.DcWarningMapper"> |
|||
|
|||
<resultMap type="DcWarning" id="DcWarningResult"> |
|||
<result property="id" column="id" /> |
|||
<result property="stakeMark" column="stake_mark" /> |
|||
<result property="direction" column="direction" /> |
|||
<result property="deptId" column="dept_id" /> |
|||
<result property="warningState" column="warning_state" /> |
|||
<result property="warningTime" column="warning_time" /> |
|||
<result property="userId" column="user_id" /> |
|||
<result property="warningSource" column="warning_source" /> |
|||
<result property="warningLevel" column="warning_level" /> |
|||
<result property="remark" column="remark" /> |
|||
<result property="createTime" column="create_time" /> |
|||
<result property="updateTime" column="update_time" /> |
|||
<result property="warningType" column="warning_type" /> |
|||
<result property="warningSubclass" column="warning_subclass" /> |
|||
<result property="warningTitle" column="warning_title" /> |
|||
<result property="otherConfig" column="other_config" /> |
|||
<result property="lane" column="lane" /> |
|||
</resultMap> |
|||
|
|||
<sql id="selectDcWarningVo"> |
|||
select id, stake_mark stakeMark, direction, dept_id deptId, |
|||
warning_state warningState, |
|||
DATE_FORMAT(warning_time,'%Y-%m-%d %H:%m:%s')warningTime, |
|||
user_id userId, warning_source warningSource, warning_level warningLevel, |
|||
remark, DATE_FORMAT(create_time,'%Y-%m-%d %H:%m:%s')createTime, |
|||
DATE_FORMAT(update_time,'%Y-%m-%d %H:%m:%s')updateTime, |
|||
warning_type warningType, warning_subclass warningSubclass, warning_title warningTitle, |
|||
other_config otherConfig, lane from dc_warning |
|||
</sql> |
|||
|
|||
<select id="selectDcWarningList" parameterType="DcWarning" resultType="hashmap"> |
|||
<include refid="selectDcWarningVo"/> |
|||
<where> |
|||
<if test="stakeMark != null and stakeMark != ''"> and stake_mark = #{stakeMark}</if> |
|||
<if test="direction != null and direction != ''"> and direction = #{direction}</if> |
|||
<if test="deptId != null "> and dept_id = #{deptId}</if> |
|||
<if test="warningState != null "> and warning_state = #{warningState}</if> |
|||
<if test="warningTime != null "> and warning_time = #{warningTime}</if> |
|||
<if test="userId != null "> and user_id = #{userId}</if> |
|||
<if test="warningSource != null "> and warning_source = #{warningSource}</if> |
|||
<if test="warningLevel != null "> and warning_level = #{warningLevel}</if> |
|||
<if test="warningType != null "> and warning_type = #{warningType}</if> |
|||
<if test="warningSubclass != null and warningSubclass != ''"> and warning_subclass = #{warningSubclass}</if> |
|||
<if test="warningTitle != null and warningTitle != ''"> and warning_title = #{warningTitle}</if> |
|||
<if test="otherConfig != null and otherConfig != ''"> and other_config = #{otherConfig}</if> |
|||
<if test="lane != null and lane != ''"> and lane = #{lane}</if> |
|||
</where> |
|||
</select> |
|||
|
|||
<select id="selectDcWarningById" parameterType="Integer" resultType="hashmap"> |
|||
<include refid="selectDcWarningVo"/> |
|||
where id = #{id} |
|||
</select> |
|||
<select id="export" resultType="com.zc.business.domain.DcWarning"> |
|||
SELECT warning.`id`,warning.`stake_mark`, warning.`direction`, |
|||
mark.longitude,mark.latitude,warning.lane, |
|||
warning.`dept_id`,warning.`warning_state`,warning.`warning_time`, |
|||
warning.`user_id`, warning.`warning_source`,warning.`warning_level`, |
|||
warning.`remark`, warning.`create_time`,warning.`update_time`, |
|||
warning.`warning_type`,warning.`warning_subclass`,warning.`warning_title`, |
|||
warning.`other_config` FROM dc_warning AS warning |
|||
LEFT JOIN dc_stake_mark AS mark ON mark.stake_mark=warning.stake_mark |
|||
</select> |
|||
|
|||
<insert id="insertDcWarning" parameterType="DcWarning" useGeneratedKeys="true" keyProperty="id"> |
|||
insert into dc_warning |
|||
<trim prefix="(" suffix=")" suffixOverrides=","> |
|||
<if test="stakeMark != null and stakeMark != ''">stake_mark,</if> |
|||
<if test="direction != null">direction,</if> |
|||
<if test="deptId != null">dept_id,</if> |
|||
<if test="warningState != null">warning_state,</if> |
|||
<if test="warningTime != null">warning_time,</if> |
|||
<if test="userId != null">user_id,</if> |
|||
<if test="warningSource != null">warning_source,</if> |
|||
<if test="warningLevel != null">warning_level,</if> |
|||
<if test="remark != null">remark,</if> |
|||
<if test="createTime != null">create_time,</if> |
|||
<if test="updateTime != null">update_time,</if> |
|||
<if test="warningType != null">warning_type,</if> |
|||
<if test="warningSubclass != null">warning_subclass,</if> |
|||
<if test="warningTitle != null">warning_title,</if> |
|||
<if test="otherConfig != null">other_config,</if> |
|||
<if test="lane != null">lane,</if> |
|||
</trim> |
|||
<trim prefix="values (" suffix=")" suffixOverrides=","> |
|||
<if test="stakeMark != null and stakeMark != ''">#{stakeMark},</if> |
|||
<if test="direction != null">#{direction},</if> |
|||
<if test="deptId != null">#{deptId},</if> |
|||
<if test="warningState != null">#{warningState},</if> |
|||
<if test="warningTime != null">#{warningTime},</if> |
|||
<if test="userId != null">#{userId},</if> |
|||
<if test="warningSource != null">#{warningSource},</if> |
|||
<if test="warningLevel != null">#{warningLevel},</if> |
|||
<if test="remark != null">#{remark},</if> |
|||
<if test="createTime != null">#{createTime},</if> |
|||
<if test="updateTime != null">#{updateTime},</if> |
|||
<if test="warningType != null">#{warningType},</if> |
|||
<if test="warningSubclass != null">#{warningSubclass},</if> |
|||
<if test="warningTitle != null">#{warningTitle},</if> |
|||
<if test="otherConfig != null">#{otherConfig},</if> |
|||
<if test="lane != null">#{lane},</if> |
|||
</trim> |
|||
</insert> |
|||
|
|||
<update id="updateDcWarning" parameterType="DcWarning"> |
|||
update dc_warning |
|||
<trim prefix="SET" suffixOverrides=","> |
|||
<if test="stakeMark != null and stakeMark != ''">stake_mark = #{stakeMark},</if> |
|||
<if test="direction != null">direction = #{direction},</if> |
|||
<if test="deptId != null">dept_id = #{deptId},</if> |
|||
<if test="warningState != null">warning_state = #{warningState},</if> |
|||
<if test="warningTime != null">warning_time = #{warningTime},</if> |
|||
<if test="userId != null">user_id = #{userId},</if> |
|||
<if test="warningSource != null">warning_source = #{warningSource},</if> |
|||
<if test="warningLevel != null">warning_level = #{warningLevel},</if> |
|||
<if test="remark != null">remark = #{remark},</if> |
|||
<if test="createTime != null">create_time = #{createTime},</if> |
|||
<if test="updateTime != null">update_time = #{updateTime},</if> |
|||
<if test="warningType != null">warning_type = #{warningType},</if> |
|||
<if test="warningSubclass != null">warning_subclass = #{warningSubclass},</if> |
|||
<if test="warningTitle != null">warning_title = #{warningTitle},</if> |
|||
<if test="otherConfig != null">other_config = #{otherConfig},</if> |
|||
<if test="lane != null">lane = #{lane},</if> |
|||
</trim> |
|||
where id = #{id} |
|||
</update> |
|||
|
|||
<delete id="deleteDcWarningById" parameterType="Integer"> |
|||
delete from dc_warning where id = #{id} |
|||
</delete> |
|||
|
|||
<delete id="deleteDcWarningByIds" parameterType="String"> |
|||
delete from dc_warning where id in |
|||
<foreach item="id" collection="array" open="(" separator="," close=")"> |
|||
#{id} |
|||
</foreach> |
|||
</delete> |
|||
</mapper> |
Loading…
Reference in new issue