Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dy.pipIrrGlobal.pojoBa.BaBlock; |
| | | import com.dy.pipIrrGlobal.voBa.VoBlock; |
| | | import com.dy.pipIrrGlobal.voBa.VoMapCoordinates; |
| | | import com.dy.pipIrrGlobal.voBa.VoMapGraph; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | |
| | | List<BaBlock> selectSome(Map<?, ?> params) ; |
| | | |
| | | /** |
| | | * 根据指定条件获取片区记录数量 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Long getBlocksCount(Map<?, ?> params) ; |
| | | |
| | | /** |
| | | * 根据指定条件获取片区 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<VoBlock> getBlocks(Map<?, ?> params) ; |
| | | |
| | | /** |
| | | * 根据片区ID获取地图图形列表 |
| | | * @param blockId |
| | | * @return |
| | | */ |
| | | List<VoMapGraph> gertMapGraphsByBlockId(Long blockId); |
| | | |
| | | /** |
| | | * 根据地图图形ID获取地图图形坐标列表 |
| | | * @param graphId |
| | | * @return |
| | | */ |
| | | List<VoMapCoordinates> getCoordinatesByGraphId(Long graphId); |
| | | |
| | | /** |
| | | * insert record to table |
| | | * @param record the record |
| | | * @return insert count |
New file |
| | |
| | | package com.dy.pipIrrGlobal.daoBa; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dy.pipIrrGlobal.pojoBa.BaMapCoordinates; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-08-13 11:33 |
| | | * @LastEditTime 2024-08-13 11:33 |
| | | * @Description |
| | | */ |
| | | |
| | | @Mapper |
| | | public interface BaMapCoordinatesMapper extends BaseMapper<BaMapCoordinates> { |
| | | int deleteByPrimaryKey(Long id); |
| | | |
| | | int insert(BaMapCoordinates record); |
| | | |
| | | int insertSelective(BaMapCoordinates record); |
| | | |
| | | BaMapCoordinates selectByPrimaryKey(Long id); |
| | | |
| | | int updateByPrimaryKeySelective(BaMapCoordinates record); |
| | | |
| | | int updateByPrimaryKey(BaMapCoordinates record); |
| | | |
| | | /** |
| | | * 根据片区ID删除该片区下的坐标点 |
| | | * @param blockId |
| | | * @return |
| | | */ |
| | | int deleteByBlockId(Long blockId); |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.daoBa; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dy.pipIrrGlobal.pojoBa.BaMapGraph; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-08-13 11:26 |
| | | * @LastEditTime 2024-08-13 11:26 |
| | | * @Description |
| | | */ |
| | | |
| | | @Mapper |
| | | public interface BaMapGraphMapper extends BaseMapper<BaMapGraph>{ |
| | | int deleteByPrimaryKey(Long id); |
| | | |
| | | int insert(BaMapGraph record); |
| | | |
| | | int insertSelective(BaMapGraph record); |
| | | |
| | | BaMapGraph selectByPrimaryKey(Long id); |
| | | |
| | | int updateByPrimaryKeySelective(BaMapGraph record); |
| | | |
| | | int updateByPrimaryKey(BaMapGraph record); |
| | | |
| | | /** |
| | | * 根据片区ID删除地图图形 |
| | | * @param blockId |
| | | * @return |
| | | */ |
| | | int deleteByBlockId(Long blockId); |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.pojoBa; |
| | | |
| | | import com.alibaba.fastjson2.annotation.JSONField; |
| | | import com.alibaba.fastjson2.writer.ObjectWriterImplToString; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.dy.common.po.BaseEntity; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-08-13 11:33 |
| | | * @LastEditTime 2024-08-13 11:33 |
| | | * @Description |
| | | */ |
| | | /** |
| | | * 地图图形坐标 |
| | | */ |
| | | |
| | | @TableName(value="ba_map_coordinates", autoResultMap = true) |
| | | @Data |
| | | @Builder |
| | | @ToString |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public class BaMapCoordinates implements BaseEntity { |
| | | public static final long serialVersionUID = 202408131135001L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @TableId(type = IdType.INPUT) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 图形ID |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @NotNull(message = "所属图形不能为空") |
| | | private Long graphId; |
| | | |
| | | /** |
| | | * 纬度 |
| | | */ |
| | | private BigDecimal lat; |
| | | |
| | | /** |
| | | * 经度 |
| | | */ |
| | | private BigDecimal lng; |
| | | |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.pojoBa; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-08-13 11:26 |
| | | * @LastEditTime 2024-08-13 11:26 |
| | | * @Description |
| | | */ |
| | | |
| | | import com.alibaba.fastjson2.annotation.JSONField; |
| | | import com.alibaba.fastjson2.writer.ObjectWriterImplToString; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.dy.common.po.BaseEntity; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.*; |
| | | |
| | | /** |
| | | * 地图图形表 |
| | | */ |
| | | |
| | | @TableName(value="ba_map_graph", autoResultMap = true) |
| | | @Data |
| | | @Builder |
| | | @ToString |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public class BaMapGraph implements BaseEntity { |
| | | public static final long serialVersionUID = 202408131130001L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @TableId(type = IdType.INPUT) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 片区ID |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @NotNull(message = "所属片区不能为空") |
| | | private Long blockId; |
| | | |
| | | /** |
| | | * 图形类型;1-CircleMarker ,2-Polygon ,3-Polyline |
| | | */ |
| | | @NotNull(message = "图形类型不能为空") |
| | | private Byte graphType; |
| | | |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.voBa; |
| | | |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.alibaba.fastjson2.annotation.JSONField; |
| | | import com.alibaba.fastjson2.writer.ObjectWriterImplToString; |
| | | import com.fasterxml.jackson.annotation.JsonPropertyOrder; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-08-14 16:05 |
| | | * @LastEditTime 2024-08-14 16:05 |
| | | * @Description 片区视图对象 |
| | | */ |
| | | |
| | | @Data |
| | | @JsonPropertyOrder({"id","name","header","phone","area","color","remark","deleted"}) |
| | | public class VoBlock { |
| | | private static final long serialVersionUID = 202408141606001L; |
| | | |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | private Long id; |
| | | |
| | | private String name; |
| | | |
| | | private String header; |
| | | |
| | | private String phone; |
| | | |
| | | private Integer area; |
| | | |
| | | private String color; |
| | | |
| | | private String remark; |
| | | |
| | | private Integer deleted; |
| | | |
| | | private JSONArray graphs; |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.voBa; |
| | | |
| | | import com.alibaba.fastjson2.annotation.JSONField; |
| | | import com.alibaba.fastjson2.writer.ObjectWriterImplToString; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-08-14 19:37 |
| | | * @LastEditTime 2024-08-14 19:37 |
| | | * @Description 地图图形坐标视图对象 |
| | | */ |
| | | |
| | | @Data |
| | | public class VoMapCoordinates { |
| | | private static final long serialVersionUID = 202408141938001L; |
| | | |
| | | /** |
| | | * 纬度 |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | private BigDecimal lat; |
| | | |
| | | /** |
| | | * 经度 |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | private BigDecimal lng; |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.voBa; |
| | | |
| | | import com.alibaba.fastjson2.annotation.JSONField; |
| | | import com.alibaba.fastjson2.writer.ObjectWriterImplToString; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-08-14 16:56 |
| | | * @LastEditTime 2024-08-14 16:56 |
| | | * @Description 地图图形视图对象 |
| | | */ |
| | | |
| | | @Data |
| | | public class VoMapGraph { |
| | | private static final long serialVersionUID = 202408141657001L; |
| | | |
| | | /** |
| | | * 地图图形ID |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | private Long graphId; |
| | | |
| | | /** |
| | | * 地图图形类型 |
| | | */ |
| | | private String type; |
| | | } |
| | |
| | | <?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.BaBlockMapper"> |
| | | <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoBa.BaBlock"> |
| | | <!--@mbg.generated--> |
| | | <!--@Table ba_block--> |
| | | <id column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="name" jdbcType="VARCHAR" property="name" /> |
| | | <result column="header" jdbcType="VARCHAR" property="header" /> |
| | | <result column="phone" jdbcType="VARCHAR" property="phone" /> |
| | | <result column="area" jdbcType="INTEGER" property="area" /> |
| | | <result column="color" jdbcType="VARCHAR" property="color" /> |
| | | <result column="remark" jdbcType="VARCHAR" property="remark" /> |
| | | <result property="deleted" column="deleted" typeHandler="com.dy.common.mybatis.envm.EnumCodeTypeHandler" javaType="com.dy.common.mybatis.envm.Deleted"/> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, `name`, `header`, phone, area, color, remark, deleted |
| | | </sql> |
| | | <sql id="part_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, `name` |
| | | </sql> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | | <!--@mbg.generated--> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from ba_block |
| | | where id = #{id,jdbcType=BIGINT} and deleted = 0 |
| | | </select> |
| | | |
| | | <select id="selectAll" resultMap="BaseResultMap"> |
| | | select |
| | | <!-- <include refid="part_Column_List" />--> |
| | | <include refid="Base_Column_List" /> |
| | | from ba_block |
| | | WHERE deleted = 0 |
| | | </select> |
| | | |
| | | <select id="selectTotal" parameterType="java.util.Map" resultType="java.lang.Long"> |
| | | select |
| | | count(*) |
| | | from ba_block |
| | | <trim prefix="where " suffixOverrides="and"> |
| | | <if test="name != null and name != ''"> |
| | | name like concat('%', #{name}, '%') and |
| | | </if> |
| | | <if test="header != null and header != ''"> |
| | | header like concat('%', #{header}, '%') and |
| | | </if> |
| | | <if test="phone != null and phone != ''"> |
| | | phone = #{phone,jdbcType=VARCHAR} and |
| | | </if> |
| | | <if test="area != null"> |
| | | area = #{area,jdbcType=INTEGER} and |
| | | </if> |
| | | </trim> |
| | | </select> |
| | | <select id="selectSome" parameterType="java.util.Map" resultMap="BaseResultMap"> |
| | | <!--@mbg.generated--> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from ba_block |
| | | <trim prefix="where " suffixOverrides="and"> |
| | | deleted = 0 and |
| | | <if test="name != null and name != ''"> |
| | | name like concat('%', #{name}, '%') and |
| | | </if> |
| | | <if test="header != null and header != ''"> |
| | | header = #{header,jdbcType=VARCHAR} and |
| | | </if> |
| | | <if test="phone != null and phone != ''"> |
| | | phone = #{phone,jdbcType=VARCHAR} and |
| | | </if> |
| | | <if test="area != null"> |
| | | area = #{area,jdbcType=INTEGER} and |
| | | </if> |
| | | </trim> |
| | | order by id DESC |
| | | <trim prefix="limit " > |
| | | <if test="start != null and count != null"> |
| | | #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} |
| | | </if> |
| | | </trim> |
| | | </select> |
| | | |
| | | <insert id="putin" parameterType="com.dy.pipIrrGlobal.pojoBa.BaBlock"> |
| | | <!--@mbg.generated--> |
| | | insert into ba_block (id, `name`, `header`, phone, area, color, remark, deleted) |
| | | values (#{id,jdbcType=BIGINT}, |
| | | #{name,jdbcType=VARCHAR}, |
| | | #{header,jdbcType=VARCHAR}, |
| | | #{phone,jdbcType=VARCHAR}, |
| | | #{area,jdbcType=INTEGER}, |
| | | #{color,jdbcType=VARCHAR}, |
| | | #{remark,jdbcType=VARCHAR}, |
| | | #{deleted,typeHandler=com.dy.common.mybatis.envm.EnumCodeTypeHandler, jdbcType=TINYINT}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoBa.BaBlock"> |
| | | <!--@mbg.generated--> |
| | | insert into ba_block |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoBa.BaBlock"> |
| | | <!--@mbg.generated--> |
| | | <!--@Table ba_block--> |
| | | <id column="id" jdbcType="BIGINT" property="id"/> |
| | | <result column="name" jdbcType="VARCHAR" property="name"/> |
| | | <result column="header" jdbcType="VARCHAR" property="header"/> |
| | | <result column="phone" jdbcType="VARCHAR" property="phone"/> |
| | | <result column="area" jdbcType="INTEGER" property="area"/> |
| | | <result column="color" jdbcType="VARCHAR" property="color"/> |
| | | <result column="remark" jdbcType="VARCHAR" property="remark"/> |
| | | <result property="deleted" column="deleted" typeHandler="com.dy.common.mybatis.envm.EnumCodeTypeHandler" |
| | | javaType="com.dy.common.mybatis.envm.Deleted"/> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, |
| | | </if> |
| | | <if test="name != null"> |
| | | `name`, |
| | | </if> |
| | | <if test="header != null"> |
| | | `header`, |
| | | </if> |
| | | <if test="phone != null"> |
| | | phone, |
| | | </if> |
| | | <if test="area != null"> |
| | | area, |
| | | </if> |
| | | <if test="color != null"> |
| | | color, |
| | | </if> |
| | | <if test="remark != null"> |
| | | remark, |
| | | </if> |
| | | <if test="deleted != null"> |
| | | deleted, |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | #{id,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="name != null"> |
| | | #{name,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="header != null"> |
| | | #{header,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="phone != null"> |
| | | #{phone,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="area != null"> |
| | | #{area,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="color != null"> |
| | | #{color,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="remark != null"> |
| | | #{remark,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="deleted != null"> |
| | | #{deleted,typeHandler=com.dy.common.mybatis.envm.EnumCodeTypeHandler, jdbcType=TINYINT}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoBa.BaBlock"> |
| | | <!--@mbg.generated--> |
| | | update ba_block |
| | | <set> |
| | | <if test="name != null"> |
| | | `name` = #{name,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="header != null"> |
| | | `header` = #{header,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="phone != null"> |
| | | phone = #{phone,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="area != null"> |
| | | area = #{area,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="color != null"> |
| | | color = #{color,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="remark != null"> |
| | | remark = #{remark,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="deleted != null"> |
| | | deleted = #{deleted,typeHandler=com.dy.common.mybatis.envm.EnumCodeTypeHandler, jdbcType=TINYINT}, |
| | | </if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoBa.BaBlock"> |
| | | <!--@mbg.generated--> |
| | | update ba_block |
| | | set `name` = #{name,jdbcType=VARCHAR}, |
| | | `header` = #{header,jdbcType=VARCHAR}, |
| | | phone = #{phone,jdbcType=VARCHAR}, |
| | | area = #{area,jdbcType=INTEGER}, |
| | | color = #{color,jdbcType=VARCHAR}, |
| | | remark = #{remark,jdbcType=VARCHAR}, |
| | | deleted = #{deleted,typeHandler=com.dy.common.mybatis.envm.EnumCodeTypeHandler, jdbcType=TINYINT} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | deleted |
| | | </sql> |
| | | <sql id="part_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, |
| | | `name` |
| | | </sql> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | | <!--@mbg.generated--> |
| | | select |
| | | <include refid="Base_Column_List"/> |
| | | from ba_block |
| | | where id = #{id,jdbcType=BIGINT} |
| | | and deleted = 0 |
| | | </select> |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> |
| | | <!--@mbg.generated--> |
| | | delete from ba_block |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <delete id="deleteLogicById" parameterType="java.lang.Long"> |
| | | <!--@mbg.generated--> |
| | | update ba_block set deleted = 1 |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <select id="selectAll" resultMap="BaseResultMap"> |
| | | select |
| | | <!-- <include refid="part_Column_List" />--> |
| | | <include refid="Base_Column_List"/> |
| | | from ba_block |
| | | WHERE deleted = 0 |
| | | </select> |
| | | |
| | | <select id="selectTotal" parameterType="java.util.Map" resultType="java.lang.Long"> |
| | | select count(*) |
| | | from ba_block |
| | | <trim prefix="where " suffixOverrides="and"> |
| | | <if test="name != null and name != ''"> |
| | | name like concat('%', #{name}, '%') |
| | | and |
| | | </if> |
| | | <if test="header != null and header != ''"> |
| | | header like concat('%', #{header}, '%') |
| | | and |
| | | </if> |
| | | <if test="phone != null and phone != ''"> |
| | | phone = #{phone,jdbcType=VARCHAR} |
| | | and |
| | | </if> |
| | | <if test="area != null"> |
| | | area = #{area,jdbcType=INTEGER} and |
| | | </if> |
| | | </trim> |
| | | </select> |
| | | <select id="selectSome" parameterType="java.util.Map" resultMap="BaseResultMap"> |
| | | <!--@mbg.generated--> |
| | | select |
| | | <include refid="Base_Column_List"/> |
| | | from ba_block |
| | | <trim prefix="where " suffixOverrides="and"> |
| | | deleted = 0 |
| | | and |
| | | <if test="name != null and name != ''"> |
| | | name like concat('%', #{name}, '%') |
| | | and |
| | | </if> |
| | | <if test="header != null and header != ''"> |
| | | header = #{header,jdbcType=VARCHAR} |
| | | and |
| | | </if> |
| | | <if test="phone != null and phone != ''"> |
| | | phone = #{phone,jdbcType=VARCHAR} |
| | | and |
| | | </if> |
| | | <if test="area != null"> |
| | | area = #{area,jdbcType=INTEGER} and |
| | | </if> |
| | | </trim> |
| | | order by id DESC |
| | | <trim prefix="limit "> |
| | | <if test="start != null and count != null"> |
| | | #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} |
| | | </if> |
| | | </trim> |
| | | </select> |
| | | |
| | | <!--根据指定条件获取片区记录数量--> |
| | | <select id="getBlocksCount" resultType="java.lang.Long"> |
| | | SELECT COUNT(*) AS recordCount |
| | | FROM ba_block |
| | | <where> |
| | | AND deleted = 0 |
| | | <if test="name != null and name != ''"> |
| | | AND name LIKE CONCAT('%', #{name}, '%') |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!--根据指定条件获取片区--> |
| | | <select id="getBlocks" resultType="com.dy.pipIrrGlobal.voBa.VoBlock"> |
| | | SELECT id, |
| | | name, |
| | | header, |
| | | phone, |
| | | area, |
| | | color, |
| | | remark, |
| | | deleted |
| | | FROM ba_block |
| | | <where> |
| | | AND deleted = 0 |
| | | <if test="name != null and name != ''"> |
| | | AND name LIKE CONCAT('%', #{name}, '%') |
| | | </if> |
| | | </where> |
| | | ORDER BY id |
| | | LIMIT #{pageCurr}, #{pageSize} |
| | | <!-- <trim prefix="limit ">--> |
| | | <!-- <if test="start != null and count != null">--> |
| | | <!-- #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER}--> |
| | | <!-- </if>--> |
| | | <!-- </trim>--> |
| | | </select> |
| | | |
| | | <!--根据片区ID获取地图图形列表--> |
| | | <select id="gertMapGraphsByBlockId" resultType="com.dy.pipIrrGlobal.voBa.VoMapGraph"> |
| | | SELECT id AS graphId, |
| | | CASE |
| | | WHEN graph_type = 1 THEN 'CircleMarker' |
| | | WHEN graph_type = 2 THEN 'Polygon' |
| | | WHEN graph_type = 3 THEN 'Polyline' |
| | | END AS type |
| | | FROM ba_map_graph |
| | | WHERE block_id = #{blockId} |
| | | </select> |
| | | |
| | | <!--根据地图图形ID获取地图图形坐标列表--> |
| | | <select id="getCoordinatesByGraphId" resultType="com.dy.pipIrrGlobal.voBa.VoMapCoordinates"> |
| | | SELECT |
| | | lat,lng |
| | | FROM ba_map_coordinates |
| | | WHERE graph_id = #{graphId} |
| | | </select> |
| | | |
| | | <insert id="putin" parameterType="com.dy.pipIrrGlobal.pojoBa.BaBlock"> |
| | | <!--@mbg.generated--> |
| | | insert into ba_block (id, `name`, `header`, phone, area, color, remark, deleted) |
| | | values (#{id,jdbcType=BIGINT}, |
| | | #{name,jdbcType=VARCHAR}, |
| | | #{header,jdbcType=VARCHAR}, |
| | | #{phone,jdbcType=VARCHAR}, |
| | | #{area,jdbcType=INTEGER}, |
| | | #{color,jdbcType=VARCHAR}, |
| | | #{remark,jdbcType=VARCHAR}, |
| | | #{deleted,typeHandler=com.dy.common.mybatis.envm.EnumCodeTypeHandler, jdbcType=TINYINT}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoBa.BaBlock"> |
| | | <!--@mbg.generated--> |
| | | insert into ba_block |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | id, |
| | | </if> |
| | | <if test="name != null"> |
| | | `name`, |
| | | </if> |
| | | <if test="header != null"> |
| | | `header`, |
| | | </if> |
| | | <if test="phone != null"> |
| | | phone, |
| | | </if> |
| | | <if test="area != null"> |
| | | area, |
| | | </if> |
| | | <if test="color != null"> |
| | | color, |
| | | </if> |
| | | <if test="remark != null"> |
| | | remark, |
| | | </if> |
| | | <if test="deleted != null"> |
| | | deleted, |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | #{id,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="name != null"> |
| | | #{name,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="header != null"> |
| | | #{header,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="phone != null"> |
| | | #{phone,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="area != null"> |
| | | #{area,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="color != null"> |
| | | #{color,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="remark != null"> |
| | | #{remark,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="deleted != null"> |
| | | #{deleted,typeHandler=com.dy.common.mybatis.envm.EnumCodeTypeHandler, jdbcType=TINYINT}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoBa.BaBlock"> |
| | | <!--@mbg.generated--> |
| | | update ba_block |
| | | <set> |
| | | <if test="name != null"> |
| | | `name` = #{name,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="header != null"> |
| | | `header` = #{header,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="phone != null"> |
| | | phone = #{phone,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="area != null"> |
| | | area = #{area,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="color != null"> |
| | | color = #{color,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="remark != null"> |
| | | remark = #{remark,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="deleted != null"> |
| | | deleted = #{deleted,typeHandler=com.dy.common.mybatis.envm.EnumCodeTypeHandler, jdbcType=TINYINT}, |
| | | </if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoBa.BaBlock"> |
| | | <!--@mbg.generated--> |
| | | update ba_block |
| | | set `name` = #{name,jdbcType=VARCHAR}, |
| | | `header` = #{header,jdbcType=VARCHAR}, |
| | | phone = #{phone,jdbcType=VARCHAR}, |
| | | area = #{area,jdbcType=INTEGER}, |
| | | color = #{color,jdbcType=VARCHAR}, |
| | | remark = #{remark,jdbcType=VARCHAR}, |
| | | deleted = #{deleted,typeHandler=com.dy.common.mybatis.envm.EnumCodeTypeHandler, jdbcType=TINYINT} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> |
| | | <!--@mbg.generated--> |
| | | delete |
| | | from ba_block |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <delete id="deleteLogicById" parameterType="java.lang.Long"> |
| | | <!--@mbg.generated--> |
| | | update ba_block |
| | | set deleted = 1 |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | </mapper> |
New file |
| | |
| | | <?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"> |
| | | 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> |
New file |
| | |
| | | <?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"> |
| | | 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> |
| | |
| | | package com.dy.pipIrrBase.block; |
| | | |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.aop.SsoAop; |
| | | import com.dy.common.mybatis.envm.Deleted; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.common.webUtil.ResultCodeMsg; |
| | | import com.dy.pipIrrBase.block.dto.Block; |
| | | import com.dy.pipIrrBase.block.enums.graphTypeENUM; |
| | | import com.dy.pipIrrBase.result.SystemResultCode; |
| | | import com.dy.pipIrrGlobal.pojoBa.BaBlock; |
| | | import com.dy.pipIrrGlobal.pojoBa.BaMapCoordinates; |
| | | import com.dy.pipIrrGlobal.pojoBa.BaMapGraph; |
| | | import com.dy.pipIrrGlobal.voBa.VoBlock; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.media.Content; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.BindingResult; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.Optional; |
| | | |
| | | @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 所有片区数据 |
| | | */ |
| | | @Operation(summary = "获得一页片区", description = "返回一页片区数据") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "返回一页片区数据(BaseResponse.content:QueryResultVo[{}])", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = BaBlock.class))} |
| | | ) |
| | | }) |
| | | @PostMapping(path = "some", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @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()) { |
| | | 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 一个片区数据 |
| | | */ |
| | | @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 是否成功 |
| | | */ |
| | |
| | | ) |
| | | }) |
| | | @PostMapping(path = "save", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> save(@RequestBody @Valid BaBlock po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | //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()) { |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | po.id = null ; |
| | | po.deleted = Deleted.NO; |
| | | int count; |
| | | try { |
| | | count = this.sv.save(po); |
| | | } catch (Exception e) { |
| | | log.error("保存片区异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | |
| | | // 添加片区记录 |
| | | BaBlock baBlock = new BaBlock(); |
| | | 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.deleted = Deleted.NO; |
| | | Long blockId = Optional.ofNullable(this.sv.save(baBlock)).orElse(0L); |
| | | if (blockId.equals(0)) { |
| | | return BaseResponseUtils.buildErrorMsg(SystemResultCode.SAVA_BLOCK_ERROR.getMessage()); |
| | | } |
| | | if(count <= 0){ |
| | | return BaseResponseUtils.buildFail("数据库存储失败") ; |
| | | }else{ |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | |
| | | JSONArray graphs = po.getGraphs(); |
| | | for (int i = 0; i < graphs.size(); i++) { |
| | | JSONObject graph = graphs.getJSONObject(i); |
| | | |
| | | // 添加地图图形记录 |
| | | BaMapGraph baMapGraph = new BaMapGraph(); |
| | | baMapGraph.setBlockId(blockId); |
| | | switch (graph.getString("type")) { |
| | | case "CircleMarker": |
| | | baMapGraph.setGraphType(graphTypeENUM.CIRCLE_MARKER.getCode()); |
| | | break; |
| | | case "Polygon": |
| | | baMapGraph.setGraphType(graphTypeENUM.POLYGON.getCode()); |
| | | break; |
| | | case "Polyline": |
| | | baMapGraph.setGraphType(graphTypeENUM.POLYLINE.getCode()); |
| | | break; |
| | | } |
| | | Long graphId = Optional.ofNullable(this.sv.addMapGraph(baMapGraph)).orElse(0L); |
| | | if (graphId.equals(0)) { |
| | | return BaseResponseUtils.buildErrorMsg(SystemResultCode.SAVA_BLOCK_ERROR.getMessage()); |
| | | } |
| | | |
| | | // 添加地图图形坐标记录 |
| | | JSONArray coordinates = graph.getJSONArray("coordinates"); |
| | | for (int j = 0; j < coordinates.size(); j++) { |
| | | JSONArray coordinate = coordinates.getJSONArray(j); |
| | | for (int k = 0; k < coordinate.size(); k++) { |
| | | JSONObject point = coordinate.getJSONObject(k); |
| | | |
| | | BaMapCoordinates mapCoordinates = new BaMapCoordinates(); |
| | | mapCoordinates.setGraphId(graphId); |
| | | mapCoordinates.setLat(point.getBigDecimal("lat")); |
| | | mapCoordinates.setLng(point.getBigDecimal("lng")); |
| | | Long coordinateId = Optional.ofNullable(this.sv.addMapCoordinate(mapCoordinates)).orElse(0L); |
| | | if (coordinateId.equals(0)) { |
| | | return BaseResponseUtils.buildErrorMsg(SystemResultCode.SAVA_BLOCK_ERROR.getMessage()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return BaseResponseUtils.buildSuccess(true); |
| | | |
| | | //po.id = null ; |
| | | //po.deleted = Deleted.NO; |
| | | //int count; |
| | | //try { |
| | | // count = this.sv.save(po); |
| | | //} catch (Exception e) { |
| | | // log.error("保存片区异常", e); |
| | | // return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | //} |
| | | //if(count <= 0){ |
| | | // return BaseResponseUtils.buildFail("数据库存储失败") ; |
| | | //}else{ |
| | | // return BaseResponseUtils.buildSuccess(true) ; |
| | | //} |
| | | } |
| | | |
| | | /** |
| | | * 编辑修改片区 |
| | | * 编辑修改片区 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) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @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.deleteMapCoordinates(blockId); |
| | | // 删除片区关联的地图图形 |
| | | this.sv.deleteMapGraph(blockId); |
| | | |
| | | JSONArray graphs = po.getGraphs(); |
| | | for (int i = 0; i < graphs.size(); i++) { |
| | | JSONObject graph = graphs.getJSONObject(i); |
| | | |
| | | // 添加地图图形记录 |
| | | BaMapGraph baMapGraph = new BaMapGraph(); |
| | | baMapGraph.setBlockId(blockId); |
| | | switch (graph.getString("type")) { |
| | | case "CircleMarker": |
| | | baMapGraph.setGraphType(graphTypeENUM.CIRCLE_MARKER.getCode()); |
| | | break; |
| | | case "Polygon": |
| | | baMapGraph.setGraphType(graphTypeENUM.POLYGON.getCode()); |
| | | break; |
| | | case "Polyline": |
| | | baMapGraph.setGraphType(graphTypeENUM.POLYLINE.getCode()); |
| | | break; |
| | | } |
| | | Long graphId = Optional.ofNullable(this.sv.addMapGraph(baMapGraph)).orElse(0L); |
| | | if (graphId.equals(0)) { |
| | | return BaseResponseUtils.buildErrorMsg(SystemResultCode.SAVA_BLOCK_ERROR.getMessage()); |
| | | } |
| | | |
| | | // 添加地图图形坐标记录 |
| | | JSONArray coordinates = graph.getJSONArray("coordinates"); |
| | | for (int j = 0; j < coordinates.size(); j++) { |
| | | JSONArray coordinate = coordinates.getJSONArray(j); |
| | | for (int k = 0; k < coordinate.size(); k++) { |
| | | JSONObject point = coordinate.getJSONObject(k); |
| | | |
| | | BaMapCoordinates mapCoordinates = new BaMapCoordinates(); |
| | | mapCoordinates.setGraphId(graphId); |
| | | mapCoordinates.setLat(point.getBigDecimal("lat")); |
| | | mapCoordinates.setLng(point.getBigDecimal("lng")); |
| | | Long coordinateId = Optional.ofNullable(this.sv.addMapCoordinate(mapCoordinates)).orElse(0L); |
| | | if (coordinateId.equals(0)) { |
| | | return BaseResponseUtils.buildErrorMsg(SystemResultCode.SAVA_BLOCK_ERROR.getMessage()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | return BaseResponseUtils.buildSuccess(true); |
| | | } |
| | | |
| | | /** |
| | | * 删除片区 |
| | | * |
| | | * @param id 片区ID |
| | | * @return 是否成功 |
| | | */ |
| | |
| | | schema = @Schema(implementation = Boolean.class))} |
| | | ) |
| | | }) |
| | | |
| | | //@GetMapping(path = "delete", consumes = MediaType.TEXT_PLAIN_VALUE) |
| | | @GetMapping(path = "delete") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @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.deleteMapCoordinates(id); |
| | | // 删除片区关联的地图图形 |
| | | this.sv.deleteMapGraph(id); |
| | | |
| | | return BaseResponseUtils.buildSuccess(true); |
| | | } |
| | | } |
| | |
| | | package com.dy.pipIrrBase.block; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.pipIrrGlobal.daoBa.BaBlockMapper; |
| | | import com.dy.pipIrrGlobal.daoBa.BaMapCoordinatesMapper; |
| | | import com.dy.pipIrrGlobal.daoBa.BaMapGraphMapper; |
| | | import com.dy.pipIrrGlobal.pojoBa.BaBlock; |
| | | import com.dy.pipIrrGlobal.pojoBa.BaMapCoordinates; |
| | | import com.dy.pipIrrGlobal.pojoBa.BaMapGraph; |
| | | import com.dy.pipIrrGlobal.voBa.VoBlock; |
| | | import com.dy.pipIrrGlobal.voBa.VoMapCoordinates; |
| | | import com.dy.pipIrrGlobal.voBa.VoMapGraph; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.dubbo.common.utils.PojoUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | private void setDao(BaBlockMapper dao){ |
| | | this.dao = dao; |
| | | } |
| | | |
| | | @Autowired |
| | | private BaMapGraphMapper baMapGraphMapper; |
| | | |
| | | @Autowired |
| | | private BaMapCoordinatesMapper baMapCoordinatesMapper; |
| | | |
| | | /** |
| | | * 得到一个片区 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 根据指定条件获取片区,2024-08-14新增,替换原来的片区分页查询 |
| | | * @param vo |
| | | * @return |
| | | */ |
| | | public QueryResultVo<List<VoBlock>> getBlocks(QueryVo vo){ |
| | | vo.setPageCurr((vo.pageCurr -1) * vo.pageSize); |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(vo) ; |
| | | Long itemTotal = this.dao.getBlocksCount(params) ; |
| | | |
| | | JSONArray array_blocks = null; |
| | | JSONArray array_mapGraphs = null; |
| | | |
| | | // 获取片区列表 |
| | | List<VoBlock> list_blocks = this.dao.getBlocks(params); |
| | | if(list_blocks != null && list_blocks.size() > 0) { |
| | | //JSONArray array_blocks = (JSONArray) JSON.toJSON(list_blocks); |
| | | array_blocks = (JSONArray) JSON.toJSON(list_blocks); |
| | | for (int i = 0; i < array_blocks.size(); i++) { |
| | | JSONObject job_block = array_blocks.getJSONObject(i); |
| | | Long blockId = job_block.getLong("id"); |
| | | |
| | | // 根据片区ID获取地图图形列表 |
| | | List<VoMapGraph> list_mapGraphs = this.dao.gertMapGraphsByBlockId(blockId); |
| | | if(list_mapGraphs != null && list_mapGraphs.size() > 0) { |
| | | array_mapGraphs = (JSONArray) JSON.toJSON(list_mapGraphs); |
| | | for (int j = 0; j < array_mapGraphs.size(); j++) { |
| | | JSONObject job_mapGraph = array_mapGraphs.getJSONObject(j); |
| | | job_mapGraph = array_mapGraphs.getJSONObject(j); |
| | | Long graphId = job_mapGraph.getLong("graphId"); |
| | | String graphType = job_mapGraph.getString("type"); |
| | | |
| | | // 根据地图图形ID获取地图图形坐标列表,并添加到地图图形对象中 |
| | | List<VoMapCoordinates> list_mapCoordinates = this.dao.getCoordinatesByGraphId(graphId); |
| | | if(list_mapCoordinates != null && list_mapCoordinates.size() > 0) { |
| | | JSONArray array_mapCoordinates = (JSONArray) JSON.toJSON(list_mapCoordinates); |
| | | |
| | | JSONArray[] arrays = new JSONArray[1]; |
| | | arrays[0] = array_mapCoordinates; |
| | | job_mapGraph.put("coordinates", arrays); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 将地图图形数组添加到片区中 |
| | | if(array_mapGraphs != null && array_mapGraphs.size() > 0) { |
| | | job_block.put("graphs", array_mapGraphs); |
| | | } |
| | | } |
| | | } |
| | | |
| | | QueryResultVo<List<VoBlock>> rsVo = new QueryResultVo<>() ; |
| | | rsVo.pageSize = vo.pageSize ; |
| | | rsVo.pageCurr = vo.pageCurr ; |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | //rsVo.obj = this.dao.getBlocks(params) ; |
| | | rsVo.obj = array_blocks.toList(VoBlock.class); |
| | | |
| | | return rsVo ; |
| | | } |
| | | |
| | | /** |
| | | * 保存实体 |
| | | * @param po 实体 |
| | | * @return 数量 |
| | | */ |
| | | @Transactional |
| | | public int save(BaBlock po){ |
| | | return this.dao.putin(po) ; |
| | | public Long save(BaBlock po){ |
| | | //return this.dao.putin(po) ; |
| | | this.dao.putin(po); |
| | | return po.getId(); |
| | | } |
| | | |
| | | /** |
| | |
| | | return this.dao.deleteLogicById(id) ; |
| | | } |
| | | |
| | | /** |
| | | * 添加地图图形 |
| | | * @param po |
| | | * @return |
| | | */ |
| | | public Long addMapGraph(BaMapGraph po) { |
| | | this.baMapGraphMapper.insert(po); |
| | | return po.getId(); |
| | | } |
| | | |
| | | /** |
| | | * 添加地图图形坐标 |
| | | * @param po |
| | | * @return |
| | | */ |
| | | public Long addMapCoordinate(BaMapCoordinates po) { |
| | | this.baMapCoordinatesMapper.insert(po); |
| | | 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); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrBase.block.dto; |
| | | |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.dy.common.mybatis.envm.Deleted; |
| | | import jakarta.validation.constraints.Max; |
| | | import jakarta.validation.constraints.Min; |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import lombok.Data; |
| | | import org.hibernate.validator.constraints.Length; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-08-13 11:39 |
| | | * @LastEditTime 2024-08-13 11:39 |
| | | * @Description 片区对象 |
| | | */ |
| | | |
| | | @Data |
| | | public class Block { |
| | | public static final long serialVersionUID = 202408131140001L; |
| | | |
| | | /** |
| | | * 片区ID |
| | | */ |
| | | private Long id; |
| | | |
| | | /** |
| | | * 片区名称 |
| | | */ |
| | | @NotBlank(message = "片区名称不能为空") |
| | | private String name; |
| | | |
| | | /** |
| | | * 负责人 |
| | | */ |
| | | @Length(message = "片区负责人姓名不大于{max}字,不小于{min}字", min = 1, max = 25) |
| | | private String header; |
| | | |
| | | /** |
| | | * 负责人电话 |
| | | */ |
| | | @Length(message = "片区负责人手机号必须{max}位数据", min = 11, max = 11) |
| | | private String phone; |
| | | |
| | | /** |
| | | * 种植面积 |
| | | */ |
| | | @Max(message = "片区面积不正确", value = 100000000) |
| | | @Min(message = "片区面积不正确",value = 0) |
| | | private Integer area; |
| | | |
| | | /** |
| | | * 电子地图区域着色 |
| | | */ |
| | | @Length(message = "区域着色长度小于{max}字", min = 0, max = 6) |
| | | private String color; |
| | | |
| | | /** |
| | | * 备注 |
| | | */ |
| | | @Length(message = "备注长度小于{max}字", min = 0, max = 50) |
| | | private String remark; |
| | | |
| | | /** |
| | | * 是否删除: 0表示未删除 1表示删除. |
| | | */ |
| | | private Deleted deleted; |
| | | |
| | | /** |
| | | * 地图图形对象 |
| | | */ |
| | | private JSONArray graphs; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrBase.block.enums; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-08-14 11:17 |
| | | * @LastEditTime 2024-08-14 11:17 |
| | | * @Description 地图图形分类枚举类 |
| | | */ |
| | | |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum graphTypeENUM { |
| | | CIRCLE_MARKER((byte)1, "圆圈标记"), |
| | | POLYGON((byte)2, "多边形"), |
| | | POLYLINE((byte)3, "多段线"); |
| | | |
| | | private final Byte code; |
| | | private final String message; |
| | | } |
| | |
| | | /** |
| | | * 用户 |
| | | */ |
| | | THE_USER_NOT_EXIST(20001, "用户不存在"); |
| | | THE_USER_NOT_EXIST(20001, "用户不存在"), |
| | | |
| | | /** |
| | | * 片区 |
| | | */ |
| | | SAVA_BLOCK_ERROR(30001, "保存片区失败"), |
| | | THE_BLOCK_NOT_EXIST(30002, "片区不存在"); |
| | | |
| | | private final Integer code; |
| | | private final String message; |