工程管理
This commit is contained in:
parent
fc34caabfd
commit
02d0dbba93
|
|
@ -0,0 +1,112 @@
|
|||
package com.bonus.material.project.controller;
|
||||
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.project.domain.Project;
|
||||
import com.bonus.material.project.domain.ProjectType;
|
||||
import com.bonus.material.project.service.ProjectService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 30791
|
||||
* @version 1.0
|
||||
* Create by 2025/11/13 11:23
|
||||
*/
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/project")
|
||||
@Api(value = "工程管理", tags = "工程管理")
|
||||
public class ProjectController extends BaseController {
|
||||
|
||||
@Resource
|
||||
private ProjectService projectService;
|
||||
|
||||
/**
|
||||
* 查询工程列表
|
||||
*/
|
||||
@ApiOperation(value = "查询工程列表")
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(Project project)
|
||||
{
|
||||
startPage();
|
||||
List<Project> list = projectService.selectProjectList(project);
|
||||
return AjaxResult.success(getDataTable(list));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询工程详细
|
||||
*/
|
||||
@ApiOperation(value = "查询工程详细")
|
||||
@GetMapping(value = "/{projectId}")
|
||||
public AjaxResult getInfo(@PathVariable("projectId") Long projectId)
|
||||
{
|
||||
Project project=projectService.selectProjectById(projectId);
|
||||
return AjaxResult.success(project);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增工程
|
||||
*/
|
||||
@ApiOperation(value = "新增工程")
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Project project)
|
||||
{
|
||||
projectService.insertProject(project);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改工程
|
||||
*/
|
||||
@ApiOperation(value = "修改工程")
|
||||
@PostMapping("/edit")
|
||||
public AjaxResult edit(@RequestBody Project project)
|
||||
{
|
||||
projectService.updateProject(project);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除工程
|
||||
*/
|
||||
@ApiOperation(value = "删除工程")
|
||||
@PostMapping("/delete/{projectId}")
|
||||
public AjaxResult remove(@PathVariable("projectId") Long projectId)
|
||||
{
|
||||
projectService.deleteProjectById(projectId);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "批量删除工程")
|
||||
@PostMapping("/batch/delete")
|
||||
public AjaxResult delProjectBatch(@RequestBody List<Long> ids) {
|
||||
projectService.delProjectBatch(ids);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取工程类型列表
|
||||
*/
|
||||
@ApiOperation(value = "获取工程类型列表")
|
||||
@GetMapping("/list/project_type")
|
||||
public AjaxResult getProjectTypeList()
|
||||
{
|
||||
|
||||
// 从字典表中查询
|
||||
List<ProjectType> projectTypes = projectService.selectProjectTypeList();
|
||||
return AjaxResult.success(projectTypes);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
package com.bonus.material.project.controller;
|
||||
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.project.service.RegionService;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 地区信息
|
||||
*
|
||||
* @author 30791
|
||||
* @version 1.0
|
||||
* Create by 2025/11/13 22:05
|
||||
*/
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/region")
|
||||
public class RegionController {
|
||||
|
||||
@Resource
|
||||
private RegionService regionService;
|
||||
|
||||
|
||||
// 获取所有省份(无变化)
|
||||
@GetMapping("/provinces")
|
||||
public AjaxResult getProvinces() {
|
||||
List<Map<String, Object>> provinces = regionService.getProvinces();
|
||||
return AjaxResult.success(provinces);
|
||||
}
|
||||
|
||||
// 根据「省的area_code」获取城市(参数名改为provinceAreaCode)
|
||||
@GetMapping("/cities")
|
||||
public AjaxResult getCities(@RequestParam String provinceAreaCode) {
|
||||
List<Map<String, Object>> cities = regionService.getCitiesByProvinceAreaCode(provinceAreaCode);
|
||||
return AjaxResult.success(cities);
|
||||
}
|
||||
|
||||
// 根据「市的area_code」获取区县(参数名改为cityAreaCode)
|
||||
@GetMapping("/counties")
|
||||
public AjaxResult getCounties(@RequestParam String cityAreaCode) {
|
||||
List<Map<String, Object>> counties = regionService.getDistrictsByCityAreaCode(cityAreaCode);
|
||||
return AjaxResult.success(counties);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
package com.bonus.material.project.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.models.auth.In;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author 30791
|
||||
* @version 1.0
|
||||
* Create by 2025/11/13 13:32
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class Project {
|
||||
//工程id 主键
|
||||
private Integer id;
|
||||
|
||||
//工程编号
|
||||
private String pro_code;
|
||||
|
||||
//工程名称
|
||||
private String pro_name;
|
||||
|
||||
//电压等级
|
||||
private String voltage;
|
||||
|
||||
//规模
|
||||
private String scale;
|
||||
|
||||
//工程类型
|
||||
private String project_type;
|
||||
|
||||
//工程类型名称
|
||||
private String dict_label;
|
||||
|
||||
//建管单位名称
|
||||
private String org_name;
|
||||
|
||||
//机械化率
|
||||
private String mechanize_rate;
|
||||
|
||||
//开工时间
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date start_time;
|
||||
|
||||
//投产时间
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date put_time;
|
||||
|
||||
//省
|
||||
private String province;
|
||||
|
||||
//市
|
||||
private String city;
|
||||
|
||||
//县
|
||||
private String county;
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.bonus.material.project.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author 30791
|
||||
* @version 1.0
|
||||
* Create by 2025/11/13 13:45
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class ProjectType {
|
||||
|
||||
//字典类型
|
||||
private String dict_type;
|
||||
|
||||
//字典键值
|
||||
private String dict_value;
|
||||
|
||||
//字典标签
|
||||
private String dict_label;
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package com.bonus.material.project.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author 30791
|
||||
* @version 1.0
|
||||
* Create by 2025/11/13 22:03
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class Region {
|
||||
private Long id;
|
||||
private Integer level; // 级别:0-省,1-市,2-区县
|
||||
private String parentCode; // 父级编码
|
||||
private String areaCode;
|
||||
private String zipCode;
|
||||
private String cityCode;
|
||||
private String name; // 地区名称(如“北京市”“朝阳区”)
|
||||
private String short_name;
|
||||
private String mergerName;
|
||||
private String pinyin;
|
||||
private Double lng; // 经度
|
||||
private Double lat; // 纬度
|
||||
private String createdAt;
|
||||
private String updatedAt;
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
package com.bonus.material.project.mapper;
|
||||
|
||||
import com.bonus.material.project.domain.Project;
|
||||
import com.bonus.material.project.domain.ProjectType;
|
||||
import feign.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ProjectMapper {
|
||||
|
||||
/**
|
||||
* 查询工程列表
|
||||
*
|
||||
* @param project 工程信息
|
||||
* @return 工程集合
|
||||
*/
|
||||
public List<Project> selectProjectList(Project project);
|
||||
|
||||
/**
|
||||
* 通过ID查询工程
|
||||
*
|
||||
* @param projectId 工程ID
|
||||
* @return 工程对象
|
||||
*/
|
||||
public Project selectProjectById(@Param("projectId") Long projectId);
|
||||
|
||||
/**
|
||||
* 新增工程
|
||||
*
|
||||
* @param project 工程信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertProject(Project project);
|
||||
|
||||
/**
|
||||
* 修改工程
|
||||
*
|
||||
* @param project 工程信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateProject(Project project);
|
||||
|
||||
/**
|
||||
* 删除工程
|
||||
*
|
||||
* @param projectId 工程ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteProjectById(@Param("projectId") Long projectId);
|
||||
|
||||
/**
|
||||
* 查询工程类型列表
|
||||
*
|
||||
* @return 工程类型集合
|
||||
*/
|
||||
public List<ProjectType> selectProjectTypeList();
|
||||
|
||||
public int delProjectBatch(List<Long> ids);
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.bonus.material.project.mapper;
|
||||
|
||||
import feign.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface RegionMapper {
|
||||
// 查询所有省份
|
||||
List<Map<String, Object>> selectAllProvinces();
|
||||
|
||||
// 根据「省的area_code」查询城市(参数名改为provinceAreaCode)
|
||||
List<Map<String, Object>> selectCitiesByProvinceId(@Param("provinceAreaCode") String provinceAreaCode);
|
||||
|
||||
// 根据「市的area_code」查询区县(参数名改为cityAreaCode)
|
||||
List<Map<String, Object>> selectDistrictsByCityId(@Param("cityAreaCode") String cityAreaCode);
|
||||
|
||||
String getNameByCode(String area_code);
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.bonus.material.project.service;
|
||||
|
||||
import com.bonus.material.project.domain.Project;
|
||||
import com.bonus.material.project.domain.ProjectType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ProjectService {
|
||||
|
||||
List<Project> selectProjectList(Project project);
|
||||
|
||||
Project selectProjectById(Long projectId);
|
||||
|
||||
void insertProject(Project project);
|
||||
|
||||
void updateProject(Project project);
|
||||
|
||||
void deleteProjectById(Long projectId);
|
||||
|
||||
List<ProjectType> selectProjectTypeList();
|
||||
|
||||
boolean delProjectBatch(List<Long> ids);
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package com.bonus.material.project.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface RegionService {
|
||||
List<Map<String, Object>> getProvinces();
|
||||
// 参数改为String类型(area_code通常是字符串,避免数字过长丢失精度)
|
||||
List<Map<String, Object>> getCitiesByProvinceAreaCode(String provinceAreaCode);
|
||||
List<Map<String, Object>> getDistrictsByCityAreaCode(String cityAreaCode);
|
||||
}
|
||||
|
|
@ -0,0 +1,115 @@
|
|||
package com.bonus.material.project.service.impl;
|
||||
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.material.project.domain.Project;
|
||||
import com.bonus.material.project.domain.ProjectType;
|
||||
import com.bonus.material.project.mapper.ProjectMapper;
|
||||
import com.bonus.material.project.mapper.RegionMapper;
|
||||
import com.bonus.material.project.service.ProjectService;
|
||||
import org.checkerframework.checker.units.qual.A;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 30791
|
||||
* @version 1.0
|
||||
* Create by 2025/11/13 11:25
|
||||
*/
|
||||
|
||||
@Service
|
||||
public class ProjectServiceImpl implements ProjectService {
|
||||
|
||||
@Resource
|
||||
private ProjectMapper projectMapper;
|
||||
|
||||
@Resource
|
||||
private RegionMapper regionMapper;
|
||||
|
||||
/**
|
||||
* 查询工程列表
|
||||
*
|
||||
* @param project 工程信息
|
||||
* @return 工程集合
|
||||
*/
|
||||
@Override
|
||||
public List<Project> selectProjectList(Project project)
|
||||
{
|
||||
return projectMapper.selectProjectList(project);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过ID查询工程
|
||||
*
|
||||
* @param projectId 工程ID
|
||||
* @return 工程对象
|
||||
*/
|
||||
@Override
|
||||
public Project selectProjectById(Long projectId)
|
||||
{
|
||||
return projectMapper.selectProjectById(projectId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增工程
|
||||
*
|
||||
* @param project 工程信息
|
||||
*/
|
||||
@Override
|
||||
public void insertProject(Project project)
|
||||
{
|
||||
project.setProvince(regionMapper.getNameByCode(project.getProvince()));
|
||||
project.setCity(regionMapper.getNameByCode(project.getCity()));
|
||||
project.setCounty(regionMapper.getNameByCode(project.getCounty()));
|
||||
projectMapper.insertProject(project);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改工程
|
||||
*
|
||||
* @param project 工程信息
|
||||
*/
|
||||
@Override
|
||||
public void updateProject(Project project)
|
||||
{
|
||||
project.setProvince(regionMapper.getNameByCode(project.getProvince()));
|
||||
project.setCity(regionMapper.getNameByCode(project.getCity()));
|
||||
project.setCounty(regionMapper.getNameByCode(project.getCounty()));
|
||||
projectMapper.updateProject(project);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除工程信息
|
||||
*
|
||||
* @param projectId 工程ID
|
||||
*/
|
||||
@Override
|
||||
public void deleteProjectById(Long projectId)
|
||||
{
|
||||
projectMapper.deleteProjectById(projectId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean delProjectBatch(List<Long> ids) {
|
||||
return projectMapper.delProjectBatch(ids) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取工程类型列表
|
||||
*
|
||||
* @return 工程类型集合
|
||||
*/
|
||||
@Override
|
||||
public List<ProjectType> selectProjectTypeList() {
|
||||
// 这里假设你的工程类型是存在一个单独的表中
|
||||
return projectMapper.selectProjectTypeList();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
package com.bonus.material.project.service.impl;
|
||||
|
||||
|
||||
import com.bonus.material.project.mapper.RegionMapper;
|
||||
import com.bonus.material.project.service.RegionService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* @author 30791
|
||||
* @version 1.0
|
||||
* Create by 2025/11/13 11:25
|
||||
*/
|
||||
|
||||
@Service
|
||||
public class RegionServiceImpl implements RegionService {
|
||||
@Resource
|
||||
private RegionMapper regionMapper;
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getProvinces() {
|
||||
return regionMapper.selectAllProvinces();
|
||||
}
|
||||
|
||||
// 调用Mapper的「根据省area_code查询城市」方法
|
||||
@Override
|
||||
public List<Map<String, Object>> getCitiesByProvinceAreaCode(String provinceAreaCode) {
|
||||
return regionMapper.selectCitiesByProvinceId(provinceAreaCode);
|
||||
}
|
||||
|
||||
// 调用Mapper的「根据市area_code查询区县」方法
|
||||
@Override
|
||||
public List<Map<String, Object>> getDistrictsByCityAreaCode(String cityAreaCode) {
|
||||
return regionMapper.selectDistrictsByCityId(cityAreaCode);
|
||||
}
|
||||
|
||||
//获取地区名称
|
||||
public String getNameByCode(String area_code) {
|
||||
return regionMapper.getNameByCode(area_code);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,165 @@
|
|||
<?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.bonus.material.project.mapper.ProjectMapper">
|
||||
|
||||
<!-- 工程实体映射 -->
|
||||
<resultMap id="ProjectResult" type="com.bonus.material.project.domain.Project">
|
||||
<id property="id" column="id"/>
|
||||
<result property="pro_code" column="pro_code"/>
|
||||
<result property="pro_name" column="pro_name"/>
|
||||
<result property="voltage" column="voltage"/>
|
||||
<result property="scale" column="scale"/>
|
||||
<result property="project_type" column="project_type"/>
|
||||
<result property="dict_label" column="dict_label"/>
|
||||
<result property="org_name" column="org_name"/>
|
||||
<result property="start_time" column="start_time"/>
|
||||
<result property="put_time" column="put_time"/>
|
||||
<result property="province" column="province"/>
|
||||
<result property="mechanize_rate" column="mechanize_rate"/>
|
||||
<result property="city" column="city"/>
|
||||
<result property="county" column="county"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 字典类型实体映射 -->
|
||||
<resultMap id="ProjectTypeResult" type="com.bonus.material.project.domain.ProjectType">
|
||||
<result property="dict_type" column="dict_type"/>
|
||||
<result property="dict_value" column="dict_value"/>
|
||||
<result property="dict_label" column="dict_label"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 查询工程列表 -->
|
||||
<select id="selectProjectList" parameterType="com.bonus.material.project.domain.Project" resultMap="ProjectResult">
|
||||
select
|
||||
jsp.id, pro_code, pro_name, voltage, scale,project_type,org_name, province, city, county,mechanize_rate,start_time, put_time , sdd.dict_label
|
||||
from
|
||||
jj_sing_project jsp
|
||||
left join sys_dict_data sdd on sdd.dict_value = jsp.project_type and sdd.dict_type='bm_project_type'
|
||||
<where>
|
||||
<if test="pro_name != null and pro_name != ''">
|
||||
AND pro_name like concat('%', #{pro_name}, '%')
|
||||
</if>
|
||||
<if test="voltage != null and voltage != ''">
|
||||
AND voltage = #{voltage}
|
||||
</if>
|
||||
<if test="project_type != null and project_type != ''">
|
||||
AND project_type = #{project_type}
|
||||
</if>
|
||||
<if test="org_name != null and org_name != ''">
|
||||
AND org_name like concat('%', #{org_name}, '%')
|
||||
</if>
|
||||
</where>
|
||||
order by id desc
|
||||
</select>
|
||||
|
||||
<!-- 通过ID查询工程 -->
|
||||
<select id="selectProjectById" resultMap="ProjectResult">
|
||||
select
|
||||
id, pro_code, pro_name, voltage,scale, project_type,org_name, province, city, county,mechanize_rate,start_time, put_time ,sdd.dict_label
|
||||
from
|
||||
jj_sing_project jsp
|
||||
left join sys_dict_data sdd on sdd.dict_value = jsp.project_type and sdd.dict_type='bm_project_type'
|
||||
where
|
||||
id = #{id}
|
||||
</select>
|
||||
|
||||
<!-- 新增工程 -->
|
||||
<insert id="insertProject" parameterType="com.bonus.material.project.domain.Project" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into
|
||||
jj_sing_project
|
||||
(pro_code,
|
||||
pro_name,
|
||||
voltage,
|
||||
scale,
|
||||
project_type,
|
||||
org_name,
|
||||
start_time,
|
||||
put_time,
|
||||
province,
|
||||
city,
|
||||
county,
|
||||
mechanize_rate)
|
||||
values (#{pro_code},
|
||||
#{pro_name},
|
||||
#{voltage},
|
||||
#{scale},
|
||||
#{project_type},
|
||||
#{org_name},
|
||||
#{start_time},
|
||||
#{put_time},
|
||||
#{province},
|
||||
#{city},
|
||||
#{county},
|
||||
#{mechanize_rate})
|
||||
</insert>
|
||||
|
||||
<!-- 修改工程 -->
|
||||
<update id="updateProject" parameterType="com.bonus.material.project.domain.Project">
|
||||
update jj_sing_project
|
||||
<set>
|
||||
<if test="pro_code != null and pro_code != ''">
|
||||
pro_code = #{pro_code},
|
||||
</if>
|
||||
<if test="pro_name != null and pro_name != ''">
|
||||
pro_name = #{pro_name},
|
||||
</if>
|
||||
<if test="voltage != null and voltage != ''">
|
||||
voltage = #{voltage},
|
||||
</if>
|
||||
<if test="scale != null and scale != ''">
|
||||
scale = #{scale},
|
||||
</if>
|
||||
<if test="project_type != null and project_type != ''">
|
||||
project_type = #{project_type},
|
||||
</if>
|
||||
<if test="org_name != null and org_name != ''">
|
||||
org_name = #{org_name},
|
||||
</if>
|
||||
<if test="province != null and province != ''">
|
||||
province = #{province},
|
||||
</if>
|
||||
<if test="city != null and city != ''">
|
||||
city = #{city},
|
||||
</if>
|
||||
<if test="county != null and county != ''">
|
||||
county = #{county},
|
||||
</if>
|
||||
<if test="mechanize_rate != null and mechanize_rate != ''">
|
||||
mechanize_rate = #{mechanize_rate},
|
||||
</if>
|
||||
<if test="start_time != null ">
|
||||
start_time = #{start_time},
|
||||
</if>
|
||||
<if test="put_time != null ">
|
||||
put_time = #{put_time},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 删除工程 -->
|
||||
<delete id="deleteProjectById" >
|
||||
delete from jj_sing_project where id = #{id}
|
||||
</delete>
|
||||
|
||||
<!--批量删除工程-->
|
||||
<delete id="delProjectBatch">
|
||||
DELETE FROM jj_sing_project WHERE id IN
|
||||
<foreach collection="list" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
|
||||
<!-- 查询工程类型列表) -->
|
||||
<select id="selectProjectTypeList" resultMap="ProjectTypeResult">
|
||||
select
|
||||
dict_type, dict_value, dict_label
|
||||
from
|
||||
sys_dict_data
|
||||
where
|
||||
dict_type = 'bm_project_type'
|
||||
order by
|
||||
dict_value asc
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
<?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.bonus.material.project.mapper.RegionMapper">
|
||||
|
||||
|
||||
<resultMap id="RegionLabelValueMap" type="com.bonus.material.project.domain.Region">
|
||||
<result column="id" property="id"/>
|
||||
<result column="short_name" property="short_name"/>
|
||||
<result column="area_code" property="areaCode"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 1. 查询所有省份 -->
|
||||
<select id="selectAllProvinces" resultMap="RegionLabelValueMap">
|
||||
SELECT
|
||||
id,
|
||||
area_code,
|
||||
name
|
||||
FROM
|
||||
sys_cnarea
|
||||
WHERE
|
||||
level = 1
|
||||
</select>
|
||||
|
||||
<!-- 2. 根据省份ID查询城市 -->
|
||||
<select id="selectCitiesByProvinceId" resultMap="RegionLabelValueMap">
|
||||
SELECT
|
||||
id,
|
||||
area_code,
|
||||
name
|
||||
FROM
|
||||
sys_cnarea
|
||||
WHERE
|
||||
level = 2
|
||||
AND parent_code = #{provinceAreaCode}
|
||||
</select>
|
||||
|
||||
<!-- 3. 根据城市ID查询区县 -->
|
||||
<select id="selectDistrictsByCityId" resultMap="RegionLabelValueMap">
|
||||
SELECT
|
||||
id,
|
||||
area_code,
|
||||
name
|
||||
FROM
|
||||
sys_cnarea
|
||||
WHERE
|
||||
level = 3
|
||||
AND parent_code = #{cityAreaCode}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getNameByCode" resultType="java.lang.String">
|
||||
select name from sys_cnarea where area_code=#{area_code}
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue