mengff
11 months ago
8 changed files with 621 additions and 2 deletions
@ -0,0 +1,109 @@ |
|||
package com.zc.business.controller; |
|||
|
|||
import java.util.List; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
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.zc.business.domain.DcRoadSection; |
|||
import com.zc.business.service.IDcRoadSectionService; |
|||
import com.ruoyi.common.utils.poi.ExcelUtil; |
|||
import com.ruoyi.common.core.page.TableDataInfo; |
|||
|
|||
/** |
|||
* 辖区路段Controller |
|||
* |
|||
* @author ruoyi |
|||
* @date 2024-01-11 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("/business/roadSection") |
|||
public class DcRoadSectionController extends BaseController |
|||
{ |
|||
@Autowired |
|||
private IDcRoadSectionService dcRoadSectionService; |
|||
|
|||
/** |
|||
* 查询辖区路段列表 |
|||
*/ |
|||
@PreAuthorize("@ss.hasPermi('business:roadSection:list')") |
|||
@GetMapping("/list") |
|||
public TableDataInfo list(DcRoadSection dcRoadSection) |
|||
{ |
|||
startPage(); |
|||
List<DcRoadSection> list = dcRoadSectionService.selectDcRoadSectionList(dcRoadSection); |
|||
return getDataTable(list); |
|||
} |
|||
|
|||
/** |
|||
* 导出辖区路段列表 |
|||
*/ |
|||
@PreAuthorize("@ss.hasPermi('business:roadSection:export')") |
|||
@Log(title = "辖区路段", businessType = BusinessType.EXPORT) |
|||
@PostMapping("/export") |
|||
public void export(HttpServletResponse response, DcRoadSection dcRoadSection) |
|||
{ |
|||
List<DcRoadSection> list = dcRoadSectionService.selectDcRoadSectionList(dcRoadSection); |
|||
ExcelUtil<DcRoadSection> util = new ExcelUtil<>(DcRoadSection.class); |
|||
util.exportExcel(response, list, "辖区路段数据"); |
|||
} |
|||
|
|||
/** |
|||
* 获取辖区路段详细信息 |
|||
*/ |
|||
@PreAuthorize("@ss.hasPermi('business:roadSection:query')") |
|||
@GetMapping(value = "/{id}") |
|||
public AjaxResult getInfo(@PathVariable("id") Long id) |
|||
{ |
|||
return AjaxResult.success(dcRoadSectionService.selectDcRoadSectionById(id)); |
|||
} |
|||
|
|||
/** |
|||
* 新增辖区路段 |
|||
*/ |
|||
@PreAuthorize("@ss.hasPermi('business:roadSection:add')") |
|||
@Log(title = "辖区路段", businessType = BusinessType.INSERT) |
|||
@PostMapping |
|||
public AjaxResult add(@RequestBody DcRoadSection dcRoadSection) |
|||
{ |
|||
return toAjax(dcRoadSectionService.insertDcRoadSection(dcRoadSection)); |
|||
} |
|||
|
|||
/** |
|||
* 修改辖区路段 |
|||
*/ |
|||
@PreAuthorize("@ss.hasPermi('business:roadSection:edit')") |
|||
@Log(title = "辖区路段", businessType = BusinessType.UPDATE) |
|||
@PutMapping |
|||
public AjaxResult edit(@RequestBody DcRoadSection dcRoadSection) |
|||
{ |
|||
return toAjax(dcRoadSectionService.updateDcRoadSection(dcRoadSection)); |
|||
} |
|||
|
|||
/** |
|||
* 删除辖区路段 |
|||
*/ |
|||
@PreAuthorize("@ss.hasPermi('business:roadSection:remove')") |
|||
@Log(title = "辖区路段", businessType = BusinessType.DELETE) |
|||
@DeleteMapping("/{ids}") |
|||
public AjaxResult remove(@PathVariable Long[] ids) |
|||
{ |
|||
return toAjax(dcRoadSectionService.deleteDcRoadSectionByIds(ids)); |
|||
} |
|||
//查询路线id与名称
|
|||
@PostMapping("/roadList") |
|||
public AjaxResult roadList(){ |
|||
return AjaxResult.success(dcRoadSectionService.selectRoadList()); |
|||
} |
|||
} |
@ -0,0 +1,159 @@ |
|||
package com.zc.business.domain; |
|||
|
|||
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_road_section |
|||
* |
|||
* @author ruoyi |
|||
* @date 2024-01-11 |
|||
*/ |
|||
public class DcRoadSection extends BaseEntity |
|||
{ |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** $column.columnComment */ |
|||
private Long id; |
|||
|
|||
/** 所属部门 */ |
|||
@Excel(name = "所属部门") |
|||
private Long deptId; |
|||
|
|||
/** 所属路线 */ |
|||
@Excel(name = "所属路线") |
|||
private Long roadId; |
|||
|
|||
/** 开始桩号 */ |
|||
@Excel(name = "开始桩号") |
|||
private String startStakeMark; |
|||
|
|||
/** 结束桩号 */ |
|||
@Excel(name = "结束桩号") |
|||
private String endStakeMark; |
|||
|
|||
/** 辖区路线名称 */ |
|||
@Excel(name = "辖区路线名称") |
|||
private String sectionName; |
|||
|
|||
/** 辖区路线编号 */ |
|||
@Excel(name = "辖区路线编号") |
|||
private String roadCode; |
|||
|
|||
/** 里程 */ |
|||
@Excel(name = "里程") |
|||
private String mileage; |
|||
/** 部门名称 */ |
|||
@Excel(name = "部门名称") |
|||
private String deptName; |
|||
/** 道路名称 */ |
|||
@Excel(name = "道路名称") |
|||
private String roadName; |
|||
|
|||
public String getDeptName() { |
|||
return deptName; |
|||
} |
|||
|
|||
public void setDeptName(String deptName) { |
|||
this.deptName = deptName; |
|||
} |
|||
|
|||
public String getRoadName() { |
|||
return roadName; |
|||
} |
|||
|
|||
public void setRoadName(String roadName) { |
|||
this.roadName = roadName; |
|||
} |
|||
|
|||
public void setId(Long id) |
|||
{ |
|||
this.id = id; |
|||
} |
|||
|
|||
public Long getId() |
|||
{ |
|||
return id; |
|||
} |
|||
|
|||
public Long getDeptId() { |
|||
return deptId; |
|||
} |
|||
|
|||
public void setDeptId(Long deptId) { |
|||
this.deptId = deptId; |
|||
} |
|||
|
|||
public void setRoadId(Long roadId) |
|||
{ |
|||
this.roadId = roadId; |
|||
} |
|||
|
|||
public Long getRoadId() |
|||
{ |
|||
return roadId; |
|||
} |
|||
public void setStartStakeMark(String startStakeMark) |
|||
{ |
|||
this.startStakeMark = startStakeMark; |
|||
} |
|||
|
|||
public String getStartStakeMark() |
|||
{ |
|||
return startStakeMark; |
|||
} |
|||
public void setEndStakeMark(String endStakeMark) |
|||
{ |
|||
this.endStakeMark = endStakeMark; |
|||
} |
|||
|
|||
public String getEndStakeMark() |
|||
{ |
|||
return endStakeMark; |
|||
} |
|||
public void setSectionName(String sectionName) |
|||
{ |
|||
this.sectionName = sectionName; |
|||
} |
|||
|
|||
public String getSectionName() |
|||
{ |
|||
return sectionName; |
|||
} |
|||
public void setRoadCode(String roadCode) |
|||
{ |
|||
this.roadCode = roadCode; |
|||
} |
|||
|
|||
public String getRoadCode() |
|||
{ |
|||
return roadCode; |
|||
} |
|||
public void setMileage(String mileage) |
|||
{ |
|||
this.mileage = mileage; |
|||
} |
|||
|
|||
public String getMileage() |
|||
{ |
|||
return mileage; |
|||
} |
|||
|
|||
@Override |
|||
public String toString() { |
|||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
|||
.append("id", getId()) |
|||
.append("deptId", getDeptId()) |
|||
.append("roadId", getRoadId()) |
|||
.append("startStakeMark", getStartStakeMark()) |
|||
.append("endStakeMark", getEndStakeMark()) |
|||
.append("sectionName", getSectionName()) |
|||
.append("roadCode", getRoadCode()) |
|||
.append("mileage", getMileage()) |
|||
.append("createTime", getCreateTime()) |
|||
.append("updateTime", getUpdateTime()) |
|||
.toString(); |
|||
} |
|||
} |
@ -0,0 +1,64 @@ |
|||
package com.zc.business.mapper; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import com.zc.business.domain.DcRoadSection; |
|||
|
|||
/** |
|||
* 辖区路段Mapper接口 |
|||
* |
|||
* @author ruoyi |
|||
* @date 2024-01-11 |
|||
*/ |
|||
public interface DcRoadSectionMapper |
|||
{ |
|||
/** |
|||
* 查询辖区路段 |
|||
* |
|||
* @param id 辖区路段主键 |
|||
* @return 辖区路段 |
|||
*/ |
|||
public DcRoadSection selectDcRoadSectionById(Long id); |
|||
|
|||
/** |
|||
* 查询辖区路段列表 |
|||
* |
|||
* @param dcRoadSection 辖区路段 |
|||
* @return 辖区路段集合 |
|||
*/ |
|||
List<DcRoadSection> selectDcRoadSectionList(DcRoadSection dcRoadSection); |
|||
|
|||
/** |
|||
* 新增辖区路段 |
|||
* |
|||
* @param dcRoadSection 辖区路段 |
|||
* @return 结果 |
|||
*/ |
|||
int insertDcRoadSection(DcRoadSection dcRoadSection); |
|||
|
|||
/** |
|||
* 修改辖区路段 |
|||
* |
|||
* @param dcRoadSection 辖区路段 |
|||
* @return 结果 |
|||
*/ |
|||
int updateDcRoadSection(DcRoadSection dcRoadSection); |
|||
|
|||
/** |
|||
* 删除辖区路段 |
|||
* |
|||
* @param id 辖区路段主键 |
|||
* @return 结果 |
|||
*/ |
|||
int deleteDcRoadSectionById(Long id); |
|||
|
|||
/** |
|||
* 批量删除辖区路段 |
|||
* |
|||
* @param ids 需要删除的数据主键集合 |
|||
* @return 结果 |
|||
*/ |
|||
int deleteDcRoadSectionByIds(Long[] ids); |
|||
//查询路线id与名称
|
|||
List<HashMap<String,Object>> selectRoadList(); |
|||
} |
@ -0,0 +1,64 @@ |
|||
package com.zc.business.service; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import com.zc.business.domain.DcRoadSection; |
|||
|
|||
/** |
|||
* 辖区路段Service接口 |
|||
* |
|||
* @author ruoyi |
|||
* @date 2024-01-11 |
|||
*/ |
|||
public interface IDcRoadSectionService |
|||
{ |
|||
/** |
|||
* 查询辖区路段 |
|||
* |
|||
* @param id 辖区路段主键 |
|||
* @return 辖区路段 |
|||
*/ |
|||
public DcRoadSection selectDcRoadSectionById(Long id); |
|||
|
|||
/** |
|||
* 查询辖区路段列表 |
|||
* |
|||
* @param dcRoadSection 辖区路段 |
|||
* @return 辖区路段集合 |
|||
*/ |
|||
List<DcRoadSection> selectDcRoadSectionList(DcRoadSection dcRoadSection); |
|||
|
|||
/** |
|||
* 新增辖区路段 |
|||
* |
|||
* @param dcRoadSection 辖区路段 |
|||
* @return 结果 |
|||
*/ |
|||
int insertDcRoadSection(DcRoadSection dcRoadSection); |
|||
|
|||
/** |
|||
* 修改辖区路段 |
|||
* |
|||
* @param dcRoadSection 辖区路段 |
|||
* @return 结果 |
|||
*/ |
|||
int updateDcRoadSection(DcRoadSection dcRoadSection); |
|||
|
|||
/** |
|||
* 批量删除辖区路段 |
|||
* |
|||
* @param ids 需要删除的辖区路段主键集合 |
|||
* @return 结果 |
|||
*/ |
|||
int deleteDcRoadSectionByIds(Long[] ids); |
|||
|
|||
/** |
|||
* 删除辖区路段信息 |
|||
* |
|||
* @param id 辖区路段主键 |
|||
* @return 结果 |
|||
*/ |
|||
int deleteDcRoadSectionById(Long id); |
|||
//查询路线id与名称
|
|||
List<HashMap<String,Object>> selectRoadList(); |
|||
} |
@ -0,0 +1,102 @@ |
|||
package com.zc.business.service.impl; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import com.ruoyi.common.utils.DateUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import com.zc.business.mapper.DcRoadSectionMapper; |
|||
import com.zc.business.domain.DcRoadSection; |
|||
import com.zc.business.service.IDcRoadSectionService; |
|||
|
|||
/** |
|||
* 辖区路段Service业务层处理 |
|||
* |
|||
* @author ruoyi |
|||
* @date 2024-01-11 |
|||
*/ |
|||
@Service |
|||
public class DcRoadSectionServiceImpl implements IDcRoadSectionService |
|||
{ |
|||
@Autowired |
|||
private DcRoadSectionMapper dcRoadSectionMapper; |
|||
|
|||
/** |
|||
* 查询辖区路段 |
|||
* |
|||
* @param id 辖区路段主键 |
|||
* @return 辖区路段 |
|||
*/ |
|||
@Override |
|||
public DcRoadSection selectDcRoadSectionById(Long id) |
|||
{ |
|||
return dcRoadSectionMapper.selectDcRoadSectionById(id); |
|||
} |
|||
|
|||
/** |
|||
* 查询辖区路段列表 |
|||
* |
|||
* @param dcRoadSection 辖区路段 |
|||
* @return 辖区路段 |
|||
*/ |
|||
@Override |
|||
public List<DcRoadSection> selectDcRoadSectionList(DcRoadSection dcRoadSection) |
|||
{ |
|||
return dcRoadSectionMapper.selectDcRoadSectionList(dcRoadSection); |
|||
} |
|||
|
|||
/** |
|||
* 新增辖区路段 |
|||
* |
|||
* @param dcRoadSection 辖区路段 |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int insertDcRoadSection(DcRoadSection dcRoadSection) |
|||
{ |
|||
dcRoadSection.setCreateTime(DateUtils.getNowDate()); |
|||
return dcRoadSectionMapper.insertDcRoadSection(dcRoadSection); |
|||
} |
|||
|
|||
/** |
|||
* 修改辖区路段 |
|||
* |
|||
* @param dcRoadSection 辖区路段 |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int updateDcRoadSection(DcRoadSection dcRoadSection) |
|||
{ |
|||
dcRoadSection.setUpdateTime(DateUtils.getNowDate()); |
|||
return dcRoadSectionMapper.updateDcRoadSection(dcRoadSection); |
|||
} |
|||
|
|||
/** |
|||
* 批量删除辖区路段 |
|||
* |
|||
* @param ids 需要删除的辖区路段主键 |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int deleteDcRoadSectionByIds(Long[] ids) |
|||
{ |
|||
return dcRoadSectionMapper.deleteDcRoadSectionByIds(ids); |
|||
} |
|||
|
|||
/** |
|||
* 删除辖区路段信息 |
|||
* |
|||
* @param id 辖区路段主键 |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int deleteDcRoadSectionById(Long id) |
|||
{ |
|||
return dcRoadSectionMapper.deleteDcRoadSectionById(id); |
|||
} |
|||
//查询路线id与名称
|
|||
@Override |
|||
public List<HashMap<String, Object>> selectRoadList() { |
|||
return dcRoadSectionMapper.selectRoadList(); |
|||
} |
|||
} |
@ -0,0 +1,106 @@ |
|||
<?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.DcRoadSectionMapper"> |
|||
|
|||
<resultMap type="DcRoadSection" id="DcRoadSectionResult"> |
|||
<result property="id" column="id" /> |
|||
<result property="deptId" column="dept_id" /> |
|||
<result property="roadId" column="road_id" /> |
|||
<result property="startStakeMark" column="start_stake_mark" /> |
|||
<result property="endStakeMark" column="end_stake_mark" /> |
|||
<result property="sectionName" column="section_name" /> |
|||
<result property="roadCode" column="road_code" /> |
|||
<result property="mileage" column="mileage" /> |
|||
<result property="createTime" column="create_time" /> |
|||
<result property="updateTime" column="update_time" /> |
|||
<result property="deptName" column="dept_name" /> |
|||
<result property="roadName" column="road_name" /> |
|||
</resultMap> |
|||
|
|||
<sql id="selectDcRoadSectionVo"> |
|||
select section.id, section.dept_id, section.road_id, |
|||
dept.dept_name,road.road_name, |
|||
section.start_stake_mark, section.end_stake_mark, |
|||
section.section_name, section.road_code, section.mileage, |
|||
section.create_time, section.update_time from dc_road_section as section |
|||
left join sys_dept as dept on section.dept_id=dept.dept_id |
|||
left join dc_road as road on section.road_id=road.id |
|||
</sql> |
|||
|
|||
<select id="selectDcRoadSectionList" parameterType="DcRoadSection" resultMap="DcRoadSectionResult"> |
|||
<include refid="selectDcRoadSectionVo"/> |
|||
<where> |
|||
<if test="deptId != null "> and section.dept_id = #{deptId}</if> |
|||
<if test="roadId != null "> and section.road_id = #{roadId}</if> |
|||
<if test="startStakeMark != null and startStakeMark != ''"> and section.start_stake_mark = #{startStakeMark}</if> |
|||
<if test="endStakeMark != null and endStakeMark != ''"> and section.end_stake_mark = #{endStakeMark}</if> |
|||
<if test="sectionName != null and sectionName != ''"> and section.section_name like concat('%', #{sectionName}, '%')</if> |
|||
<if test="roadCode != null and roadCode != ''"> and section.road_code = #{roadCode}</if> |
|||
</where> |
|||
</select> |
|||
|
|||
<select id="selectDcRoadSectionById" parameterType="Long" resultMap="DcRoadSectionResult"> |
|||
<include refid="selectDcRoadSectionVo"/> |
|||
where section.id = #{id} |
|||
</select> |
|||
<select id="selectRoadList" resultType="java.util.HashMap"> |
|||
select id,road_name roadName from dc_road |
|||
</select> |
|||
|
|||
<insert id="insertDcRoadSection" parameterType="DcRoadSection"> |
|||
insert into dc_road_section |
|||
<trim prefix="(" suffix=")" suffixOverrides=","> |
|||
<if test="id != null">id,</if> |
|||
<if test="deptId != null">dept_id,</if> |
|||
<if test="roadId != null">road_id,</if> |
|||
<if test="startStakeMark != null">start_stake_mark,</if> |
|||
<if test="endStakeMark != null">end_stake_mark,</if> |
|||
<if test="sectionName != null and sectionName != ''">section_name,</if> |
|||
<if test="roadCode != null">road_code,</if> |
|||
<if test="mileage != null">mileage,</if> |
|||
<if test="createTime != null">create_time,</if> |
|||
<if test="updateTime != null">update_time,</if> |
|||
</trim> |
|||
<trim prefix="values (" suffix=")" suffixOverrides=","> |
|||
<if test="id != null">#{id},</if> |
|||
<if test="deptId != null">#{deptId},</if> |
|||
<if test="roadId != null">#{roadId},</if> |
|||
<if test="startStakeMark != null">#{startStakeMark},</if> |
|||
<if test="endStakeMark != null">#{endStakeMark},</if> |
|||
<if test="sectionName != null and sectionName != ''">#{sectionName},</if> |
|||
<if test="roadCode != null">#{roadCode},</if> |
|||
<if test="mileage != null">#{mileage},</if> |
|||
<if test="createTime != null">#{createTime},</if> |
|||
<if test="updateTime != null">#{updateTime},</if> |
|||
</trim> |
|||
</insert> |
|||
|
|||
<update id="updateDcRoadSection" parameterType="DcRoadSection"> |
|||
update dc_road_section |
|||
<trim prefix="SET" suffixOverrides=","> |
|||
<if test="deptId != null">dept_id = #{deptId},</if> |
|||
<if test="roadId != null">road_id = #{roadId},</if> |
|||
<if test="startStakeMark != null">start_stake_mark = #{startStakeMark},</if> |
|||
<if test="endStakeMark != null">end_stake_mark = #{endStakeMark},</if> |
|||
<if test="sectionName != null and sectionName != ''">section_name = #{sectionName},</if> |
|||
<if test="roadCode != null">road_code = #{roadCode},</if> |
|||
<if test="mileage != null">mileage = #{mileage},</if> |
|||
<if test="createTime != null">create_time = #{createTime},</if> |
|||
<if test="updateTime != null">update_time = #{updateTime},</if> |
|||
</trim> |
|||
where id = #{id} |
|||
</update> |
|||
|
|||
<delete id="deleteDcRoadSectionById" parameterType="Long"> |
|||
delete from dc_road_section where id = #{id} |
|||
</delete> |
|||
|
|||
<delete id="deleteDcRoadSectionByIds" parameterType="String"> |
|||
delete from dc_road_section where id in |
|||
<foreach item="id" collection="array" open="(" separator="," close=")"> |
|||
#{id} |
|||
</foreach> |
|||
</delete> |
|||
</mapper> |
Loading…
Reference in new issue