pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrDivideMapper.java
New file @@ -0,0 +1,41 @@ package com.dy.pipIrrGlobal.daoPr; import com.dy.pipIrrGlobal.pojoPr.PrDivide; import com.dy.pipIrrGlobal.voPr.VoDivide; import java.util.List; import java.util.Map; /** * @author ZhuBaoMin * @date 2023/12/21 9:16 * @LastEditTime 2023/12/21 9:16 * @Description */ public interface PrDivideMapper { int deleteByPrimaryKey(Long id); int insert(PrDivide record); int insertSelective(PrDivide record); PrDivide selectByPrimaryKey(Long id); int updateByPrimaryKeySelective(PrDivide record); int updateByPrimaryKey(PrDivide record); /** * 根据指定条件获取分水房记录数 * @param params * @return */ Long getRecordCount(Map<?, ?> params); /** * 根据指定条件获取分水房记录 * @param params * @return */ List<VoDivide> getDivides(Map<?, ?> params); } pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoPr/PrDivide.java
New file @@ -0,0 +1,152 @@ package com.dy.pipIrrGlobal.pojoPr; /** * @author ZhuBaoMin * @date 2023/12/20 20:17 * @LastEditTime 2023/12/20 20:17 * @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 io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; import lombok.*; import org.hibernate.validator.constraints.Length; import java.util.Date; /** * 分水房表 */ @TableName(value="pr_divide", autoResultMap = true) @Data @Builder @ToString @NoArgsConstructor @AllArgsConstructor @Schema(name = "分水房实体") public class PrDivide implements BaseEntity { public static final long serialVersionUID = 1L; /** * 主键 */ @JSONField(serializeUsing= ObjectWriterImplToString.class) @TableId(type = IdType.INPUT) @Schema(description = "实体id", requiredMode = Schema.RequiredMode.NOT_REQUIRED) private Long id; /** * 所在县 */ @JSONField(serializeUsing= ObjectWriterImplToString.class) @Schema(description = "所在县ID", requiredMode = Schema.RequiredMode.REQUIRED) //@NotEmpty(message = "所在县不能为空") private Long countyid; /** * 所在镇 */ @JSONField(serializeUsing= ObjectWriterImplToString.class) @Schema(description = "所在镇ID", requiredMode = Schema.RequiredMode.REQUIRED) //@NotEmpty(message = "所在镇不能为空") private Long townid; /** * 所在村 */ @JSONField(serializeUsing= ObjectWriterImplToString.class) @Schema(description = "所在村ID", requiredMode = Schema.RequiredMode.REQUIRED) //@NotEmpty(message = "所在村不能为空") private Long villageid; /** * 所在片区 */ @JSONField(serializeUsing= ObjectWriterImplToString.class) @Schema(description = "所在片区ID", requiredMode = Schema.RequiredMode.REQUIRED) @NotNull(message = "所在片区不能为空") private Long blockid; /** * 分水口名称或编号 */ @Schema(description = "分水房名称", requiredMode = Schema.RequiredMode.REQUIRED) @NotBlank(message = "分水房名称不能为空") @Length(message = "分水房名称不大于{max}字,不小于{min}字", min = 1, max = 25) private String name; /** * 覆盖村 */ @Schema(description = "覆盖村", requiredMode = Schema.RequiredMode.REQUIRED) @Length(message = "覆盖村不大于{max}字,不小于{min}字", min = 1, max = 100) private String villages; /** * 覆盖面积(平方公里) */ @Schema(description = "覆盖面积", requiredMode = Schema.RequiredMode.REQUIRED) private Double area; /** * 负责人 */ @Schema(description = "负责人", requiredMode = Schema.RequiredMode.REQUIRED) private String header; /** * 联系电话 */ @Schema(description = "联系电话", requiredMode = Schema.RequiredMode.REQUIRED) //@NotBlank(message = "联系电话不能为空") @Length(message = "农联系电话必须{max}位数据", min = 11, max = 11) private String phone; /** * 经度 */ @Schema(description = "经度", requiredMode = Schema.RequiredMode.REQUIRED) @NotNull(message = "经度不能为空") private Double lng; /** * 纬度 */ @Schema(description = "经度", requiredMode = Schema.RequiredMode.REQUIRED) @NotNull(message = "经度不能为空") private Double lat; /** * 备注信息 */ @Schema(description = "备注", requiredMode = Schema.RequiredMode.NOT_REQUIRED) @Length(message = "备注不大于{max}字,不小于{min}字", min = 1, max = 200) private String remarks; /** * 操作人编号 */ @Schema(description = "操作人编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED) @NotNull(message = "操作人编号不能为空") private Long operator; /** * 操作时间 */ @Schema(description = "操作时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) private Date operatedt; /** * 逻辑删除标识;0-未删除,1-删除 */ @Schema(description = "删除标识", requiredMode = Schema.RequiredMode.NOT_REQUIRED) private Byte deleted; } pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoDivide.java
New file @@ -0,0 +1,45 @@ package com.dy.pipIrrGlobal.voPr; import com.dy.common.po.BaseEntity; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; import java.util.Date; /** * @author ZhuBaoMin * @date 2023/12/21 9:28 * @LastEditTime 2023/12/21 9:28 * @Description */ @Data @Schema(title = "分水房视图对象") public class VoDivide implements BaseEntity { private static final long serialVersionUID = 1L; @Schema(title = "ID") private Long id; @Schema(title = "分水房名称") private String divideName; @Schema(title = "所属片区") private String blockName; @Schema(title = "负责人") private String header; @Schema(title = "联系电话") private String phone; @Schema(title = "归属地") private String address; @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @Schema(title = "操作时间") private Date operateDt; } pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrDivideMapper.xml
New file @@ -0,0 +1,287 @@ <?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.daoPr.PrDivideMapper"> <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoPr.PrDivide"> <!--@mbg.generated--> <!--@Table pr_divide--> <id column="id" jdbcType="BIGINT" property="id" /> <result column="countyId" jdbcType="BIGINT" property="countyid" /> <result column="townId" jdbcType="BIGINT" property="townid" /> <result column="villageId" jdbcType="BIGINT" property="villageid" /> <result column="blockId" jdbcType="BIGINT" property="blockid" /> <result column="name" jdbcType="VARCHAR" property="name" /> <result column="villages" jdbcType="VARCHAR" property="villages" /> <result column="area" jdbcType="FLOAT" property="area" /> <result column="header" jdbcType="VARCHAR" property="header" /> <result column="phone" jdbcType="VARCHAR" property="phone" /> <result column="lng" jdbcType="DOUBLE" property="lng" /> <result column="lat" jdbcType="DOUBLE" property="lat" /> <result column="remarks" jdbcType="VARCHAR" property="remarks" /> <result column="operator" jdbcType="BIGINT" property="operator" /> <result column="operateDt" jdbcType="TIMESTAMP" property="operatedt" /> <result column="deleted" jdbcType="TINYINT" property="deleted" /> </resultMap> <sql id="Base_Column_List"> <!--@mbg.generated--> id, countyId, townId, villageId, blockId, `name`, villages, area, `header`, phone, lng, lat, remarks, `operator`, operateDt, deleted </sql> <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> <!--@mbg.generated--> select <include refid="Base_Column_List" /> from pr_divide where id = #{id,jdbcType=BIGINT} </select> <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> <!--@mbg.generated--> delete from pr_divide where id = #{id,jdbcType=BIGINT} </delete> <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoPr.PrDivide"> <!--@mbg.generated--> insert into pr_divide (id, countyId, townId, villageId, blockId, `name`, villages, area, `header`, phone, lng, lat, remarks, `operator`, operateDt, deleted ) values (#{id,jdbcType=BIGINT}, #{countyid,jdbcType=BIGINT}, #{townid,jdbcType=BIGINT}, #{villageid,jdbcType=BIGINT}, #{blockid,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{villages,jdbcType=VARCHAR}, #{area,jdbcType=FLOAT}, #{header,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, #{lng,jdbcType=DOUBLE}, #{lat,jdbcType=DOUBLE}, #{remarks,jdbcType=VARCHAR}, #{operator,jdbcType=BIGINT}, #{operatedt,jdbcType=TIMESTAMP}, #{deleted,jdbcType=TINYINT} ) </insert> <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoPr.PrDivide"> <!--@mbg.generated--> insert into pr_divide <trim prefix="(" suffix=")" suffixOverrides=","> <if test="id != null"> id, </if> <if test="countyid != null"> countyId, </if> <if test="townid != null"> townId, </if> <if test="villageid != null"> villageId, </if> <if test="blockid != null"> blockId, </if> <if test="name != null"> `name`, </if> <if test="villages != null"> villages, </if> <if test="area != null"> area, </if> <if test="header != null"> `header`, </if> <if test="phone != null"> phone, </if> <if test="lng != null"> lng, </if> <if test="lat != null"> lat, </if> <if test="remarks != null"> remarks, </if> <if test="operator != null"> `operator`, </if> <if test="operatedt != null"> operateDt, </if> <if test="deleted != null"> deleted, </if> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="id != null"> #{id,jdbcType=BIGINT}, </if> <if test="countyid != null"> #{countyid,jdbcType=BIGINT}, </if> <if test="townid != null"> #{townid,jdbcType=BIGINT}, </if> <if test="villageid != null"> #{villageid,jdbcType=BIGINT}, </if> <if test="blockid != null"> #{blockid,jdbcType=BIGINT}, </if> <if test="name != null"> #{name,jdbcType=VARCHAR}, </if> <if test="villages != null"> #{villages,jdbcType=VARCHAR}, </if> <if test="area != null"> #{area,jdbcType=FLOAT}, </if> <if test="header != null"> #{header,jdbcType=VARCHAR}, </if> <if test="phone != null"> #{phone,jdbcType=VARCHAR}, </if> <if test="lng != null"> #{lng,jdbcType=DOUBLE}, </if> <if test="lat != null"> #{lat,jdbcType=DOUBLE}, </if> <if test="remarks != null"> #{remarks,jdbcType=VARCHAR}, </if> <if test="operator != null"> #{operator,jdbcType=BIGINT}, </if> <if test="operatedt != null"> #{operatedt,jdbcType=TIMESTAMP}, </if> <if test="deleted != null"> #{deleted,jdbcType=TINYINT}, </if> </trim> </insert> <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoPr.PrDivide"> <!--@mbg.generated--> update pr_divide <set> <if test="countyid != null"> countyId = #{countyid,jdbcType=BIGINT}, </if> <if test="townid != null"> townId = #{townid,jdbcType=BIGINT}, </if> <if test="villageid != null"> villageId = #{villageid,jdbcType=BIGINT}, </if> <if test="blockid != null"> blockId = #{blockid,jdbcType=BIGINT}, </if> <if test="name != null"> `name` = #{name,jdbcType=VARCHAR}, </if> <if test="villages != null"> villages = #{villages,jdbcType=VARCHAR}, </if> <if test="area != null"> area = #{area,jdbcType=FLOAT}, </if> <if test="header != null"> `header` = #{header,jdbcType=VARCHAR}, </if> <if test="phone != null"> phone = #{phone,jdbcType=VARCHAR}, </if> <if test="lng != null"> lng = #{lng,jdbcType=DOUBLE}, </if> <if test="lat != null"> lat = #{lat,jdbcType=DOUBLE}, </if> <if test="remarks != null"> remarks = #{remarks,jdbcType=VARCHAR}, </if> <if test="operator != null"> `operator` = #{operator,jdbcType=BIGINT}, </if> <if test="operatedt != null"> operateDt = #{operatedt,jdbcType=TIMESTAMP}, </if> <if test="deleted != null"> deleted = #{deleted,jdbcType=TINYINT}, </if> </set> where id = #{id,jdbcType=BIGINT} </update> <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoPr.PrDivide"> <!--@mbg.generated--> update pr_divide set countyId = #{countyid,jdbcType=BIGINT}, townId = #{townid,jdbcType=BIGINT}, villageId = #{villageid,jdbcType=BIGINT}, blockId = #{blockid,jdbcType=BIGINT}, `name` = #{name,jdbcType=VARCHAR}, villages = #{villages,jdbcType=VARCHAR}, area = #{area,jdbcType=FLOAT}, `header` = #{header,jdbcType=VARCHAR}, phone = #{phone,jdbcType=VARCHAR}, lng = #{lng,jdbcType=DOUBLE}, lat = #{lat,jdbcType=DOUBLE}, remarks = #{remarks,jdbcType=VARCHAR}, `operator` = #{operator,jdbcType=BIGINT}, operateDt = #{operatedt,jdbcType=TIMESTAMP}, deleted = #{deleted,jdbcType=TINYINT} where id = #{id,jdbcType=BIGINT} </update> <!--根据指定条件获取分水房记录数--> <select id="getRecordCount" parameterType="java.util.Map" resultType="java.lang.Long"> SELECT COUNT(*) AS recordCount FROM pr_divide divi INNER JOIN ba_block blo ON divi.blockId = blo.id INNER JOIN ba_district country ON divi.countyId = country.id INNER JOIN ba_district town ON divi.townId = town.id INNER JOIN ba_district village ON divi.villageid = village.id , (SELECT @i:=0) AS itable <where> <if test = "divideName != null and divideName !=''"> AND divi.name LIKE CONCAT('%',#{divideName},'%') </if> <if test = "blockName != null and blockName !=''"> AND blo.name = #{blockName} </if> </where> </select> <!--根据指定条件获取分水房记录--> <select id="getDivides" resultType="com.dy.pipIrrGlobal.voPr.VoDivide"> SELECT (@i:=@i+1) AS id, divi.name AS divideName, blo.`name` AS blockName, divi.header, divi.phone, CONCAT(country.`name`, town.`name`, village.`name`) AS address, divi.operateDt FROM pr_divide divi INNER JOIN ba_block blo ON divi.blockId = blo.id INNER JOIN ba_district country ON divi.countyId = country.id INNER JOIN ba_district town ON divi.townId = town.id INNER JOIN ba_district village ON divi.villageid = village.id , (SELECT @i:=0) AS itable <where> <if test = "divideName != null and divideName !=''"> AND divi.name LIKE CONCAT('%',#{divideName},'%') </if> <if test = "blockName != null and blockName !=''"> AND blo.name = #{blockName} </if> </where> ORDER BY divi.operateDt DESC <if test="pageCurr != null and pageSize != null"> LIMIT ${pageCurr}, ${pageSize} </if> </select> </mapper> pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/PipIrrProjectApplication.java
@@ -18,7 +18,7 @@ @EnableAspectJAutoProxy @EnableMultiDataSource @ComponentScan(basePackages = {"com.dy.common", "com.dy.pipIrrGlobal", "com.dy.pipIrrProject"}) @MapperScan({"com.dy.pipIrrGlobal.daoSe", "com.dy.pipIrrGlobal.daoBa"}) @MapperScan({"com.dy.pipIrrGlobal.daoPr"}) public class PipIrrProjectApplication { public static void main(String[] args) { pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/config/WebFilterConfiguration.java
New file @@ -0,0 +1,52 @@ package com.dy.pipIrrProject.config; import com.dy.common.webFilter.DevOfDataSourceNameSetFilter; import com.dy.common.webFilter.UserTokenFilter; import jakarta.servlet.Filter; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; /** * @author ZhuBaoMin * @date 2023/12/20 21:17 * @LastEditTime 2023/12/20 21:17 * @Description */ @Configuration public class WebFilterConfiguration { @Value("${pipIrr.global.dev}") public String isDevStage ;//是否为开发阶段 @Value("${pipIrr.global.dsName}") public String dsName ;//开发阶段的数据源名称 /** * DevOfDataSourceNameSetFilter与UserTokenFilter只能一个被配置上, * 所以他们的order都是1 */ private static final int order_UserTokenFilter = 1 ;//与下面 private static final int order_DevOfDataSourceNameSetFilter = 1 ; @Bean public FilterRegistrationBean<? extends Filter> RegFilter() { FilterRegistrationBean<Filter> filterRegistrationBean = new FilterRegistrationBean<>(); if(this.isDevStage != null && !this.isDevStage.trim().equals("") && this.isDevStage.trim().equalsIgnoreCase("true")){ filterRegistrationBean.setFilter(new DevOfDataSourceNameSetFilter()); filterRegistrationBean.addUrlPatterns("/*");//配置过滤规则 filterRegistrationBean.addInitParameter("dataSourceName",dsName);//设置init参数 filterRegistrationBean.setName("DevOfDataSourceNameSetFilter");//设置过滤器名称 filterRegistrationBean.setOrder(order_DevOfDataSourceNameSetFilter);//执行次序 }else{ filterRegistrationBean.setFilter(new UserTokenFilter()); filterRegistrationBean.addUrlPatterns("/*");//配置过滤规则 filterRegistrationBean.setName("UserTokenFilter");//设置过滤器名称 filterRegistrationBean.setOrder(order_UserTokenFilter);//执行次序 } return filterRegistrationBean; } } pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/config/WebListenerConfiguration.java
New file @@ -0,0 +1,68 @@ package com.dy.pipIrrProject.config; import com.dy.common.webListener.GenerateIdSetSuffixListener; import jakarta.servlet.ServletContextListener; import org.springframework.boot.web.servlet.ServletListenerRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; /** * @author ZhuBaoMin * @date 2023/12/5 10:33 * @LastEditTime 2023/12/5 10:33 * @Description */ @Configuration public class WebListenerConfiguration { /** * 启动顺序 */ //private static final int order_config = 0 ; private static final int order_idSetSuffix = 1 ; //private static final int order_init = 2 ; /* * 解析各种***.config配置的ConfigListener,暂时不采用此种配置方式 * @Bean public ConfigListener getGlConfigListener(){ return new ConfigListener() ; } /** * 外部提供Listener * @param listener 外部提供Listener * @return 注册Bean @Bean public ServletListenerRegistrationBean<? extends ServletContextListener> regConfigListener(ConfigListener listener) { ServletListenerRegistrationBean<ConfigListener> listenerRegistrationBean = new ServletListenerRegistrationBean<>(); listenerRegistrationBean.setListener(listener); listenerRegistrationBean.setOrder(order_config); return listenerRegistrationBean; } */ /** * 内部提供listener,该listener在系统启动时,根据配置 设置ID产生器的后缀 * @return 注册Bean */ @Bean public ServletListenerRegistrationBean<? extends ServletContextListener> regSsoListener() { ServletListenerRegistrationBean<GenerateIdSetSuffixListener> listenerRegistrationBean = new ServletListenerRegistrationBean<>(); listenerRegistrationBean.setListener(new GenerateIdSetSuffixListener()); listenerRegistrationBean.setOrder(order_idSetSuffix); return listenerRegistrationBean; } // /** // * 内部提供listener,该listener在系统启动时,初始化数据库数据 // * @return 注册Bean // */ // @Bean // public ServletListenerRegistrationBean<? extends ServletContextListener> regInitListener() { // ServletListenerRegistrationBean<InitListener> listenerRegistrationBean = new ServletListenerRegistrationBean<>(); // listenerRegistrationBean.setListener(new InitListener()); // listenerRegistrationBean.setOrder(order_init); // return listenerRegistrationBean; // } } pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/divide/DivideCtrl.java
New file @@ -0,0 +1,96 @@ package com.dy.pipIrrProject.divide; import com.dy.common.aop.SsoAop; 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.pipIrrGlobal.pojoPr.PrDivide; import com.dy.pipIrrGlobal.voPr.VoDivide; import com.dy.pipIrrGlobal.voSe.VoActiveCard; import com.dy.pipIrrProject.result.ProjectResultCode; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.http.MediaType; import org.springframework.transaction.annotation.Transactional; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.*; import java.time.format.DateTimeFormatter; import java.util.Date; import java.util.List; import java.util.Objects; import java.util.Optional; /** * @author ZhuBaoMin * @date 2023/12/20 20:11 * @LastEditTime 2023/12/20 20:11 * @Description */ @Slf4j @Tag(name = "分水房管理", description = "分水房操作") @RestController @RequestMapping(path="divide") @RequiredArgsConstructor public class DivideCtrl { private final DivideSv divideSv; @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 = VoActiveCard.class))} ) }) @GetMapping(path = "/getDivides", consumes = MediaType.APPLICATION_JSON_VALUE) @SsoAop("-1") public BaseResponse<QueryResultVo<List<VoDivide>>> getDivides(@RequestBody @Parameter(description = "查询form表单json数据", required = true) QueryVo vo){ try { QueryResultVo<List<VoDivide>> res = divideSv.getDivides(vo); return BaseResponseUtils.buildSuccess(res); } catch (Exception e) { log.error("获取开卡记录异常", e); return BaseResponseUtils.buildException(e.getMessage()) ; } } @Operation(summary = "添加分水房记录", description = "添加分水房记录") @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 = "add", consumes = MediaType.APPLICATION_JSON_VALUE) @Transactional(rollbackFor = Exception.class) @SsoAop("-1")//@SsoAop(power = "-1") public BaseResponse<Boolean> add(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid PrDivide po, @Parameter(hidden = true) BindingResult bindingResult){ DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); if(bindingResult != null && bindingResult.hasErrors()){ return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); } Date operateTime = new Date(); po.setOperatedt(operateTime); Integer rec = Optional.ofNullable(divideSv.addDivide(po)).orElse(0); if(rec == 0) { return BaseResponseUtils.buildFail(ProjectResultCode.DIVIDE_FAIL.getMessage()); } return BaseResponseUtils.buildSuccess(true) ; } } pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/divide/DivideSv.java
New file @@ -0,0 +1,54 @@ package com.dy.pipIrrProject.divide; import com.dy.common.webUtil.QueryResultVo; import com.dy.pipIrrGlobal.daoPr.PrDivideMapper; import com.dy.pipIrrGlobal.pojoPr.PrDivide; import com.dy.pipIrrGlobal.voPr.VoDivide; import lombok.extern.slf4j.Slf4j; import org.apache.dubbo.common.utils.PojoUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; import java.util.Map; /** * @author ZhuBaoMin * @date 2023/12/20 20:12 * @LastEditTime 2023/12/20 20:12 * @Description 分水房服务类 */ @Slf4j @Service public class DivideSv { @Autowired private PrDivideMapper prDivideMapper; /** * 添加分水房 * @param po * @return */ Integer addDivide(PrDivide po) { return prDivideMapper.insert(po); } /** * 根据指定条件获取分水房记录 * @param queryVo 查询视图 * @return 分水房记录列表 */ public QueryResultVo<List<VoDivide>> getDivides(QueryVo queryVo) { Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); Long itemTotal = prDivideMapper.getRecordCount(params); QueryResultVo<List<VoDivide>> rsVo = new QueryResultVo<>() ; rsVo.pageSize = queryVo.pageSize ; rsVo.pageCurr = queryVo.pageCurr ; rsVo.calculateAndSet(itemTotal, params); rsVo.obj = prDivideMapper.getDivides(params); return rsVo ; } } pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/divide/QueryVo.java
New file @@ -0,0 +1,27 @@ package com.dy.pipIrrProject.divide; import com.dy.common.webUtil.QueryConditionVo; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; /** * @author ZhuBaoMin * @date 2023/12/21 9:50 * @LastEditTime 2023/12/21 9:50 * @Description */ @Data @EqualsAndHashCode(callSuper = false) @ToString(callSuper = true) @NoArgsConstructor @AllArgsConstructor @Builder @Schema(name = "分水房查询条件") public class QueryVo extends QueryConditionVo { @Schema(description = "农户姓名") public String divideName; @Schema(description = "IC卡号") public String blockName; } pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/result/ProjectResultCode.java
New file @@ -0,0 +1,23 @@ package com.dy.pipIrrProject.result; import lombok.AllArgsConstructor; import lombok.Getter; /** * @author ZhuBaoMin * @date 2023/12/21 10:09 * @LastEditTime 2023/12/21 10:09 * @Description */ @Getter @AllArgsConstructor public enum ProjectResultCode { /** * 分水房 */ DIVIDE_FAIL(10001, "分水房添加失败"); private final Integer code; private final String message; }