2024-08-15 朱宝民 修改片区(重建地图图形和坐标)、删除片区(同步删除地图图形和坐标)
| | |
| | | int updateByPrimaryKeySelective(BaMapCoordinates record); |
| | | |
| | | int updateByPrimaryKey(BaMapCoordinates record); |
| | | |
| | | /** |
| | | * 根据片区ID删除该片区下的坐标点 |
| | | * @param blockId |
| | | * @return |
| | | */ |
| | | int deleteByBlockId(Long blockId); |
| | | } |
| | |
| | | int updateByPrimaryKeySelective(BaMapGraph record); |
| | | |
| | | int updateByPrimaryKey(BaMapGraph record); |
| | | |
| | | /** |
| | | * 根据片区ID删除地图图形 |
| | | * @param blockId |
| | | * @return |
| | | */ |
| | | int deleteByBlockId(Long blockId); |
| | | } |
| | |
| | | |
| | | pipIrr: |
| | | global: |
| | | dev: false #是否开发阶段,true或false |
| | | dev: fals #是否开发阶段,true或false |
| | | dsName: ym #开发阶段,设置临时的数据库名称 |
| | | mw: |
| | | webPort: 8070 |
| | |
| | | <?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.dy.pipIrrGlobal.daoBa.BaMapCoordinatesMapper"> |
| | | <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoBa.BaMapCoordinates"> |
| | | <!--@mbg.generated--> |
| | | <!--@Table ba_map_coordinates--> |
| | | <id column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="graph_id" jdbcType="BIGINT" property="graphId" /> |
| | | <result column="lat" jdbcType="DECIMAL" property="lat" /> |
| | | <result column="lng" jdbcType="DECIMAL" property="lng" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, graph_id, lat, lng |
| | | </sql> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | | <!--@mbg.generated--> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from ba_map_coordinates |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> |
| | | <!--@mbg.generated--> |
| | | delete from ba_map_coordinates |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoBa.BaMapCoordinates"> |
| | | <!--@mbg.generated--> |
| | | insert into ba_map_coordinates (id, graph_id, lat, |
| | | lng) |
| | | values (#{id,jdbcType=BIGINT}, #{graphId,jdbcType=BIGINT}, #{lat,jdbcType=DECIMAL}, |
| | | #{lng,jdbcType=DECIMAL}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoBa.BaMapCoordinates"> |
| | | <!--@mbg.generated--> |
| | | insert into ba_map_coordinates |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoBa.BaMapCoordinates"> |
| | | <!--@mbg.generated--> |
| | | <!--@Table ba_map_coordinates--> |
| | | <id column="id" jdbcType="BIGINT" property="id"/> |
| | | <result column="graph_id" jdbcType="BIGINT" property="graphId"/> |
| | | <result column="lat" jdbcType="DECIMAL" property="lat"/> |
| | | <result column="lng" jdbcType="DECIMAL" property="lng"/> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, |
| | | </if> |
| | | <if test="graphId != null"> |
| | | graph_id, |
| | | </if> |
| | | <if test="lat != null"> |
| | | lat, |
| | | </if> |
| | | <if test="lng != null"> |
| | | lng, |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | #{id,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="graphId != null"> |
| | | #{graphId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="lat != null"> |
| | | #{lat,jdbcType=DECIMAL}, |
| | | </if> |
| | | <if test="lng != null"> |
| | | #{lng,jdbcType=DECIMAL}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoBa.BaMapCoordinates"> |
| | | <!--@mbg.generated--> |
| | | update ba_map_coordinates |
| | | <set> |
| | | <if test="graphId != null"> |
| | | graph_id = #{graphId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="lat != null"> |
| | | lat = #{lat,jdbcType=DECIMAL}, |
| | | </if> |
| | | <if test="lng != null"> |
| | | lng = #{lng,jdbcType=DECIMAL}, |
| | | </if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoBa.BaMapCoordinates"> |
| | | <!--@mbg.generated--> |
| | | update ba_map_coordinates |
| | | set graph_id = #{graphId,jdbcType=BIGINT}, |
| | | lat = #{lat,jdbcType=DECIMAL}, |
| | | lng = #{lng,jdbcType=DECIMAL} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | lng |
| | | </sql> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | | <!--@mbg.generated--> |
| | | select |
| | | <include refid="Base_Column_List"/> |
| | | from ba_map_coordinates |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> |
| | | <!--@mbg.generated--> |
| | | delete |
| | | from ba_map_coordinates |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoBa.BaMapCoordinates"> |
| | | <!--@mbg.generated--> |
| | | insert into ba_map_coordinates (id, graph_id, lat, |
| | | lng) |
| | | values (#{id,jdbcType=BIGINT}, #{graphId,jdbcType=BIGINT}, #{lat,jdbcType=DECIMAL}, |
| | | #{lng,jdbcType=DECIMAL}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoBa.BaMapCoordinates"> |
| | | <!--@mbg.generated--> |
| | | insert into ba_map_coordinates |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | id, |
| | | </if> |
| | | <if test="graphId != null"> |
| | | graph_id, |
| | | </if> |
| | | <if test="lat != null"> |
| | | lat, |
| | | </if> |
| | | <if test="lng != null"> |
| | | lng, |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | #{id,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="graphId != null"> |
| | | #{graphId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="lat != null"> |
| | | #{lat,jdbcType=DECIMAL}, |
| | | </if> |
| | | <if test="lng != null"> |
| | | #{lng,jdbcType=DECIMAL}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoBa.BaMapCoordinates"> |
| | | <!--@mbg.generated--> |
| | | update ba_map_coordinates |
| | | <set> |
| | | <if test="graphId != null"> |
| | | graph_id = #{graphId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="lat != null"> |
| | | lat = #{lat,jdbcType=DECIMAL}, |
| | | </if> |
| | | <if test="lng != null"> |
| | | lng = #{lng,jdbcType=DECIMAL}, |
| | | </if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoBa.BaMapCoordinates"> |
| | | <!--@mbg.generated--> |
| | | update ba_map_coordinates |
| | | set graph_id = #{graphId,jdbcType=BIGINT}, |
| | | lat = #{lat,jdbcType=DECIMAL}, |
| | | lng = #{lng,jdbcType=DECIMAL} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <!--根据片区ID删除该片区下的坐标点--> |
| | | <delete id="deleteByBlockId" parameterType="java.lang.Long"> |
| | | DELETE coo.* |
| | | FROM ba_map_coordinates coo |
| | | INNER JOIN ba_map_graph gra ON gra.id = coo.graph_id |
| | | WHERE gra.block_id = #{blockId} |
| | | </delete> |
| | | </mapper> |
| | |
| | | <?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.dy.pipIrrGlobal.daoBa.BaMapGraphMapper"> |
| | | <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoBa.BaMapGraph"> |
| | | <!--@mbg.generated--> |
| | | <!--@Table ba_map_graph--> |
| | | <id column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="block_id" jdbcType="BIGINT" property="blockId" /> |
| | | <result column="graph_type" jdbcType="TINYINT" property="graphType" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, block_id, graph_type |
| | | </sql> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | | <!--@mbg.generated--> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from ba_map_graph |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> |
| | | <!--@mbg.generated--> |
| | | delete from ba_map_graph |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoBa.BaMapGraph"> |
| | | <!--@mbg.generated--> |
| | | insert into ba_map_graph (id, block_id, graph_type |
| | | ) |
| | | values (#{id,jdbcType=BIGINT}, #{blockId,jdbcType=BIGINT}, #{graphType,jdbcType=TINYINT} |
| | | ) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoBa.BaMapGraph"> |
| | | <!--@mbg.generated--> |
| | | insert into ba_map_graph |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoBa.BaMapGraph"> |
| | | <!--@mbg.generated--> |
| | | <!--@Table ba_map_graph--> |
| | | <id column="id" jdbcType="BIGINT" property="id"/> |
| | | <result column="block_id" jdbcType="BIGINT" property="blockId"/> |
| | | <result column="graph_type" jdbcType="TINYINT" property="graphType"/> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, |
| | | </if> |
| | | <if test="blockId != null"> |
| | | block_id, |
| | | </if> |
| | | <if test="graphType != null"> |
| | | graph_type, |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | #{id,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="blockId != null"> |
| | | #{blockId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="graphType != null"> |
| | | #{graphType,jdbcType=TINYINT}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoBa.BaMapGraph"> |
| | | <!--@mbg.generated--> |
| | | update ba_map_graph |
| | | <set> |
| | | <if test="blockId != null"> |
| | | block_id = #{blockId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="graphType != null"> |
| | | graph_type = #{graphType,jdbcType=TINYINT}, |
| | | </if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoBa.BaMapGraph"> |
| | | <!--@mbg.generated--> |
| | | update ba_map_graph |
| | | set block_id = #{blockId,jdbcType=BIGINT}, |
| | | graph_type = #{graphType,jdbcType=TINYINT} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | graph_type |
| | | </sql> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | | <!--@mbg.generated--> |
| | | select |
| | | <include refid="Base_Column_List"/> |
| | | from ba_map_graph |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> |
| | | <!--@mbg.generated--> |
| | | delete |
| | | from ba_map_graph |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoBa.BaMapGraph"> |
| | | <!--@mbg.generated--> |
| | | insert into ba_map_graph (id, block_id, graph_type) |
| | | values (#{id,jdbcType=BIGINT}, #{blockId,jdbcType=BIGINT}, #{graphType,jdbcType=TINYINT}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoBa.BaMapGraph"> |
| | | <!--@mbg.generated--> |
| | | insert into ba_map_graph |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | id, |
| | | </if> |
| | | <if test="blockId != null"> |
| | | block_id, |
| | | </if> |
| | | <if test="graphType != null"> |
| | | graph_type, |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | #{id,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="blockId != null"> |
| | | #{blockId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="graphType != null"> |
| | | #{graphType,jdbcType=TINYINT}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoBa.BaMapGraph"> |
| | | <!--@mbg.generated--> |
| | | update ba_map_graph |
| | | <set> |
| | | <if test="blockId != null"> |
| | | block_id = #{blockId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="graphType != null"> |
| | | graph_type = #{graphType,jdbcType=TINYINT}, |
| | | </if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoBa.BaMapGraph"> |
| | | <!--@mbg.generated--> |
| | | update ba_map_graph |
| | | set block_id = #{blockId,jdbcType=BIGINT}, |
| | | graph_type = #{graphType,jdbcType=TINYINT} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <!--根据片区ID删除地图图形--> |
| | | <delete id="deleteByBlockId" parameterType="java.lang.Long"> |
| | | DELETE |
| | | FROM ba_map_graph |
| | | WHERE block_id = #{blockId} |
| | | </delete> |
| | | </mapper> |
| | |
| | | @Slf4j |
| | | @Tag(name = "片区管理", description = "片区增删改查等操作") |
| | | @RestController |
| | | @RequestMapping(path="block") |
| | | @RequestMapping(path = "block") |
| | | @SuppressWarnings("unchecked")//java版本越高,对泛型约束越严,所以配置SuppressWarnings("unchecked") |
| | | public class BlockCtrl { |
| | | |
| | | private BlockSv sv ; |
| | | private BlockSv sv; |
| | | |
| | | @Autowired |
| | | private void setSv(BlockSv sv){ |
| | | this.sv = sv ; |
| | | private void setSv(BlockSv sv) { |
| | | this.sv = sv; |
| | | } |
| | | |
| | | /** |
| | | * 客户端请求得到所有片区数据 |
| | | * |
| | | * @return 所有片区数据 |
| | | */ |
| | | @Operation(summary = "获得全部片区", description = "返回全部片区数据") |
| | |
| | | }) |
| | | @GetMapping(path = "all") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<BaBlock>>> all(){ |
| | | public BaseResponse<QueryResultVo<List<BaBlock>>> all() { |
| | | try { |
| | | QueryResultVo<List<BaBlock>> res = this.sv.selectAll() ; |
| | | QueryResultVo<List<BaBlock>> res = this.sv.selectAll(); |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | } catch (Exception e) { |
| | | log.error("查询片区异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 客户端请求得到所有片区数据 2024-08-14废弃 |
| | | * |
| | | * @return 所有片区数据 |
| | | */ |
| | | @PostMapping(path = "some2", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<BaBlock>>> some(@RequestBody QueryVo vo){ |
| | | public BaseResponse<QueryResultVo<List<BaBlock>>> some(@RequestBody QueryVo vo) { |
| | | try { |
| | | QueryResultVo<List<BaBlock>> res = this.sv.selectSome(vo) ; |
| | | QueryResultVo<List<BaBlock>> res = this.sv.selectSome(vo); |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | } catch (Exception e) { |
| | | log.error("查询片区异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据指定条件获取片区,2024-08-14新增,替换原来的片区分页查询 |
| | | * |
| | | * @param qo |
| | | * @param bindingResult |
| | | * @return |
| | |
| | | @GetMapping(path = "/some") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<VoBlock>>> getBlocks(@Valid QueryVo qo, BindingResult bindingResult) { |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | if (bindingResult != null && bindingResult.hasErrors()) { |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | try { |
| | | return BaseResponseUtils.buildSuccess(this.sv.getBlocks(qo)); |
| | | } catch (Exception e) { |
| | | log.error("获取开卡记录异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 得到一个片区数据 |
| | | * |
| | | * @return 一个片区数据 |
| | | */ |
| | | @Operation(summary = "一个片区", description = "得到一个片区数据") |
| | |
| | | //@GetMapping(path = "one", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @GetMapping(path = "one") |
| | | @SsoAop() |
| | | public BaseResponse<BaBlock> one(Long id){ |
| | | public BaseResponse<BaBlock> one(Long id) { |
| | | return BaseResponseUtils.buildSuccess(this.sv.selectById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 保存片区 |
| | | * |
| | | * @param po 保存片区form表单对象 |
| | | * @return 是否成功 |
| | | */ |
| | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | //public BaseResponse<Boolean> save(@RequestBody @Valid BaBlock po, BindingResult bindingResult){ |
| | | public BaseResponse<Boolean> save(@RequestBody @Valid Block po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | public BaseResponse<Boolean> save(@RequestBody @Valid Block po, BindingResult bindingResult) { |
| | | if (bindingResult != null && bindingResult.hasErrors()) { |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | |
| | |
| | | baBlock.setRemark(po.getRemark()); |
| | | baBlock.deleted = Deleted.NO; |
| | | Long blockId = Optional.ofNullable(this.sv.save(baBlock)).orElse(0L); |
| | | if(blockId.equals(0)) { |
| | | if (blockId.equals(0)) { |
| | | return BaseResponseUtils.buildErrorMsg(SystemResultCode.SAVA_BLOCK_ERROR.getMessage()); |
| | | } |
| | | |
| | |
| | | break; |
| | | } |
| | | Long graphId = Optional.ofNullable(this.sv.addMapGraph(baMapGraph)).orElse(0L); |
| | | if(graphId.equals(0)) { |
| | | if (graphId.equals(0)) { |
| | | return BaseResponseUtils.buildErrorMsg(SystemResultCode.SAVA_BLOCK_ERROR.getMessage()); |
| | | } |
| | | |
| | |
| | | mapCoordinates.setLat(point.getBigDecimal("lat")); |
| | | mapCoordinates.setLng(point.getBigDecimal("lng")); |
| | | Long coordinateId = Optional.ofNullable(this.sv.addMapCoordinate(mapCoordinates)).orElse(0L); |
| | | if(coordinateId.equals(0)) { |
| | | if (coordinateId.equals(0)) { |
| | | return BaseResponseUtils.buildErrorMsg(SystemResultCode.SAVA_BLOCK_ERROR.getMessage()); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * 编辑修改片区 |
| | | * 编辑修改片区 2024-08-15 作废 |
| | | * |
| | | * @param po 保存片区form表单对象 |
| | | * @return 是否成功 |
| | | */ |
| | | @Operation(summary = "编辑修改片区", description = "提交片区数据(form表单),进行修改") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "操作结果:true:成功,false:失败(BaseResponse.content)", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = Boolean.class))} |
| | | ) |
| | | }) |
| | | @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @PostMapping(path = "update2", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> update(@RequestBody @Valid BaBlock po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | public BaseResponse<Boolean> update2(@RequestBody @Valid BaBlock po, BindingResult bindingResult) { |
| | | if (bindingResult != null && bindingResult.hasErrors()) { |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | if(po.id == null){ |
| | | return BaseResponseUtils.buildFail("无数据实体ID") ; |
| | | if (po.id == null) { |
| | | return BaseResponseUtils.buildFail("无数据实体ID"); |
| | | } |
| | | int count; |
| | | try { |
| | | count = this.sv.update(po); |
| | | } catch (Exception e) { |
| | | log.error("保存片区异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | if(count <= 0){ |
| | | return BaseResponseUtils.buildFail("数据库存储失败") ; |
| | | }else{ |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | if (count <= 0) { |
| | | return BaseResponseUtils.buildFail("数据库存储失败"); |
| | | } else { |
| | | return BaseResponseUtils.buildSuccess(true); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 修改片区信息,2024-08-15新增,替换原来的片区修改接口 |
| | | * |
| | | * @param po |
| | | * @param bindingResult |
| | | * @return |
| | | */ |
| | | @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> update(@RequestBody @Valid Block po, BindingResult bindingResult) { |
| | | if (bindingResult != null && bindingResult.hasErrors()) { |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | |
| | | Long blockId = po.getId(); |
| | | if (blockId == null) { |
| | | return BaseResponseUtils.buildErrorMsg(SystemResultCode.THE_BLOCK_NOT_EXIST.getMessage()); |
| | | } |
| | | |
| | | // 修改片区信息 |
| | | BaBlock baBlock = new BaBlock(); |
| | | baBlock.setId(po.getId()); |
| | | baBlock.setName(po.getName()); |
| | | baBlock.setHeader(po.getHeader()); |
| | | baBlock.setPhone(po.getPhone()); |
| | | baBlock.setArea(po.getArea()); |
| | | baBlock.setColor(po.getColor()); |
| | | baBlock.setRemark(po.getRemark()); |
| | | baBlock.setDeleted(po.getDeleted()); |
| | | int count; |
| | | try { |
| | | count = this.sv.update(baBlock); |
| | | } catch (Exception e) { |
| | | log.error("保存片区异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | if (count <= 0) { |
| | | return BaseResponseUtils.buildFail("数据库存储失败"); |
| | | } |
| | | |
| | | // 删除片区关联的地图图形 |
| | | this.sv.deleteMapGraph(blockId); |
| | | // 删除地图图形坐标 |
| | | this.sv.deleteMapCoordinates(blockId); |
| | | |
| | | return BaseResponseUtils.buildSuccess(true); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 删除片区 |
| | | * |
| | | * @param id 片区ID |
| | | * @return 是否成功 |
| | | */ |
| | |
| | | schema = @Schema(implementation = Boolean.class))} |
| | | ) |
| | | }) |
| | | |
| | | //@GetMapping(path = "delete", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @GetMapping(path = "delete") |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> delete(Long id){ |
| | | if(id == null){ |
| | | return BaseResponseUtils.buildFail("id不能为空") ; |
| | | public BaseResponse<Boolean> delete(Long id) { |
| | | if (id == null) { |
| | | return BaseResponseUtils.buildFail("id不能为空"); |
| | | } |
| | | int count; |
| | | try { |
| | | count = this.sv.delete(id); |
| | | } catch (Exception e) { |
| | | log.error("保存片区异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | if(count <= 0){ |
| | | return BaseResponseUtils.buildFail("数据库存储失败") ; |
| | | }else{ |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | if (count <= 0) { |
| | | return BaseResponseUtils.buildFail("数据库存储失败"); |
| | | } |
| | | |
| | | // 删除片区关联的地图图形 |
| | | this.sv.deleteMapGraph(id); |
| | | // 删除地图图形坐标 |
| | | this.sv.deleteMapCoordinates(id); |
| | | |
| | | return BaseResponseUtils.buildSuccess(true); |
| | | } |
| | | } |
| | |
| | | return po.getId(); |
| | | }; |
| | | |
| | | /** |
| | | * 根据片区ID删除地图图形 |
| | | * @param blockId |
| | | * @return |
| | | */ |
| | | public int deleteMapGraph(Long blockId) { |
| | | return this.baMapGraphMapper.deleteByBlockId(blockId); |
| | | } |
| | | |
| | | /** |
| | | * 根据片区ID删除该片区下的坐标点 |
| | | * @param blockId |
| | | * @return |
| | | */ |
| | | public int deleteMapCoordinates(Long blockId) { |
| | | return this.baMapCoordinatesMapper.deleteByBlockId(blockId); |
| | | } |
| | | |
| | | } |
| | |
| | | public static final long serialVersionUID = 202408131140001L; |
| | | |
| | | /** |
| | | * 片区ID |
| | | */ |
| | | private Long id; |
| | | |
| | | /** |
| | | * 片区名称 |
| | | */ |
| | | @NotBlank(message = "片区名称不能为空") |
| | |
| | | /** |
| | | * 片区 |
| | | */ |
| | | SAVA_BLOCK_ERROR(30001, "保存片区失败"); |
| | | SAVA_BLOCK_ERROR(30001, "保存片区失败"), |
| | | THE_BLOCK_NOT_EXIST(30002, "片区不存在"); |
| | | |
| | | private final Integer code; |
| | | private final String message; |