pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoMd/MdCropsMapper.java
@@ -1,6 +1,12 @@ package com.dy.pipIrrGlobal.daoMd; import com.dy.pipIrrGlobal.pojoBa.BaDivide; import com.dy.pipIrrGlobal.pojoMd.MdCrops; import com.dy.pipIrrGlobal.voMd.VoCrops; import org.apache.ibatis.annotations.Param; import java.util.List; import java.util.Map; /** * @Author: liurunyu @@ -19,4 +25,27 @@ int updateByPrimaryKeySelective(MdCrops record); int updateByPrimaryKey(MdCrops record); VoCrops selectById(Long id); /** * 查询总数 * @param params 查询条件 * @return 总数 * */ Long selectTotal(Map<?,?> params); /** * 分页查询一些 * @param params 查询条件 * @return 实体集合 * */ List<VoCrops> selectSome(Map<?,?> params); /** * 根据id逻辑删除 * @param id * @return */ Integer deleteById(@Param("id") Long id); } pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoMd/MdParamMapper.java
@@ -1,6 +1,11 @@ package com.dy.pipIrrGlobal.daoMd; import com.dy.pipIrrGlobal.pojoMd.MdParam; import com.dy.pipIrrGlobal.voMd.VoParam; import org.apache.ibatis.annotations.Param; import java.util.List; import java.util.Map; /** * @Author: liurunyu @@ -19,4 +24,20 @@ int updateByPrimaryKeySelective(MdParam record); int updateByPrimaryKey(MdParam record); VoParam selectById(Long id); /** * 分页查询一些 * @return 实体集合 * */ List<VoParam> selectAll(); /** * 根据id删除 * @param id * @return */ Integer deleteByPrimaryKey(@Param("id") Long id); } pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoMd/MdCrops.java
@@ -1,5 +1,17 @@ package com.dy.pipIrrGlobal.pojoMd; 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 com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotEmpty; import lombok.*; import org.hibernate.validator.constraints.Length; import java.util.Date; /** @@ -7,108 +19,71 @@ * @Date: 2025/8/6 10:51 * @Description */ public class MdCrops { @TableName(value="md_crops", autoResultMap = true) @Data @Builder @ToString @NoArgsConstructor @AllArgsConstructor @Schema(name = "作物实体") public class MdCrops implements BaseEntity { public static final long serialVersionUID = 202508061126001L; /** * 主键 */ private Long id; @JSONField(serializeUsing= ObjectWriterImplToString.class) @TableId(type = IdType.INPUT) @Schema(description = "实体id", requiredMode = Schema.RequiredMode.NOT_REQUIRED) public Long id; /** * 作物名称 */ private String name; @Schema(description = "作物名称", requiredMode = Schema.RequiredMode.REQUIRED) @NotEmpty(message = "作物名称不能为空") //不能为空也不能为null @Length(message = "作物名称不大于{max}字,不小于{min}字", min = 1, max = 50) public String name; /** * 计算开始日期(一年生作物是种植时间或出芽时间),如果为空值则为长久计算,格式yyyy-mm-dd */ private Date startDt; @Schema(description = "计算开始日期(一年生作物是种植时间或出芽时间),如果为空值则为长久计算,格式yyyy-mm-dd", requiredMode = Schema.RequiredMode.NOT_REQUIRED) @JsonFormat(pattern = "yyyy-MM-dd") public Date startDt; /** * 计算截止日期(一年生作物是停止灌溉时间),如果为空值则为长久计算,格式yyyy-mm-dd */ private Date endDt; @Schema(description = "计算截止日期(一年生作物是停止灌溉时间),如果为空值则为长久计算,格式yyyy-mm-dd", requiredMode = Schema.RequiredMode.NOT_REQUIRED) @JsonFormat(pattern = "yyyy-MM-dd") public Date endDt; /** * 是否停止计算,1是,0否 */ private Byte stopped; @Schema(description = "停止计算标识", requiredMode = Schema.RequiredMode.NOT_REQUIRED) public Byte stopped; /** * 备注 */ private String remarks; @Schema(description = "备注", requiredMode = Schema.RequiredMode.NOT_REQUIRED) @Length(message = "备注不大于{max}字,不小于{min}字", min = 1, max = 100) public String remarks; /** * 数据记录创建日期,格式yyyy-mm-dd hh:mm:ss */ private Date createDt; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") public Date createDt; /** * 是否删除,1是,0否 * 是否删除: 0表示未删除 1表示删除. */ private Byte deleted; @Schema(description = "作物删除标志,表单不用填写", requiredMode = Schema.RequiredMode.NOT_REQUIRED) public Byte deleted; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Date getStartDt() { return startDt; } public void setStartDt(Date startDt) { this.startDt = startDt; } public Date getEndDt() { return endDt; } public void setEndDt(Date endDt) { this.endDt = endDt; } public Byte getStopped() { return stopped; } public void setStopped(Byte stopped) { this.stopped = stopped; } public String getRemarks() { return remarks; } public void setRemarks(String remarks) { this.remarks = remarks; } public Date getCreateDt() { return createDt; } public void setCreateDt(Date createDt) { this.createDt = createDt; } public Byte getDeleted() { return deleted; } public void setDeleted(Byte deleted) { this.deleted = deleted; } } pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoMd/MdParam.java
@@ -1,70 +1,60 @@ package com.dy.pipIrrGlobal.pojoMd; 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 io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotEmpty; import lombok.*; import org.hibernate.validator.constraints.Length; /** * @Author: liurunyu * @Date: 2025/8/6 10:51 * @Description */ @TableName(value="md_param", autoResultMap = true) @Data @Builder @ToString @NoArgsConstructor @AllArgsConstructor @Schema(name = "作物计算参数") public class MdParam { /** * 主键 */ private Long id; @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED) @JSONField(serializeUsing= ObjectWriterImplToString.class) @TableId(type = IdType.INPUT) public Long id; private Long cropsId; @Schema(description = "作物实体外键", requiredMode = Schema.RequiredMode.NOT_REQUIRED) @JSONField(serializeUsing= ObjectWriterImplToString.class) public Long cropsId; /** * 参数名称 */ private String name; @Schema(description = "参数名称", requiredMode = Schema.RequiredMode.REQUIRED) @NotEmpty(message = "参数名称不能为空") //不能为空也不能为null @Length(message = "参数名称不大于{max}字,不小于{min}字", min = 1, max = 25) public String name; /** * 参数值 */ private Double value; @Schema(description = "参数值", requiredMode = Schema.RequiredMode.REQUIRED) @NotEmpty(message = "参数值不能为空") //不能为空也不能为null public Double value; /** * 参数含义 */ private String sense; @Schema(description = "参数含义", requiredMode = Schema.RequiredMode.REQUIRED) public String sense; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Long getCropsId() { return cropsId; } public void setCropsId(Long cropsId) { this.cropsId = cropsId; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Double getValue() { return value; } public void setValue(Double value) { this.value = value; } public String getSense() { return sense; } public void setSense(String sense) { this.sense = sense; } } pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voMd/VoCrops.java
New file @@ -0,0 +1,80 @@ package com.dy.pipIrrGlobal.voMd; import com.alibaba.fastjson2.annotation.JSONField; import com.alibaba.fastjson2.writer.ObjectWriterImplToString; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import lombok.Data; import java.io.Serializable; import java.util.Date; /** * @Author: liurunyu * @Date: 2025/8/6 11:24 * @Description */ @Data @JsonPropertyOrder({"id", "name", "startDt", "endDt", "isStopped", "remarks", "createDt"}) public class VoCrops implements Serializable { public static final long serialVersionUID = 202508061124001L; /** * 主键 */ @JSONField(serializeUsing= ObjectWriterImplToString.class) public Long id; /** * 作物名称 */ public String name; /** * 计算开始日期(一年生作物是种植时间或出芽时间),如果为空值则为长久计算,格式yyyy-mm-dd */ @JsonFormat(pattern = "yyyy-MM-dd") public Date startDt; /** * 计算截止日期(一年生作物是停止灌溉时间),如果为空值则为长久计算,格式yyyy-mm-dd */ @JsonFormat(pattern = "yyyy-MM-dd") public Date endDt; /** * 是否停止计算,1是,0否 */ @JSONField(serialize = false) public Byte stopped; /** * 是否停止计算,1是,0否 */ public String isStopped; /** * 备注 */ public String remarks; /** * 数据记录创建日期,格式yyyy-mm-dd hh:mm:ss */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") public Date createDt; public String getIsStopped() { if (this.stopped != null) { if(this.stopped == 0){ return "否"; }else{ return "是"; } } return "" ; } } pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voMd/VoParam.java
New file @@ -0,0 +1,49 @@ package com.dy.pipIrrGlobal.voMd; import com.alibaba.fastjson2.annotation.JSONField; import com.alibaba.fastjson2.writer.ObjectWriterImplToString; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotEmpty; import lombok.Data; import org.hibernate.validator.constraints.Length; import java.io.Serializable; /** * @Author: liurunyu * @Date: 2025/8/6 11:41 * @Description */ @Data @JsonPropertyOrder({"id", "name", "value", "sense"}) public class VoParam implements Serializable { public static final long serialVersionUID = 202508061141001L; /** * 主键 */ @JSONField(serializeUsing= ObjectWriterImplToString.class) public Long id; @JSONField(serializeUsing= ObjectWriterImplToString.class) public Long cropsId; /** * 参数名称 */ public String name; /** * 参数值 */ public Double value; /** * 参数含义 */ public String sense; } pipIrr-platform/pipIrr-global/src/main/resources/mapper/MdCropsMapper.xml
@@ -17,6 +17,10 @@ <!--@mbg.generated--> id, `name`, start_dt, end_dt, stopped, remarks, create_dt, deleted </sql> <sql id="Part_Column_List"> <!--@mbg.generated--> id, `name`, start_dt, end_dt, stopped, remarks, create_dt </sql> <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> <!--@mbg.generated--> select @@ -24,6 +28,15 @@ from md_crops where id = #{id,jdbcType=BIGINT} </select> <select id="selectById" parameterType="java.lang.Long" resultType="com.dy.pipIrrGlobal.voMd.VoCrops"> <!--@mbg.generated--> select <include refid="Base_Column_List" /> from md_crops where id = #{id,jdbcType=BIGINT} </select> <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> <!--@mbg.generated--> delete from md_crops @@ -134,4 +147,50 @@ deleted = #{deleted,jdbcType=TINYINT} where id = #{id,jdbcType=BIGINT} </update> <select id="selectById" parameterType="java.lang.Long" resultType="com.dy.pipIrrGlobal.voMd.VoCrops"> <!--@mbg.generated--> select <include refid="Part_Column_List" /> from md_crops where id = #{id,jdbcType=BIGINT} </select> <select id="selectTotal" parameterType="java.util.Map" resultType="java.lang.Long"> select count(*) from md_crops tb where tb.deleted != 1 <trim prefix="and" suffixOverrides="and"> <if test="name != null and name != ''"> tb.name like concat('%', #{name}, '%') and </if> </trim> </select> <select id="selectSome" parameterType="java.util.Map" resultType="com.dy.pipIrrGlobal.voMd.VoCrops"> select <include refid="Part_Column_List" > <property name="alias" value="bd"/> </include> from md_crops tb where tb.deleted != 1 <trim prefix="and" suffixOverrides="and"> <if test="name != null and name != ''"> tb.name like concat('%', #{name}, '%') and </if> </trim> order by tb.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> <update id="deleteById" parameterType="java.lang.Long"> update md_crops set deleted = 1 where id = #{id,jdbcType=BIGINT} </update> </mapper> pipIrr-platform/pipIrr-global/src/main/resources/mapper/MdParamMapper.xml
@@ -99,4 +99,24 @@ sense = #{sense,jdbcType=VARCHAR} where id = #{id,jdbcType=BIGINT} </update> <select id="selectById" parameterType="java.lang.Long" resultType="com.dy.pipIrrGlobal.voMd.VoParam"> <!--@mbg.generated--> select <include refid="Base_Column_List" /> from md_param where id = #{id,jdbcType=BIGINT} </select> <select id="selectAll" resultType="com.dy.pipIrrGlobal.voMd.VoParam"> select <include refid="Base_Column_List" > <property name="alias" value="bd"/> </include> from md_param tb </select> </mapper> pipIrr-platform/pipIrr-web/pipIrr-web-model/.gitattributes
New file @@ -0,0 +1,2 @@ /mvnw text eol=lf *.cmd text eol=crlf pipIrr-platform/pipIrr-web/pipIrr-web-model/.gitignore
New file @@ -0,0 +1,33 @@ HELP.md target/ .mvn/wrapper/maven-wrapper.jar !**/src/main/**/target/ !**/src/test/**/target/ ### STS ### .apt_generated .classpath .factorypath .project .settings .springBeans .sts4-cache ### IntelliJ IDEA ### .idea *.iws *.iml *.ipr ### NetBeans ### /nbproject/private/ /nbbuild/ /dist/ /nbdist/ /.nb-gradle/ build/ !**/src/main/**/build/ !**/src/test/**/build/ ### VS Code ### .vscode/ pipIrr-platform/pipIrr-web/pipIrr-web-model/.mvn/wrapper/maven-wrapper.properties
New file @@ -0,0 +1,19 @@ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. wrapperVersion=3.3.2 distributionType=only-script distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.11/apache-maven-3.9.11-bin.zip pipIrr-platform/pipIrr-web/pipIrr-web-model/mvnw
New file @@ -0,0 +1,259 @@ #!/bin/sh # ---------------------------------------------------------------------------- # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. # ---------------------------------------------------------------------------- # ---------------------------------------------------------------------------- # Apache Maven Wrapper startup batch script, version 3.3.2 # # Optional ENV vars # ----------------- # JAVA_HOME - location of a JDK home dir, required when download maven via java source # MVNW_REPOURL - repo url base for downloading maven distribution # MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven # MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output # ---------------------------------------------------------------------------- set -euf [ "${MVNW_VERBOSE-}" != debug ] || set -x # OS specific support. native_path() { printf %s\\n "$1"; } case "$(uname)" in CYGWIN* | MINGW*) [ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")" native_path() { cygpath --path --windows "$1"; } ;; esac # set JAVACMD and JAVACCMD set_java_home() { # For Cygwin and MinGW, ensure paths are in Unix format before anything is touched if [ -n "${JAVA_HOME-}" ]; then if [ -x "$JAVA_HOME/jre/sh/java" ]; then # IBM's JDK on AIX uses strange locations for the executables JAVACMD="$JAVA_HOME/jre/sh/java" JAVACCMD="$JAVA_HOME/jre/sh/javac" else JAVACMD="$JAVA_HOME/bin/java" JAVACCMD="$JAVA_HOME/bin/javac" if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2 echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2 return 1 fi fi else JAVACMD="$( 'set' +e 'unset' -f command 2>/dev/null 'command' -v java )" || : JAVACCMD="$( 'set' +e 'unset' -f command 2>/dev/null 'command' -v javac )" || : if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2 return 1 fi fi } # hash string like Java String::hashCode hash_string() { str="${1:-}" h=0 while [ -n "$str" ]; do char="${str%"${str#?}"}" h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296)) str="${str#?}" done printf %x\\n $h } verbose() { :; } [ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; } die() { printf %s\\n "$1" >&2 exit 1 } trim() { # MWRAPPER-139: # Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds. # Needed for removing poorly interpreted newline sequences when running in more # exotic environments such as mingw bash on Windows. printf "%s" "${1}" | tr -d '[:space:]' } # parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties while IFS="=" read -r key value; do case "${key-}" in distributionUrl) distributionUrl=$(trim "${value-}") ;; distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;; esac done <"${0%/*}/.mvn/wrapper/maven-wrapper.properties" [ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in ${0%/*}/.mvn/wrapper/maven-wrapper.properties" case "${distributionUrl##*/}" in maven-mvnd-*bin.*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in *AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;; :Darwin*x86_64) distributionPlatform=darwin-amd64 ;; :Darwin*arm64) distributionPlatform=darwin-aarch64 ;; :Linux*x86_64*) distributionPlatform=linux-amd64 ;; *) echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2 distributionPlatform=linux-amd64 ;; esac distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip" ;; maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;; *) MVN_CMD="mvn${0##*/mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;; esac # apply MVNW_REPOURL and calculate MAVEN_HOME # maven home pattern: ~/.m2/wrapper/dists/{apache-maven-<version>,maven-mvnd-<version>-<platform>}/<hash> [ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}" distributionUrlName="${distributionUrl##*/}" distributionUrlNameMain="${distributionUrlName%.*}" distributionUrlNameMain="${distributionUrlNameMain%-bin}" MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}" MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")" exec_maven() { unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || : exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD" } if [ -d "$MAVEN_HOME" ]; then verbose "found existing MAVEN_HOME at $MAVEN_HOME" exec_maven "$@" fi case "${distributionUrl-}" in *?-bin.zip | *?maven-mvnd-?*-?*.zip) ;; *) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;; esac # prepare tmp dir if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; } trap clean HUP INT TERM EXIT else die "cannot create temp dir" fi mkdir -p -- "${MAVEN_HOME%/*}" # Download and Install Apache Maven verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." verbose "Downloading from: $distributionUrl" verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" # select .zip or .tar.gz if ! command -v unzip >/dev/null; then distributionUrl="${distributionUrl%.zip}.tar.gz" distributionUrlName="${distributionUrl##*/}" fi # verbose opt __MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR='' [ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v # normalize http auth case "${MVNW_PASSWORD:+has-password}" in '') MVNW_USERNAME='' MVNW_PASSWORD='' ;; has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;; esac if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then verbose "Found wget ... using wget" wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl" elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then verbose "Found curl ... using curl" curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl" elif set_java_home; then verbose "Falling back to use Java to download" javaSource="$TMP_DOWNLOAD_DIR/Downloader.java" targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName" cat >"$javaSource" <<-END public class Downloader extends java.net.Authenticator { protected java.net.PasswordAuthentication getPasswordAuthentication() { return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() ); } public static void main( String[] args ) throws Exception { setDefault( new Downloader() ); java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() ); } } END # For Cygwin/MinGW, switch paths to Windows format before running javac and java verbose " - Compiling Downloader.java ..." "$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java" verbose " - Running Downloader.java ..." "$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")" fi # If specified, validate the SHA-256 sum of the Maven distribution zip file if [ -n "${distributionSha256Sum-}" ]; then distributionSha256Result=false if [ "$MVN_CMD" = mvnd.sh ]; then echo "Checksum validation is not supported for maven-mvnd." >&2 echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 exit 1 elif command -v sha256sum >/dev/null; then if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c >/dev/null 2>&1; then distributionSha256Result=true fi elif command -v shasum >/dev/null; then if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then distributionSha256Result=true fi else echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2 echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 exit 1 fi if [ $distributionSha256Result = false ]; then echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2 echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2 exit 1 fi fi # unzip and move if command -v unzip >/dev/null; then unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip" else tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar" fi printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/mvnw.url" mv -- "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME" clean || : exec_maven "$@" pipIrr-platform/pipIrr-web/pipIrr-web-model/mvnw.cmd
New file @@ -0,0 +1,149 @@ <# : batch portion @REM ---------------------------------------------------------------------------- @REM Licensed to the Apache Software Foundation (ASF) under one @REM or more contributor license agreements. See the NOTICE file @REM distributed with this work for additional information @REM regarding copyright ownership. The ASF licenses this file @REM to you under the Apache License, Version 2.0 (the @REM "License"); you may not use this file except in compliance @REM with the License. You may obtain a copy of the License at @REM @REM http://www.apache.org/licenses/LICENSE-2.0 @REM @REM Unless required by applicable law or agreed to in writing, @REM software distributed under the License is distributed on an @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @REM KIND, either express or implied. See the License for the @REM specific language governing permissions and limitations @REM under the License. @REM ---------------------------------------------------------------------------- @REM ---------------------------------------------------------------------------- @REM Apache Maven Wrapper startup batch script, version 3.3.2 @REM @REM Optional ENV vars @REM MVNW_REPOURL - repo url base for downloading maven distribution @REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven @REM MVNW_VERBOSE - true: enable verbose log; others: silence the output @REM ---------------------------------------------------------------------------- @IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0) @SET __MVNW_CMD__= @SET __MVNW_ERROR__= @SET __MVNW_PSMODULEP_SAVE=%PSModulePath% @SET PSModulePath= @FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @( IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B) ) @SET PSModulePath=%__MVNW_PSMODULEP_SAVE% @SET __MVNW_PSMODULEP_SAVE= @SET __MVNW_ARG0_NAME__= @SET MVNW_USERNAME= @SET MVNW_PASSWORD= @IF NOT "%__MVNW_CMD__%"=="" (%__MVNW_CMD__% %*) @echo Cannot start maven from wrapper >&2 && exit /b 1 @GOTO :EOF : end batch / begin powershell #> $ErrorActionPreference = "Stop" if ($env:MVNW_VERBOSE -eq "true") { $VerbosePreference = "Continue" } # calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties $distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl if (!$distributionUrl) { Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" } switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) { "maven-mvnd-*" { $USE_MVND = $true $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip" $MVN_CMD = "mvnd.cmd" break } default { $USE_MVND = $false $MVN_CMD = $script -replace '^mvnw','mvn' break } } # apply MVNW_REPOURL and calculate MAVEN_HOME # maven home pattern: ~/.m2/wrapper/dists/{apache-maven-<version>,maven-mvnd-<version>-<platform>}/<hash> if ($env:MVNW_REPOURL) { $MVNW_REPO_PATTERN = if ($USE_MVND) { "/org/apache/maven/" } else { "/maven/mvnd/" } $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace '^.*'+$MVNW_REPO_PATTERN,'')" } $distributionUrlName = $distributionUrl -replace '^.*/','' $distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$','' $MAVEN_HOME_PARENT = "$HOME/.m2/wrapper/dists/$distributionUrlNameMain" if ($env:MAVEN_USER_HOME) { $MAVEN_HOME_PARENT = "$env:MAVEN_USER_HOME/wrapper/dists/$distributionUrlNameMain" } $MAVEN_HOME_NAME = ([System.Security.Cryptography.MD5]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join '' $MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME" if (Test-Path -Path "$MAVEN_HOME" -PathType Container) { Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME" Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" exit $? } if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) { Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl" } # prepare tmp dir $TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile $TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir" $TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null trap { if ($TMP_DOWNLOAD_DIR.Exists) { try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } } } New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null # Download and Install Apache Maven Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." Write-Verbose "Downloading from: $distributionUrl" Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" $webclient = New-Object System.Net.WebClient if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) { $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD) } [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 $webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null # If specified, validate the SHA-256 sum of the Maven distribution zip file $distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum if ($distributionSha256Sum) { if ($USE_MVND) { Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." } Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) { Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property." } } # unzip and move Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null Rename-Item -Path "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" -NewName $MAVEN_HOME_NAME | Out-Null try { Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null } catch { if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) { Write-Error "fail to move MAVEN_HOME" } } finally { try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } } Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" pipIrr-platform/pipIrr-web/pipIrr-web-model/pom.xml
New file @@ -0,0 +1,141 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <artifactId>pipIrr-web</artifactId> <groupId>com.dy</groupId> <version>1.0.0</version> <relativePath>../pom.xml</relativePath> </parent> <packaging>jar</packaging> <artifactId>pipIrr-web-model</artifactId> <name>pipIrr-web-model</name> <description>web灌溉模块系统</description> <dependencies> </dependencies> <build> <plugins> <!-- 生成不包含依赖jar的可执行jar包 <plugin> !- spring boot提供的maven打包插件 - <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <executions> <execution> !- <goals> <goal>repackage</goal> </goals> - <configuration> !- 不加的话最终包名为: ${artifactId}-${version}.jar, 加了的话最终包名: ${artifactId}-${version}-${classifier}.jar - <classifier>execute</classifier> !- 不指定生成路径的话, 默认保存在 ${build.directory} 下 - <outputDirectory>${project.build.directory}/execute</outputDirectory> <finalName>${artifactId}-${version}</finalName> <layout>ZIP</layout> <mainClass>com.dy.pipIrrBase.PipIrrBaseApplication</mainClass> <includes> <include> <groupId>com.dy</groupId> <artifactId>pipIrr-common</artifactId> </include> <include> <groupId>com.dy</groupId> <artifactId>pipIrr-global</artifactId> </include> </includes> <excludes> <exclude> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> </exclude> </excludes> </configuration> </execution> </executions> </plugin> --> <!-- 拷贝依赖的jar包到lib目录--> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <executions> <execution> <configuration> <!-- 不加的话最终包名为: ${artifactId}-${version}.jar, 加了的话最终包名: ${artifactId}-${version}-${classifier}.jar <classifier>execute</classifier> --> <!-- ${project.build.directory}是maven变量,内置的,表示target目录,如果不写,将在根目录下创建/lib --> <outputDirectory>${project.build.directory}/lib</outputDirectory> <!-- excludeTransitive:是否不包含间接依赖包,比如我们依赖A,但是A又依赖了B,我们是否也要把B打进去 默认不打--> <excludeTransitive>false</excludeTransitive> <!-- 复制的jar文件去掉版本信息 --> <stripVersion>false</stripVersion> <finalName>${project.artifactId}-${project.version}</finalName> <layout>ZIP</layout> <mainClass>com.dy.pipIrrModel.PipIrrModelApplication</mainClass> <includes> <include> <groupId>com.dy</groupId> <artifactId>pipIrr-common</artifactId> </include> <include> <groupId>com.dy</groupId> <artifactId>pipIrr-global</artifactId> </include> </includes> <excludes> <exclude> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> </exclude> </excludes> </configuration> </execution> </executions> </plugin> <plugin> <!-- 设置java编译版本,运行环境版本 --> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <!-- source: 源代码编译版本;target: 目标平台编译版本;encoding: 字符集编码。 --> <configuration> <source>${java.version}</source> <target>${java.version}</target> <encoding>${encoding}</encoding> </configuration> </plugin> <plugin> <!-- 解决资源文件的编码问题 --> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> <configuration> <encoding>${encoding}</encoding> </configuration> </plugin> <plugin> <!-- maven里执行测试用例的插件 --> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <skipTests>true</skipTests> </configuration> </plugin> <plugin> <!-- 下面解决:当进行Maven Lifecycle package时报错:Could not find artifact org.apache.mina:mina-core:bundle:2.2.1 in maven (https://repo1.maven.org/maven2/)--> <groupId>org.apache.felix</groupId> <artifactId>maven-bundle-plugin</artifactId> <extensions>true</extensions> </plugin> </plugins> </build> </project> pipIrr-platform/pipIrr-web/pipIrr-web-model/src/main/java/com/dy/pipIrrModel/PipIrrModelApplication.java
New file @@ -0,0 +1,36 @@ package com.dy.pipIrrModel; import com.dy.common.multiDataSource.EnableMultiDataSource; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.context.annotation.FilterType; @SpringBootApplication @EnableAspectJAutoProxy @EnableMultiDataSource @ComponentScan(basePackages = {"com.dy.common", "com.dy.pipIrrGlobal", "com.dy.pipIrrModel"}, excludeFilters = { @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = { com.dy.common.singleDataSource.DruidDataSourceConfig.class //排除单数据源 }), @ComponentScan.Filter(type = FilterType.REGEX, pattern = { //以下写正则表达式,需要对目标类的完全限定名完全匹配,否则不生效 "com.dy.pipIrrGlobal.webCtrls..*" }) } ) @MapperScan(basePackages={"com.dy.pipIrrGlobal.daoBa", "com.dy.pipIrrGlobal.daoRm", "com.dy.pipIrrGlobal.daoPr", "com.dy.pipIrrGlobal.daoMd" }) public class PipIrrModelApplication { public static void main(String[] args) { SpringApplication.run(PipIrrModelApplication.class, args); } } pipIrr-platform/pipIrr-web/pipIrr-web-model/src/main/java/com/dy/pipIrrModel/crops/CropsCtrl.java
New file @@ -0,0 +1,191 @@ package com.dy.pipIrrModel.crops; 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.pojoMd.MdCrops; import com.dy.pipIrrGlobal.voMd.VoCrops; import io.swagger.v3.oas.annotations.Operation; 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.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Objects; /** * @Author: liurunyu * @Date: 2025/8/6 11:11 * @Description */ @Slf4j @Tag(name = "作物管理", description = "作物增删改查等操作") @RestController @RequestMapping(path = "mdCrops") public class CropsCtrl { private CropsSv sv; @Autowired private void setSv(CropsSv sv) { this.sv = sv; } /** * 得到一个作物数据 * @return 一个作物数据 */ @Operation(summary = "一个作物", description = "得到一个作物数据") @ApiResponses(value = { @ApiResponse( responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, description = "返回一个作物数据(BaseResponse.content:{})", content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, schema = @Schema(implementation = VoCrops.class))} ) }) @GetMapping(path = "one", consumes = MediaType.TEXT_PLAIN_VALUE) @SsoAop() public BaseResponse<VoCrops> one(Long id){ return BaseResponseUtils.buildSuccess(this.sv.selectById(id)); } /** * 客户端请求得到一些作物数据 * @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 = VoCrops.class))} ) }) @PostMapping(path = "some", consumes = MediaType.APPLICATION_JSON_VALUE) @SsoAop() public BaseResponse<QueryResultVo<List<VoCrops>>> some(@RequestBody CropsQo qo){ try { QueryResultVo<List<VoCrops>> res = this.sv.selectSome(qo) ; return BaseResponseUtils.buildSuccess(res); } catch (Exception e) { log.error("查询作物异常", e); return BaseResponseUtils.buildException(e.getMessage()) ; } } /** * 新增保存作物 * @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 = "save", consumes = MediaType.APPLICATION_JSON_VALUE) @SsoAop() public BaseResponse<Boolean> save(@RequestBody @Valid MdCrops po, BindingResult bindingResult){ if(bindingResult != null && bindingResult.hasErrors()){ return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); } po.id = null ; 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) ; } } /** * 编辑修改作物 * @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) @SsoAop() public BaseResponse<Boolean> update(@RequestBody @Valid MdCrops po, BindingResult bindingResult){ if(bindingResult != null && bindingResult.hasErrors()){ return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); } 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()) ; } if(count <= 0){ return BaseResponseUtils.buildFail("数据库存储失败") ; }else{ return BaseResponseUtils.buildSuccess(true) ; } } /** * 删除作物 * @param id 作物ID * @return 是否成功 */ @Operation(summary = "删除作物", description = "提交作物ID,进行逻辑删除") @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))} ) }) @GetMapping(path = "delete", consumes = MediaType.TEXT_PLAIN_VALUE) @SsoAop() 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()) ; } if(count <= 0){ return BaseResponseUtils.buildFail("数据库存储失败") ; }else{ return BaseResponseUtils.buildSuccess(true) ; } } } pipIrr-platform/pipIrr-web/pipIrr-web-model/src/main/java/com/dy/pipIrrModel/crops/CropsQo.java
New file @@ -0,0 +1,25 @@ package com.dy.pipIrrModel.crops; import com.dy.common.webUtil.QueryConditionVo; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; /** * @Author: liurunyu * @Date: 2025/8/6 11:11 * @Description */ @Data @EqualsAndHashCode(callSuper = false) @ToString(callSuper = true) @NoArgsConstructor @AllArgsConstructor @Builder @Schema(name = "作物查询条件") public class CropsQo extends QueryConditionVo { @Schema(description = "作物名称") public String name; } pipIrr-platform/pipIrr-web/pipIrr-web-model/src/main/java/com/dy/pipIrrModel/crops/CropsSv.java
New file @@ -0,0 +1,84 @@ package com.dy.pipIrrModel.crops; import com.dy.common.webUtil.QueryResultVo; import com.dy.pipIrrGlobal.daoMd.MdCropsMapper; import com.dy.pipIrrGlobal.pojoMd.MdCrops; import com.dy.pipIrrGlobal.voMd.VoCrops; 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: liurunyu * @Date: 2025/8/6 11:11 * @Description */ @Slf4j @Service public class CropsSv { private MdCropsMapper mdCropsDao ; @Autowired private void setDao(MdCropsMapper dao) { this.mdCropsDao = dao; } /** * 得到一个实体 * @param id 实体ID * @return 实体 */ public VoCrops selectById(Long id){ return this.mdCropsDao.selectById(id) ; } /** * 查询一些实体 * @param qo 查询条件值对象 * @return 包含实体集合的结果对象 */ @SuppressWarnings("unchecked") public QueryResultVo<List<VoCrops>> selectSome(CropsQo qo){ Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo) ; Long itemTotal = this.mdCropsDao.selectTotal(params) ; QueryResultVo<List<VoCrops>> rsVo = new QueryResultVo<>() ; rsVo.pageSize = qo.pageSize ; rsVo.pageCurr = qo.pageCurr ; rsVo.calculateAndSet(itemTotal, params); rsVo.obj = this.mdCropsDao.selectSome(params) ; return rsVo ; } /** * 添加实体 * @param po 实体 * @return 实体ID */ public Integer save(MdCrops po){ return mdCropsDao.insert(po); } /** * 修改实体 * @param po * @return */ public int update(MdCrops po) { return mdCropsDao.updateByPrimaryKeySelective(po); } /** * 根据实体ID逻辑删除实体 * @param id 实体 * @return */ public Integer delete(Long id) { return mdCropsDao.deleteById(id); } } pipIrr-platform/pipIrr-web/pipIrr-web-model/src/main/java/com/dy/pipIrrModel/param/ParamCtrl.java
New file @@ -0,0 +1,190 @@ package com.dy.pipIrrModel.param; 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.pojoMd.MdParam; import com.dy.pipIrrGlobal.voMd.VoParam; import io.swagger.v3.oas.annotations.Operation; 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.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Objects; /** * @Author: liurunyu * @Date: 2025/8/6 13:44 * @Description */ @Slf4j @Tag(name = "计算参数管理", description = "计算参数管理") @RestController @RequestMapping(path = "mdParam") public class ParamCtrl { private ParamSv sv; @Autowired private void setSv(ParamSv sv) { this.sv = sv; } /** * 得到一个计算参数数据 * @return 一个计算参数数据 */ @Operation(summary = "一个计算参数", description = "得到一个计算参数数据") @ApiResponses(value = { @ApiResponse( responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, description = "返回一个计算参数数据(BaseResponse.content:{})", content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, schema = @Schema(implementation = VoParam.class))} ) }) @GetMapping(path = "one", consumes = MediaType.TEXT_PLAIN_VALUE) @SsoAop() public BaseResponse<VoParam> one(Long id){ return BaseResponseUtils.buildSuccess(this.sv.selectById(id)); } /** * 客户端请求得到一些计算参数数据 * @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 = VoParam.class))} ) }) @PostMapping(path = "some", consumes = MediaType.APPLICATION_JSON_VALUE) @SsoAop() public BaseResponse<QueryResultVo<List<VoParam>>> all(){ try { QueryResultVo<List<VoParam>> res = this.sv.selectAll() ; return BaseResponseUtils.buildSuccess(res); } catch (Exception e) { log.error("查询计算参数异常", e); return BaseResponseUtils.buildException(e.getMessage()) ; } } /** * 新增保存计算参数 * @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 = "save", consumes = MediaType.APPLICATION_JSON_VALUE) @SsoAop() public BaseResponse<Boolean> save(@RequestBody @Valid MdParam po, BindingResult bindingResult){ if(bindingResult != null && bindingResult.hasErrors()){ return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); } po.id = null ; 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) ; } } /** * 编辑修改计算参数 * @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) @SsoAop() public BaseResponse<Boolean> update(@RequestBody @Valid MdParam po, BindingResult bindingResult){ if(bindingResult != null && bindingResult.hasErrors()){ return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); } 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()) ; } if(count <= 0){ return BaseResponseUtils.buildFail("数据库存储失败") ; }else{ return BaseResponseUtils.buildSuccess(true) ; } } /** * 删除计算参数 * @param id 计算参数ID * @return 是否成功 */ @Operation(summary = "删除计算参数", description = "提交计算参数ID,进行逻辑删除") @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))} ) }) @GetMapping(path = "delete", consumes = MediaType.TEXT_PLAIN_VALUE) @SsoAop() 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()) ; } if(count <= 0){ return BaseResponseUtils.buildFail("数据库存储失败") ; }else{ return BaseResponseUtils.buildSuccess(true) ; } } } pipIrr-platform/pipIrr-web/pipIrr-web-model/src/main/java/com/dy/pipIrrModel/param/ParamSv.java
New file @@ -0,0 +1,73 @@ package com.dy.pipIrrModel.param; import com.dy.common.webUtil.QueryResultVo; import com.dy.pipIrrGlobal.daoMd.MdParamMapper; import com.dy.pipIrrGlobal.pojoMd.MdParam; import com.dy.pipIrrGlobal.voMd.VoParam; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; /** * @Author: liurunyu * @Date: 2025/8/6 13:44 * @Description */ @Slf4j @Service public class ParamSv { private MdParamMapper mdParamDao ; @Autowired private void setDao(MdParamMapper dao) { this.mdParamDao = dao; } /** * 得到一个分水口 * @param id 分水口ID * @return 分水口实体 */ public VoParam selectById(Long id){ return this.mdParamDao.selectById(id) ; } /** * 查询一些实体 * @return 包含实体集合的结果对象 */ @SuppressWarnings("unchecked") public QueryResultVo<List<VoParam>> selectAll(){ QueryResultVo<List<VoParam>> rsVo = new QueryResultVo<>() ; rsVo.obj = this.mdParamDao.selectAll() ; return rsVo ; } /** * 添加实体 * @param po 实体 * @return 实体ID */ public Integer save(MdParam po){ return mdParamDao.insert(po); } /** * 修改实体 * @param po * @return */ public int update(MdParam po) { return mdParamDao.updateByPrimaryKeySelective(po); } /** * 根据实体ID逻辑删除实体 * @param id 实体 * @return */ public Integer delete(Long id) { return mdParamDao.deleteByPrimaryKey(id); } } pipIrr-platform/pipIrr-web/pipIrr-web-model/src/test/java/com/dy/pipIrrModel/PipIrrWebModelApplicationTests.java
New file @@ -0,0 +1,13 @@ package com.dy.pipIrrModel; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class PipIrrWebModelApplicationTests { @Test void contextLoads() { } }