Commit 1f991c9a authored by hanbing's avatar hanbing

[update] 恢复行政区划编号

parent 83a93397
...@@ -12,7 +12,7 @@ import java.util.List; ...@@ -12,7 +12,7 @@ import java.util.List;
* @date 2023/6/9 13:52 * @date 2023/6/9 13:52
*/ */
@Data @Data
@ApiModel(value = "AddOrUpdateAreaBO", description = "新增/修改子区") @ApiModel(value = "AddOrUpdateAreaBO", description = "子区新增/修改")
public class AddOrUpdateAreaBO { public class AddOrUpdateAreaBO {
@ApiModelProperty(value = "子区ID") @ApiModelProperty(value = "子区ID")
private Integer areaId; private Integer areaId;
...@@ -24,7 +24,7 @@ public class AddOrUpdateAreaBO { ...@@ -24,7 +24,7 @@ public class AddOrUpdateAreaBO {
private String remark; private String remark;
@ApiModelProperty(value = "路口ID数组", required = true) @ApiModelProperty(value = "路口ID数组", required = true)
private List<String> crossIdList; private List<String> crossIdList;
@ApiModelProperty(value = "区域坐标") @ApiModelProperty(value = "坐标")
private String wkt; private String wkt;
} }
package net.wanji.web.bo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.Pattern;
import java.util.List;
/**
* @author Kent HAN
* @date 2023/6/9 13:52
*/
@Data
@ApiModel(value = "AddOrUpdateAreaBO", description = "辖区新增/修改")
public class AddOrUpdateJurisdictionBO {
@ApiModelProperty(value = "父辖区ID")
private Integer parentId;
@ApiModelProperty(value = "辖区ID")
private Integer areaId;
@ApiModelProperty(value = "辖区名称", required = true)
@Pattern(regexp = "^[\\u4E00-\\u9FA5\\w\\-]{0,20}$", message = "辖区名称只能包含中文、英文、数字、下划线和中横线,0~20个字符")
private String areaName;
@Pattern(regexp = "^[\\u4E00-\\u9FA5\\w\\-]{0,200}$", message = "辖区名称只能包含中文、英文、数字、下划线和中横线,0~200个字符")
@ApiModelProperty(value = "备注", required = true)
private String remark;
@ApiModelProperty(value = "路口ID数组", required = true)
private List<String> crossIdList;
@ApiModelProperty(value = "坐标")
private String wkt;
}
...@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiResponse; ...@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ApiResponses;
import net.wanji.common.framework.rest.JsonViewObject; import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.web.bo.AddOrUpdateAreaBO; import net.wanji.web.bo.AddOrUpdateAreaBO;
import net.wanji.web.bo.AddOrUpdateJurisdictionBO;
import net.wanji.web.bo.PolygonBO; import net.wanji.web.bo.PolygonBO;
import net.wanji.web.service.impl.CrossManageServiceImpl; import net.wanji.web.service.impl.CrossManageServiceImpl;
import net.wanji.web.vo.CrossIdAndNameVO; import net.wanji.web.vo.CrossIdAndNameVO;
...@@ -45,7 +46,7 @@ public class CrossManageController { ...@@ -45,7 +46,7 @@ public class CrossManageController {
return JsonViewObject.newInstance().success(res); return JsonViewObject.newInstance().success(res);
} }
@ApiOperation(value = "新增/修改子区", notes = "新增/修改子区,传ID为修改,不传ID为新增", response = JsonViewObject.class, @ApiOperation(value = "子区新增/修改", notes = "子区新增/修改,传ID为修改,不传ID为新增", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON) produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/addOrUpdateArea", @PostMapping(value = "/addOrUpdateArea",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON) produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
...@@ -57,4 +58,16 @@ public class CrossManageController { ...@@ -57,4 +58,16 @@ public class CrossManageController {
return JsonViewObject.newInstance().success(); return JsonViewObject.newInstance().success();
} }
@ApiOperation(value = "辖区新增/修改", notes = "辖区新增/修改,传ID为修改,不传ID为新增", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/addOrUpdateJurisdiction",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = JsonViewObject.class),
})
public JsonViewObject addOrUpdateJurisdiction(@RequestBody AddOrUpdateJurisdictionBO addOrUpdateJurisdictionBO) {
crossManageService.addOrUpdateJurisdiction(addOrUpdateJurisdictionBO);
return JsonViewObject.newInstance().success();
}
} }
\ No newline at end of file
...@@ -18,8 +18,8 @@ import java.util.List; ...@@ -18,8 +18,8 @@ import java.util.List;
@ApiModel(value = "树形区域目录实体", description = "树形区域目录实体") @ApiModel(value = "树形区域目录实体", description = "树形区域目录实体")
public class AreaTreePO { public class AreaTreePO {
@ApiModelProperty(value = "区域ID") @ApiModelProperty(value = "行政区划代码")
private Integer areaId; private Integer areaCode;
@ApiModelProperty(value = "行政区划名称") @ApiModelProperty(value = "行政区划名称")
private String areaName; private String areaName;
......
...@@ -3,6 +3,7 @@ package net.wanji.web.service; ...@@ -3,6 +3,7 @@ package net.wanji.web.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import net.wanji.common.framework.rest.JsonViewObject; import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.databus.dao.mapper.BaseCrossInfoMapper; import net.wanji.databus.dao.mapper.BaseCrossInfoMapper;
import net.wanji.databus.po.CrossInfoPO;
import net.wanji.databus.po.BaseCrossInfoPO; import net.wanji.databus.po.BaseCrossInfoPO;
import net.wanji.databus.po.TBaseCrossInfo; import net.wanji.databus.po.TBaseCrossInfo;
import net.wanji.databus.vo.CrossInfoVO; import net.wanji.databus.vo.CrossInfoVO;
...@@ -48,8 +49,10 @@ public class CrossInfoService { ...@@ -48,8 +49,10 @@ public class CrossInfoService {
* @param crossInfoVO 查询路口管理输入参数 * @param crossInfoVO 查询路口管理输入参数
*/ */
public JsonViewObject selectAll(CrossInfoVO crossInfoVO) { public JsonViewObject selectAll(CrossInfoVO crossInfoVO) {
PageResultPO<CrossInfoPO> page = new PageResultPO<>();
PageResultPO<BaseCrossInfoPO> page = new PageResultPO<>(); PageResultPO<BaseCrossInfoPO> page = new PageResultPO<>();
Integer count = baseCrossInfoMapper.countSelectAll(crossInfoVO); Integer count = baseCrossInfoMapper.countSelectAll(crossInfoVO);
List<CrossInfoPO> list = baseCrossInfoMapper.selectAll(crossInfoVO);
List<BaseCrossInfoPO> list = baseCrossInfoMapper.selectAll(crossInfoVO); List<BaseCrossInfoPO> list = baseCrossInfoMapper.selectAll(crossInfoVO);
page.setPageNum(crossInfoVO.getPageNum()); page.setPageNum(crossInfoVO.getPageNum());
page.setPageSize(crossInfoVO.getPageSize()); page.setPageSize(crossInfoVO.getPageSize());
...@@ -106,18 +109,18 @@ public class CrossInfoService { ...@@ -106,18 +109,18 @@ public class CrossInfoService {
IdWorker idWorker = new IdWorker(0, 0); IdWorker idWorker = new IdWorker(0, 0);
crossInfoPO.setId(String.valueOf(idWorker.nextId())); crossInfoPO.setId(String.valueOf(idWorker.nextId()));
} }
if (crossInfoPO.getAreaId() == null) { if (crossInfoPO.getAreaCode() == null) {
QueryWrapper<TBaseAreaInfo> queryWrapper = new QueryWrapper<>(); QueryWrapper<TBaseAreaInfo> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().like(TBaseAreaInfo::getName, crossInfoPO.getAreaName()); queryWrapper.lambda().like(TBaseAreaInfo::getName, crossInfoPO.getAreaName());
// 查询areaId // 查询areaCode
List<TBaseAreaInfo> tBaseAreaInfos = areaInfoMapper.selectList(queryWrapper); List<TBaseAreaInfo> tBaseAreaInfos = areaInfoMapper.selectList(queryWrapper);
if (tBaseAreaInfos != null && tBaseAreaInfos.size() > 0) { if (tBaseAreaInfos != null && tBaseAreaInfos.size() > 0) {
crossInfoPO.setAreaId(tBaseAreaInfos.get(0).getId()); crossInfoPO.setAreaCode(tBaseAreaInfos.get(0).getCode());
} }
} }
if (crossInfoPO.getAreaName() == null) { if (crossInfoPO.getAreaName() == null) {
QueryWrapper<TBaseAreaInfo> queryWrapper = new QueryWrapper<>(); QueryWrapper<TBaseAreaInfo> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(TBaseAreaInfo::getCode, crossInfoPO.getAreaId()); queryWrapper.lambda().eq(TBaseAreaInfo::getCode, crossInfoPO.getAreaCode());
List<TBaseAreaInfo> tBaseAreaInfos = areaInfoMapper.selectList(queryWrapper); List<TBaseAreaInfo> tBaseAreaInfos = areaInfoMapper.selectList(queryWrapper);
if (tBaseAreaInfos != null && tBaseAreaInfos.size() > 0) { if (tBaseAreaInfos != null && tBaseAreaInfos.size() > 0) {
crossInfoPO.setAreaName(tBaseAreaInfos.get(0).getName()); crossInfoPO.setAreaName(tBaseAreaInfos.get(0).getName());
...@@ -168,7 +171,7 @@ public class CrossInfoService { ...@@ -168,7 +171,7 @@ public class CrossInfoService {
Map<Integer, List<AreaTreePO>> parentCodeMap = infos.stream().collect(Collectors.groupingBy(AreaTreePO::getParentCode)); Map<Integer, List<AreaTreePO>> parentCodeMap = infos.stream().collect(Collectors.groupingBy(AreaTreePO::getParentCode));
for (AreaTreePO info : infos) { for (AreaTreePO info : infos) {
for (Integer parentCode : parentCodeMap.keySet()) { for (Integer parentCode : parentCodeMap.keySet()) {
if (info.getAreaId().equals(parentCode)) { if (info.getAreaCode().equals(parentCode)) {
info.setChildren(parentCodeMap.get(parentCode)); info.setChildren(parentCodeMap.get(parentCode));
break; break;
} }
...@@ -178,3 +181,4 @@ public class CrossInfoService { ...@@ -178,3 +181,4 @@ public class CrossInfoService {
return infos; return infos;
} }
} }
package net.wanji.web.service; package net.wanji.web.service;
import net.wanji.web.bo.AddOrUpdateAreaBO; import net.wanji.web.bo.AddOrUpdateAreaBO;
import net.wanji.web.bo.AddOrUpdateJurisdictionBO;
import net.wanji.web.bo.PolygonBO; import net.wanji.web.bo.PolygonBO;
import net.wanji.web.vo.CrossIdAndNameVO; import net.wanji.web.vo.CrossIdAndNameVO;
...@@ -15,4 +16,6 @@ public interface CrossManageService { ...@@ -15,4 +16,6 @@ public interface CrossManageService {
List<CrossIdAndNameVO> selectCrossesByPolygon(PolygonBO polygonBO); List<CrossIdAndNameVO> selectCrossesByPolygon(PolygonBO polygonBO);
void addOrUpdateArea(AddOrUpdateAreaBO addOrUpdateAreaBO); void addOrUpdateArea(AddOrUpdateAreaBO addOrUpdateAreaBO);
void addOrUpdateJurisdiction(AddOrUpdateJurisdictionBO addOrUpdateJurisdictionBO);
} }
...@@ -9,6 +9,7 @@ import net.wanji.databus.dao.mapper.BaseCrossInfoMapper; ...@@ -9,6 +9,7 @@ import net.wanji.databus.dao.mapper.BaseCrossInfoMapper;
import net.wanji.databus.po.BaseAreaInfoPO; import net.wanji.databus.po.BaseAreaInfoPO;
import net.wanji.databus.po.BaseCrossInfoPO; import net.wanji.databus.po.BaseCrossInfoPO;
import net.wanji.web.bo.AddOrUpdateAreaBO; import net.wanji.web.bo.AddOrUpdateAreaBO;
import net.wanji.web.bo.AddOrUpdateJurisdictionBO;
import net.wanji.web.bo.PolygonBO; import net.wanji.web.bo.PolygonBO;
import net.wanji.web.service.CrossManageService; import net.wanji.web.service.CrossManageService;
import net.wanji.web.vo.CrossIdAndNameVO; import net.wanji.web.vo.CrossIdAndNameVO;
...@@ -93,4 +94,39 @@ public class CrossManageServiceImpl implements CrossManageService { ...@@ -93,4 +94,39 @@ public class CrossManageServiceImpl implements CrossManageService {
crossInfoMapper.updateAreaId(crossIdList, newAreaId); crossInfoMapper.updateAreaId(crossIdList, newAreaId);
} }
} }
@Override
public void addOrUpdateJurisdiction(AddOrUpdateJurisdictionBO addOrUpdateJurisdictionBO) {
Integer parentId = addOrUpdateJurisdictionBO.getParentId();
Integer areaId = addOrUpdateJurisdictionBO.getAreaId();
String areaName = addOrUpdateJurisdictionBO.getAreaName();
String remark = addOrUpdateJurisdictionBO.getRemark();
List<String> crossIdList = addOrUpdateJurisdictionBO.getCrossIdList();
String wkt = addOrUpdateJurisdictionBO.getWkt();
if (ObjectUtil.isNotEmpty(areaId)) {
// 修改
// 修改辖区名称和备注
baseAreaInfoMapper.updateAreaNameAndRemark(areaName, remark, areaId);
// 修改辖区关联路口
List<String> oldIds = crossInfoMapper.selectIdsByAreaId(areaId);
crossInfoMapper.deleteAreaId(oldIds);
crossInfoMapper.updateAreaId(crossIdList, areaId);
} else {
// 新增
// 新增子区
BaseAreaInfoPO baseAreaInfoPO = new BaseAreaInfoPO();
baseAreaInfoPO.setCode(0);
baseAreaInfoPO.setName(areaName);
baseAreaInfoPO.setType(5);
baseAreaInfoPO.setParentCode(0);
baseAreaInfoPO.setLocation("");
baseAreaInfoPO.setPolylines(wkt);
baseAreaInfoPO.setRemark(remark);
baseAreaInfoMapper.insertOne(baseAreaInfoPO);
Integer newAreaId = baseAreaInfoPO.getId();
// 关联子区路口
crossInfoMapper.updateAreaId(crossIdList, newAreaId);
}
}
} }
...@@ -49,9 +49,9 @@ public class BaseCrossInfoVO { ...@@ -49,9 +49,9 @@ public class BaseCrossInfoVO {
/** /**
* 行政区划代码 * 行政区划代码
*/ */
@ApiModelProperty(value = "区域ID") @ApiModelProperty(value = "行政区划代码")
//@NotNull(message = "行政区划代码不可为空", groups = {Save.class, Update.class}) //@NotNull(message = "行政区划代码不可为空", groups = {Save.class, Update.class})
private Integer areaId; private Integer areaCode;
/** /**
* 行政区划名称 * 行政区划名称
......
...@@ -25,8 +25,8 @@ public class CrossInfoDTO { ...@@ -25,8 +25,8 @@ public class CrossInfoDTO {
@ApiModelProperty(name = "路口级别",notes = "") @ApiModelProperty(name = "路口级别",notes = "")
private Integer level; private Integer level;
@ApiModelProperty(name = "区域Id",notes = "") @ApiModelProperty(name = "行政区划代码",notes = "")
private Integer areaId; private Integer areaCode;
@ApiModelProperty(name = "路口位置",notes = "") @ApiModelProperty(name = "路口位置",notes = "")
private String location; private String location;
......
...@@ -38,7 +38,7 @@ public class BaseCrossInfoPO { ...@@ -38,7 +38,7 @@ public class BaseCrossInfoPO {
/** /**
* 行政区划代码 * 行政区划代码
*/ */
private Integer areaId; private Integer areaCode;
/** /**
* 行政区划名称 * 行政区划名称
......
...@@ -53,8 +53,8 @@ public class TBaseCrossInfo implements Serializable { ...@@ -53,8 +53,8 @@ public class TBaseCrossInfo implements Serializable {
/** /**
* 行政区划代码 * 行政区划代码
*/ */
@TableField("area_id") @TableField("area_code")
private Integer areaId; private Integer areaCode;
/** /**
* 路口位置 * 路口位置
......
...@@ -21,8 +21,8 @@ public class CrossInfoVO { ...@@ -21,8 +21,8 @@ public class CrossInfoVO {
/** /**
* 行政区划代码 * 行政区划代码
*/ */
@ApiModelProperty(value = "区域ID", required = true) @ApiModelProperty(value = "行政区划代码", required = true)
private Integer areaId; private Integer areaCode;
/** /**
* 行政区划名称 * 行政区划名称
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<result column="name" property="name" jdbcType="VARCHAR"/> <result column="name" property="name" jdbcType="VARCHAR"/>
<result column="type" property="type" jdbcType="TINYINT"/> <result column="type" property="type" jdbcType="TINYINT"/>
<result column="level" property="level" jdbcType="TINYINT"/> <result column="level" property="level" jdbcType="TINYINT"/>
<result column="area_id" property="areaId" jdbcType="INTEGER"/> <result column="area_code" property="areaCode" jdbcType="INTEGER"/>
<result column="location" property="location" jdbcType="VARCHAR"/> <result column="location" property="location" jdbcType="VARCHAR"/>
<result column="is_signal" property="isSignal" jdbcType="TINYINT"/> <result column="is_signal" property="isSignal" jdbcType="TINYINT"/>
<result column="is_start" property="isStart" jdbcType="TINYINT"/> <result column="is_start" property="isStart" jdbcType="TINYINT"/>
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<result column="name" property="name" jdbcType="VARCHAR"/> <result column="name" property="name" jdbcType="VARCHAR"/>
<result column="type" property="type" jdbcType="TINYINT"/> <result column="type" property="type" jdbcType="TINYINT"/>
<result column="level" property="level" jdbcType="TINYINT"/> <result column="level" property="level" jdbcType="TINYINT"/>
<result column="area_id" property="areaId" jdbcType="INTEGER"/> <result column="area_code" property="areaCode" jdbcType="INTEGER"/>
<result column="area_name" property="areaName" jdbcType="VARCHAR"/> <result column="area_name" property="areaName" jdbcType="VARCHAR"/>
<result column="location" property="location" jdbcType="VARCHAR"/> <result column="location" property="location" jdbcType="VARCHAR"/>
<result column="is_signal" property="isSignal" jdbcType="TINYINT"/> <result column="is_signal" property="isSignal" jdbcType="TINYINT"/>
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
</resultMap> </resultMap>
<sql id="baseColumn"> <sql id="baseColumn">
id, name, type, level, area_id, location, is_signal, is_start, is_send, gmt_create, gmt_modified id, name, type, level, area_code, location, is_signal, is_start, is_send, gmt_create, gmt_modified
</sql> </sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String"> <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String">
...@@ -44,23 +44,13 @@ ...@@ -44,23 +44,13 @@
from t_base_cross_info from t_base_cross_info
where id = #{id,jdbcType=CHAR} where id = #{id,jdbcType=CHAR}
</delete> </delete>
<update id="deleteAreaId">
update t_base_cross_info
set area_id = 0
where id in
<foreach collection="ids" item="id" separator="," open="(" close=")">
#{id}
</foreach>
</update>
<insert id="insert" parameterType="net.wanji.databus.po.TBaseCrossInfo"> <insert id="insert" parameterType="net.wanji.databus.po.TBaseCrossInfo">
insert into t_base_cross_info (id, name, type, insert into t_base_cross_info (id, name, type,
level, area_id, location, level, area_code, location,
is_signal, is_start, is_send, is_signal, is_start, is_send,
gmt_create, gmt_modified) gmt_create, gmt_modified)
values (#{id,jdbcType=CHAR}, #{name,jdbcType=VARCHAR}, #{type,jdbcType=TINYINT}, values (#{id,jdbcType=CHAR}, #{name,jdbcType=VARCHAR}, #{type,jdbcType=TINYINT},
#{level,jdbcType=TINYINT}, #{areaId,jdbcType=INTEGER}, #{location,jdbcType=VARCHAR}, #{level,jdbcType=TINYINT}, #{areaCode,jdbcType=INTEGER}, #{location,jdbcType=VARCHAR},
#{isSignal,jdbcType=TINYINT}, #{isStart,jdbcType=TINYINT}, #{isSend,jdbcType=TINYINT}, #{isSignal,jdbcType=TINYINT}, #{isStart,jdbcType=TINYINT}, #{isSend,jdbcType=TINYINT},
#{gmtCreate,jdbcType=TIMESTAMP}, #{gmtModified,jdbcType=TIMESTAMP}) #{gmtCreate,jdbcType=TIMESTAMP}, #{gmtModified,jdbcType=TIMESTAMP})
</insert> </insert>
...@@ -79,8 +69,8 @@ ...@@ -79,8 +69,8 @@
<if test="level != null"> <if test="level != null">
level, level,
</if> </if>
<if test="areaId != null"> <if test="areaCode != null">
area_id, area_code,
</if> </if>
<if test="location != null"> <if test="location != null">
location, location,
...@@ -114,8 +104,8 @@ ...@@ -114,8 +104,8 @@
<if test="level != null"> <if test="level != null">
#{level,jdbcType=TINYINT}, #{level,jdbcType=TINYINT},
</if> </if>
<if test="areaId != null"> <if test="areaCode != null">
#{areaId,jdbcType=INTEGER}, #{areaCode,jdbcType=INTEGER},
</if> </if>
<if test="location != null"> <if test="location != null">
#{location,jdbcType=VARCHAR}, #{location,jdbcType=VARCHAR},
...@@ -149,8 +139,8 @@ ...@@ -149,8 +139,8 @@
<if test="level != null"> <if test="level != null">
level = #{level,jdbcType=TINYINT}, level = #{level,jdbcType=TINYINT},
</if> </if>
<if test="areaId != null"> <if test="areaCode != null">
area_id = #{areaId,jdbcType=INTEGER}, area_code = #{areaCode,jdbcType=INTEGER},
</if> </if>
<if test="location != null"> <if test="location != null">
location = #{location,jdbcType=VARCHAR}, location = #{location,jdbcType=VARCHAR},
...@@ -178,7 +168,7 @@ ...@@ -178,7 +168,7 @@
set name = #{name,jdbcType=VARCHAR}, set name = #{name,jdbcType=VARCHAR},
type = #{type,jdbcType=TINYINT}, type = #{type,jdbcType=TINYINT},
level = #{level,jdbcType=TINYINT}, level = #{level,jdbcType=TINYINT},
area_id = #{areaId,jdbcType=INTEGER}, area_code = #{areaCode,jdbcType=INTEGER},
location = #{location,jdbcType=VARCHAR}, location = #{location,jdbcType=VARCHAR},
is_signal = #{isSignal,jdbcType=TINYINT}, is_signal = #{isSignal,jdbcType=TINYINT},
is_start = #{isStart,jdbcType=TINYINT}, is_start = #{isStart,jdbcType=TINYINT},
...@@ -187,28 +177,18 @@ ...@@ -187,28 +177,18 @@
gmt_modified = #{gmtModified,jdbcType=TIMESTAMP} gmt_modified = #{gmtModified,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=CHAR} where id = #{id,jdbcType=CHAR}
</update> </update>
<update id="updateAreaId">
update t_base_cross_info
set area_id = #{areaId}
where id in
<foreach collection="ids" item="id" separator="," open="(" close=")">
#{id}
</foreach>
</update>
<select id="selectAll" parameterType="net.wanji.databus.vo.CrossInfoPageVO" resultMap="SelectAllMap"> <select id="selectAll" parameterType="net.wanji.databus.vo.CrossInfoPageVO" resultMap="SelectAllMap">
<bind name="startNum" value="(pageNum - 1) * pageSize"/> <bind name="startNum" value="(pageNum - 1) * pageSize"/>
select c.id,c.name,c.type,c.level,c.area_id,a.name select c.id,c.name,c.type,c.level,c.area_code,a.name
area_name,c.location,c.is_signal,c.is_start,c.is_send,c.gmt_create,c.gmt_modified area_name,c.location,c.is_signal,c.is_start,c.is_send,c.gmt_create,c.gmt_modified
from t_base_cross_info c from t_base_cross_info c
left join t_base_area_info a on c.area_id=a.code left join t_base_area_info a on c.area_code=a.code
<where> <where>
<if test="name != null and name != ''"> <if test="name != null and name != ''">
and c.name like concat('%',#{name},'%') and c.name like concat('%',#{name},'%')
</if> </if>
<if test="areaId != null and areaId != ''"> <if test="areaCode != null and areaCode != ''">
and a.id = #{areaId} and a.code = #{areaCode}
</if> </if>
<if test="areaName != null and areaName != ''"> <if test="areaName != null and areaName != ''">
and a.name = #{areaName} and a.name = #{areaName}
...@@ -230,13 +210,13 @@ ...@@ -230,13 +210,13 @@
<select id="countSelectAll" parameterType="net.wanji.databus.vo.CrossInfoPageVO" resultType="integer"> <select id="countSelectAll" parameterType="net.wanji.databus.vo.CrossInfoPageVO" resultType="integer">
select count(1) select count(1)
from t_base_cross_info c from t_base_cross_info c
left join t_base_area_info a on c.area_id=a.id left join t_base_area_info a on c.area_code=a.code
<where> <where>
<if test="name != null and name != ''"> <if test="name != null and name != ''">
and c.name like concat('%',#{name},'%') and c.name like concat('%',#{name},'%')
</if> </if>
<if test="areaId != null and areaId != ''"> <if test="areaCode != null and areaCode != ''">
and a.id = #{areaId} and a.code = #{areaCode}
</if> </if>
<if test="areaName != null and areaName != ''"> <if test="areaName != null and areaName != ''">
and a.name = #{areaName} and a.name = #{areaName}
...@@ -292,10 +272,4 @@ ...@@ -292,10 +272,4 @@
from t_base_cross_info from t_base_cross_info
where name = #{name} where name = #{name}
</select> </select>
<select id="selectIdsByAreaId" resultType="java.lang.String">
select id from t_base_cross_info
where area_id = #{areaId}
</select>
</mapper> </mapper>
\ No newline at end of file
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