王兴琳
6 months ago
9 changed files with 580 additions and 22 deletions
@ -0,0 +1,130 @@ |
|||||
|
package com.zc.business.controller; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import javax.servlet.http.HttpServletResponse; |
||||
|
|
||||
|
import com.zc.business.domain.DcTrafficPolice; |
||||
|
import com.zc.business.service.IDcTrafficPoliceService; |
||||
|
import io.swagger.annotations.Api; |
||||
|
import io.swagger.annotations.ApiOperation; |
||||
|
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.ruoyi.common.utils.poi.ExcelUtil; |
||||
|
import com.ruoyi.common.core.page.TableDataInfo; |
||||
|
|
||||
|
/** |
||||
|
* 交管数据Controller |
||||
|
* |
||||
|
* @author ruoyi |
||||
|
* @date 2024-06-06 |
||||
|
*/ |
||||
|
@Api(tags = "交警信息管理") |
||||
|
|
||||
|
@RestController |
||||
|
@RequestMapping("/system/police") |
||||
|
public class DcTrafficPoliceController extends BaseController |
||||
|
{ |
||||
|
@Autowired |
||||
|
private IDcTrafficPoliceService dcTrafficPoliceService; |
||||
|
|
||||
|
/** |
||||
|
* 查询交管数据列表 |
||||
|
*/ |
||||
|
@ApiOperation("查询交警列表") |
||||
|
|
||||
|
// @PreAuthorize("@ss.hasPermi('system:police:list')")
|
||||
|
@GetMapping("/list") |
||||
|
public TableDataInfo list(DcTrafficPolice dcTrafficPolice) |
||||
|
{ |
||||
|
startPage(); |
||||
|
List<DcTrafficPolice> list = dcTrafficPoliceService.selectDcTrafficPoliceList(dcTrafficPolice); |
||||
|
return getDataTable(list); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 导出交管数据列表 |
||||
|
*/ |
||||
|
@ApiOperation("导出交管数据列表") |
||||
|
|
||||
|
// @PreAuthorize("@ss.hasPermi('system:police:export')")
|
||||
|
@Log(title = "交管数据", businessType = BusinessType.EXPORT) |
||||
|
@PostMapping("/export") |
||||
|
public void export(HttpServletResponse response, DcTrafficPolice dcTrafficPolice) |
||||
|
{ |
||||
|
List<DcTrafficPolice> list = dcTrafficPoliceService.selectDcTrafficPoliceList(dcTrafficPolice); |
||||
|
ExcelUtil<DcTrafficPolice> util = new ExcelUtil<>(DcTrafficPolice.class); |
||||
|
util.exportExcel(response, list, "交管数据数据"); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取交管数据详细信息 |
||||
|
*/ |
||||
|
@ApiOperation("获取交管数据详细信息") |
||||
|
|
||||
|
//@PreAuthorize("@ss.hasPermi('system:police:query')")
|
||||
|
@GetMapping(value = "/{id}") |
||||
|
public AjaxResult getInfo(@PathVariable("id") Long id) |
||||
|
{ |
||||
|
return AjaxResult.success(dcTrafficPoliceService.selectDcTrafficPoliceById(id)); |
||||
|
} /** |
||||
|
* 获取事件所属交管信息 |
||||
|
*/ |
||||
|
@ApiOperation("获取事件所属交管信息") |
||||
|
|
||||
|
@GetMapping("/enent/{make}") |
||||
|
public AjaxResult getInfoEvent(@PathVariable("make") String make) |
||||
|
{ |
||||
|
return AjaxResult.success(dcTrafficPoliceService.selectEvent(make)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增交管数据 |
||||
|
*/ |
||||
|
@ApiOperation("新增交管数据") |
||||
|
|
||||
|
// @PreAuthorize("@ss.hasPermi('system:police:add')")
|
||||
|
@Log(title = "交管数据", businessType = BusinessType.INSERT) |
||||
|
@PostMapping |
||||
|
public AjaxResult add(@RequestBody DcTrafficPolice dcTrafficPolice) |
||||
|
{ |
||||
|
return toAjax(dcTrafficPoliceService.insertDcTrafficPolice(dcTrafficPolice)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改交管数据 |
||||
|
*/ |
||||
|
@ApiOperation("修改交管数据") |
||||
|
|
||||
|
@PreAuthorize("@ss.hasPermi('system:police:edit')") |
||||
|
@Log(title = "交管数据", businessType = BusinessType.UPDATE) |
||||
|
@PutMapping |
||||
|
public AjaxResult edit(@RequestBody DcTrafficPolice dcTrafficPolice) |
||||
|
{ |
||||
|
return toAjax(dcTrafficPoliceService.updateDcTrafficPolice(dcTrafficPolice)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除交管数据 |
||||
|
*/ |
||||
|
@ApiOperation("删除交管数据") |
||||
|
|
||||
|
// @PreAuthorize("@ss.hasPermi('system:police:remove')")
|
||||
|
@Log(title = "交管数据", businessType = BusinessType.DELETE) |
||||
|
@DeleteMapping("/{ids}") |
||||
|
public AjaxResult remove(@PathVariable Long[] ids) |
||||
|
{ |
||||
|
return toAjax(dcTrafficPoliceService.deleteDcTrafficPoliceByIds(ids)); |
||||
|
} |
||||
|
} |
@ -0,0 +1,101 @@ |
|||||
|
package com.zc.business.domain; |
||||
|
|
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
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; |
||||
|
|
||||
|
/** |
||||
|
* 交管数据对象 dc_traffic_police |
||||
|
* |
||||
|
* @author ruoyi |
||||
|
* @date 2024-06-06 |
||||
|
*/ |
||||
|
@ApiModel("交警信息对象") |
||||
|
public class DcTrafficPolice extends BaseEntity |
||||
|
{ |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** $column.columnComment */ |
||||
|
@ApiModelProperty("ID") |
||||
|
private Long id; |
||||
|
|
||||
|
/** $column.columnComment */ |
||||
|
@ApiModelProperty("名称") |
||||
|
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") |
||||
|
private String name; |
||||
|
@ApiModelProperty("电话") |
||||
|
/** 电话 */ |
||||
|
@Excel(name = "电话") |
||||
|
private String phone; |
||||
|
@ApiModelProperty("开始桩号") |
||||
|
/** $column.columnComment */ |
||||
|
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") |
||||
|
private String stakeMake; |
||||
|
|
||||
|
/** $column.columnComment */ |
||||
|
@ApiModelProperty("结束桩号") |
||||
|
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") |
||||
|
private String endMake; |
||||
|
|
||||
|
public void setId(Long id) |
||||
|
{ |
||||
|
this.id = id; |
||||
|
} |
||||
|
|
||||
|
public Long getId() |
||||
|
{ |
||||
|
return id; |
||||
|
} |
||||
|
public void setName(String name) |
||||
|
{ |
||||
|
this.name = name; |
||||
|
} |
||||
|
|
||||
|
public String getName() |
||||
|
{ |
||||
|
return name; |
||||
|
} |
||||
|
public void setPhone(String phone) |
||||
|
{ |
||||
|
this.phone = phone; |
||||
|
} |
||||
|
|
||||
|
public String getPhone() |
||||
|
{ |
||||
|
return phone; |
||||
|
} |
||||
|
public void setStakeMake(String stakeMake) |
||||
|
{ |
||||
|
this.stakeMake = stakeMake; |
||||
|
} |
||||
|
|
||||
|
public String getStakeMake() |
||||
|
{ |
||||
|
return stakeMake; |
||||
|
} |
||||
|
public void setEndMake(String endMake) |
||||
|
{ |
||||
|
this.endMake = endMake; |
||||
|
} |
||||
|
|
||||
|
public String getEndMake() |
||||
|
{ |
||||
|
return endMake; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String toString() { |
||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
||||
|
.append("id", getId()) |
||||
|
.append("name", getName()) |
||||
|
.append("phone", getPhone()) |
||||
|
.append("stakeMake", getStakeMake()) |
||||
|
.append("endMake", getEndMake()) |
||||
|
.append("createTime", getCreateTime()) |
||||
|
.append("updateTime", getUpdateTime()) |
||||
|
.toString(); |
||||
|
} |
||||
|
} |
@ -0,0 +1,64 @@ |
|||||
|
package com.zc.business.mapper; |
||||
|
|
||||
|
import com.zc.business.domain.DcTrafficPolice; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 交管数据Mapper接口 |
||||
|
* |
||||
|
* @author ruoyi |
||||
|
* @date 2024-06-06 |
||||
|
*/ |
||||
|
public interface DcTrafficPoliceMapper |
||||
|
{ |
||||
|
/** |
||||
|
* 查询交管数据 |
||||
|
* |
||||
|
* @param id 交管数据主键 |
||||
|
* @return 交管数据 |
||||
|
*/ |
||||
|
public DcTrafficPolice selectDcTrafficPoliceById(Long id); |
||||
|
|
||||
|
/** |
||||
|
* 查询交管数据列表 |
||||
|
* |
||||
|
* @param dcTrafficPolice 交管数据 |
||||
|
* @return 交管数据集合 |
||||
|
*/ |
||||
|
List<DcTrafficPolice> selectDcTrafficPoliceList(DcTrafficPolice dcTrafficPolice); |
||||
|
|
||||
|
/** |
||||
|
* 新增交管数据 |
||||
|
* |
||||
|
* @param dcTrafficPolice 交管数据 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
int insertDcTrafficPolice(DcTrafficPolice dcTrafficPolice); |
||||
|
|
||||
|
/** |
||||
|
* 修改交管数据 |
||||
|
* |
||||
|
* @param dcTrafficPolice 交管数据 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
int updateDcTrafficPolice(DcTrafficPolice dcTrafficPolice); |
||||
|
|
||||
|
/** |
||||
|
* 删除交管数据 |
||||
|
* |
||||
|
* @param id 交管数据主键 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
int deleteDcTrafficPoliceById(Long id); |
||||
|
|
||||
|
/** |
||||
|
* 批量删除交管数据 |
||||
|
* |
||||
|
* @param ids 需要删除的数据主键集合 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
int deleteDcTrafficPoliceByIds(Long[] ids); |
||||
|
|
||||
|
public DcTrafficPolice selectEvent(String make); |
||||
|
} |
@ -0,0 +1,64 @@ |
|||||
|
package com.zc.business.service; |
||||
|
|
||||
|
import com.zc.business.domain.DcTrafficPolice; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 交管数据Service接口 |
||||
|
* |
||||
|
* @author ruoyi |
||||
|
* @date 2024-06-06 |
||||
|
*/ |
||||
|
public interface IDcTrafficPoliceService |
||||
|
{ |
||||
|
/** |
||||
|
* 查询交管数据 |
||||
|
* |
||||
|
* @param id 交管数据主键 |
||||
|
* @return 交管数据 |
||||
|
*/ |
||||
|
public DcTrafficPolice selectDcTrafficPoliceById(Long id); |
||||
|
|
||||
|
/** |
||||
|
* 查询交管数据列表 |
||||
|
* |
||||
|
* @param dcTrafficPolice 交管数据 |
||||
|
* @return 交管数据集合 |
||||
|
*/ |
||||
|
List<DcTrafficPolice> selectDcTrafficPoliceList(DcTrafficPolice dcTrafficPolice); |
||||
|
|
||||
|
/** |
||||
|
* 新增交管数据 |
||||
|
* |
||||
|
* @param dcTrafficPolice 交管数据 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
int insertDcTrafficPolice(DcTrafficPolice dcTrafficPolice); |
||||
|
|
||||
|
/** |
||||
|
* 修改交管数据 |
||||
|
* |
||||
|
* @param dcTrafficPolice 交管数据 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
int updateDcTrafficPolice(DcTrafficPolice dcTrafficPolice); |
||||
|
|
||||
|
/** |
||||
|
* 批量删除交管数据 |
||||
|
* |
||||
|
* @param ids 需要删除的交管数据主键集合 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
int deleteDcTrafficPoliceByIds(Long[] ids); |
||||
|
|
||||
|
/** |
||||
|
* 删除交管数据信息 |
||||
|
* |
||||
|
* @param id 交管数据主键 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
int deleteDcTrafficPoliceById(Long id); |
||||
|
|
||||
|
public DcTrafficPolice selectEvent(String make); |
||||
|
} |
@ -0,0 +1,104 @@ |
|||||
|
package com.zc.business.service.impl; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import com.ruoyi.common.utils.DateUtils; |
||||
|
import com.zc.business.domain.DcTrafficPolice; |
||||
|
import com.zc.business.mapper.DcTrafficPoliceMapper; |
||||
|
import com.zc.business.service.IDcTrafficPoliceService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 交管数据Service业务层处理 |
||||
|
* |
||||
|
* @author ruoyi |
||||
|
* @date 2024-06-06 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class DcTrafficPoliceServiceImpl implements IDcTrafficPoliceService |
||||
|
{ |
||||
|
@Autowired |
||||
|
private DcTrafficPoliceMapper dcTrafficPoliceMapper; |
||||
|
|
||||
|
/** |
||||
|
* 查询交管数据 |
||||
|
* |
||||
|
* @param id 交管数据主键 |
||||
|
* @return 交管数据 |
||||
|
*/ |
||||
|
@Override |
||||
|
public DcTrafficPolice selectDcTrafficPoliceById(Long id) |
||||
|
{ |
||||
|
return dcTrafficPoliceMapper.selectDcTrafficPoliceById(id); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 查询交管数据列表 |
||||
|
* |
||||
|
* @param dcTrafficPolice 交管数据 |
||||
|
* @return 交管数据 |
||||
|
*/ |
||||
|
@Override |
||||
|
public List<DcTrafficPolice> selectDcTrafficPoliceList(DcTrafficPolice dcTrafficPolice) |
||||
|
{ |
||||
|
return dcTrafficPoliceMapper.selectDcTrafficPoliceList(dcTrafficPolice); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增交管数据 |
||||
|
* |
||||
|
* @param dcTrafficPolice 交管数据 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Override |
||||
|
public int insertDcTrafficPolice(DcTrafficPolice dcTrafficPolice) |
||||
|
{ |
||||
|
dcTrafficPolice.setCreateTime(DateUtils.getNowDate()); |
||||
|
return dcTrafficPoliceMapper.insertDcTrafficPolice(dcTrafficPolice); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改交管数据 |
||||
|
* |
||||
|
* @param dcTrafficPolice 交管数据 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Override |
||||
|
public int updateDcTrafficPolice(DcTrafficPolice dcTrafficPolice) |
||||
|
{ |
||||
|
dcTrafficPolice.setUpdateTime(DateUtils.getNowDate()); |
||||
|
return dcTrafficPoliceMapper.updateDcTrafficPolice(dcTrafficPolice); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 批量删除交管数据 |
||||
|
* |
||||
|
* @param ids 需要删除的交管数据主键 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Override |
||||
|
public int deleteDcTrafficPoliceByIds(Long[] ids) |
||||
|
{ |
||||
|
return dcTrafficPoliceMapper.deleteDcTrafficPoliceByIds(ids); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除交管数据信息 |
||||
|
* |
||||
|
* @param id 交管数据主键 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Override |
||||
|
public int deleteDcTrafficPoliceById(Long id) |
||||
|
{ |
||||
|
return dcTrafficPoliceMapper.deleteDcTrafficPoliceById(id); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public DcTrafficPolice selectEvent(String make) { |
||||
|
|
||||
|
return dcTrafficPoliceMapper.selectEvent(make); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,84 @@ |
|||||
|
<?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.DcTrafficPoliceMapper"> |
||||
|
|
||||
|
<resultMap type="com.zc.business.domain.DcTrafficPolice" id="DcTrafficPoliceResult"> |
||||
|
<result property="id" column="id" /> |
||||
|
<result property="name" column="name" /> |
||||
|
<result property="phone" column="phone" /> |
||||
|
<result property="stakeMake" column="stake_make" /> |
||||
|
<result property="endMake" column="end_make" /> |
||||
|
<result property="createTime" column="create_time" /> |
||||
|
<result property="updateTime" column="update_time" /> |
||||
|
</resultMap> |
||||
|
|
||||
|
<sql id="selectDcTrafficPoliceVo"> |
||||
|
select id, name, phone, stake_make, end_make, create_time, update_time from dc_traffic_police |
||||
|
</sql> |
||||
|
|
||||
|
<select id="selectDcTrafficPoliceList" parameterType="DcTrafficPolice" resultMap="DcTrafficPoliceResult"> |
||||
|
<include refid="selectDcTrafficPoliceVo"/> |
||||
|
<where> |
||||
|
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if> |
||||
|
<if test="phone != null and phone != ''"> and phone = #{phone}</if> |
||||
|
<if test="stakeMake != null and stakeMake != ''"> and stake_make = #{stakeMake}</if> |
||||
|
<if test="endMake != null and endMake != ''"> and end_make = #{endMake}</if> |
||||
|
</where> |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectDcTrafficPoliceById" parameterType="Long" resultMap="DcTrafficPoliceResult"> |
||||
|
<include refid="selectDcTrafficPoliceVo"/> |
||||
|
where id = #{id} |
||||
|
</select> |
||||
|
|
||||
|
<insert id="insertDcTrafficPolice" parameterType="DcTrafficPolice" useGeneratedKeys="true" keyProperty="id"> |
||||
|
insert into dc_traffic_police |
||||
|
<trim prefix="(" suffix=")" suffixOverrides=","> |
||||
|
<if test="name != null">name,</if> |
||||
|
<if test="phone != null">phone,</if> |
||||
|
<if test="stakeMake != null">stake_make,</if> |
||||
|
<if test="endMake != null">end_make,</if> |
||||
|
<if test="createTime != null">create_time,</if> |
||||
|
<if test="updateTime != null">update_time,</if> |
||||
|
</trim> |
||||
|
<trim prefix="values (" suffix=")" suffixOverrides=","> |
||||
|
<if test="name != null">#{name},</if> |
||||
|
<if test="phone != null">#{phone},</if> |
||||
|
<if test="stakeMake != null">#{stakeMake},</if> |
||||
|
<if test="endMake != null">#{endMake},</if> |
||||
|
<if test="createTime != null">#{createTime},</if> |
||||
|
<if test="updateTime != null">#{updateTime},</if> |
||||
|
</trim> |
||||
|
</insert> |
||||
|
|
||||
|
<update id="updateDcTrafficPolice" parameterType="DcTrafficPolice"> |
||||
|
update dc_traffic_police |
||||
|
<trim prefix="SET" suffixOverrides=","> |
||||
|
<if test="name != null">name = #{name},</if> |
||||
|
<if test="phone != null">phone = #{phone},</if> |
||||
|
<if test="stakeMake != null">stake_make = #{stakeMake},</if> |
||||
|
<if test="endMake != null">end_make = #{endMake},</if> |
||||
|
<if test="createTime != null">create_time = #{createTime},</if> |
||||
|
<if test="updateTime != null">update_time = #{updateTime},</if> |
||||
|
</trim> |
||||
|
where id = #{id} |
||||
|
</update> |
||||
|
|
||||
|
<delete id="deleteDcTrafficPoliceById" parameterType="Long"> |
||||
|
delete from dc_traffic_police where id = #{id} |
||||
|
</delete> |
||||
|
|
||||
|
<delete id="deleteDcTrafficPoliceByIds" parameterType="String"> |
||||
|
delete from dc_traffic_police where id in |
||||
|
<foreach item="id" collection="array" open="(" separator="," close=")"> |
||||
|
#{id} |
||||
|
</foreach> |
||||
|
</delete> |
||||
|
<select id="selectEvent" parameterType="String" resultMap="DcTrafficPoliceResult"> |
||||
|
<include refid="selectDcTrafficPoliceVo"/> |
||||
|
WHERE #{make} BETWEEN dc_traffic_police.stake_make AND dc_traffic_police.end_make; |
||||
|
</select> |
||||
|
|
||||
|
</mapper> |
Loading…
Reference in new issue