From 437713ee567f25c04f094057a1908b6dc54eeefd Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期四, 16 十一月 2023 16:57:29 +0800 Subject: [PATCH] 1、农户类型管理 2、农户管理 --- pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaClientTypeMapper.xml | 12 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaClientTypeMapper.java | 7 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaBlockMapper.java | 54 +- pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/clientType/ClientTypeSv.java | 23 pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaBlockMapper.xml | 8 pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/client/QueryVo.java | 7 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaDistrictMapper.java | 1 pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaDivideMapper.xml | 75 ++- pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaDivideMapper.java | 29 + pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/client/ClientSv.java | 85 ++++ pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/clientType/ClientTypeCtrl.java | 47 +- pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaClientMapper.xml | 423 ++++++++++++++++------- pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaClientMapper.java | 64 +++ pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/client/ClientCtrl.java | 187 ++++++++++ 14 files changed, 775 insertions(+), 247 deletions(-) diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaBlockMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaBlockMapper.java index 40a5e42..0bd9288 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaBlockMapper.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaBlockMapper.java @@ -11,33 +11,6 @@ @Mapper public interface BaBlockMapper extends BaseMapper<BaBlock> { - /** - * delete by primary key - * @param id primaryKey - * @return deleteCount - */ - int deleteByPrimaryKey(Long id); - - /** - * 閫昏緫鍒犻櫎 - * @param id primaryKey - * @return update count - */ - int deleteLogicById(Long id); - - /** - * insert record to table - * @param record the record - * @return insert count - */ - int insert(BaBlock record); - - /** - * insert record to table selective - * @param record the record - * @return insert count - */ - int insertSelective(BaBlock record); /** * select by primary key @@ -62,6 +35,20 @@ List<BaBlock> selectSome(Map<?, ?> params) ; /** + * insert record to table + * @param record the record + * @return insert count + */ + int insert(BaBlock record); + + /** + * insert record to table selective + * @param record the record + * @return insert count + */ + int insertSelective(BaBlock record); + + /** * update record selective * @param record the updated record * @return update count @@ -74,4 +61,17 @@ * @return update count */ int updateByPrimaryKey(BaBlock record); + /** + * 瀹為檯鍒犻櫎 + * @param id primaryKey + * @return deleteCount + */ + int deleteByPrimaryKey(Long id); + + /** + * 閫昏緫鍒犻櫎 + * @param id primaryKey + * @return update count + */ + int deleteLogicById(Long id); } \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaClientMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaClientMapper.java index 604fcd0..4291e92 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaClientMapper.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaClientMapper.java @@ -2,10 +2,43 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.dy.pipIrrGlobal.pojoBa.BaClient; +import com.dy.pipIrrGlobal.pojoBa.BaClientType; import org.apache.ibatis.annotations.Mapper; + +import java.util.List; +import java.util.Map; @Mapper public interface BaClientMapper extends BaseMapper<BaClient> { + + /** + * 閫氳繃ID寰楀埌瀹炰綋 + * @param id 瀹炰綋ID + * @return 瀹炰綋 + */ + BaClient selectByPrimaryKey(Long id) ; + + /** + * 鏌ヨ鏌愮被鍨嬪啘鎴锋�绘暟 + * @param typeId 鍐滄埛绫诲瀷ID + * @return 鎬绘暟 + */ + Long selectCountByType(Long typeId) ; + + /** + * 鏌ヨ鎬绘暟 + * @param params 鏌ヨ鏉′欢 + * @return 鎬绘暟 + */ + Long selectTotal(Map<?, ?> params) ; + + /** + * 鍒嗛〉鏌ヨ涓�浜� + * @param params 鏌ヨ鏉′欢 + * @return 瀹炰綋闆嗗悎 + */ + List<BaClient> selectSome(Map<?, ?> params) ; + /** * insert record to table * @param record the record @@ -19,4 +52,35 @@ * @return insert count */ int insertSelective(BaClient record); + + + /** + * update record selective + * @param record the updated record + * @return update count + */ + int updateByPrimaryKeySelective(BaClient record); + + /** + * update record + * @param record the updated record + * @return update count + */ + int updateByPrimaryKey(BaClient record); + + + /** + * 閫昏緫鍒犻櫎 + * @param id primaryKey + * @return update count + */ + int deleteLogicById(Long id); + + /** + * 瀹為檯鍒犻櫎 + * @param id primaryKey + * @return update count + */ + int deleteByPrimaryKey(Long id); + } \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaClientTypeMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaClientTypeMapper.java index 3235f90..2847f2e 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaClientTypeMapper.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaClientTypeMapper.java @@ -2,7 +2,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.dy.pipIrrGlobal.pojoBa.BaClientType; -import com.dy.pipIrrGlobal.pojoBa.BaRole; import org.apache.ibatis.annotations.Mapper; import java.util.List; @@ -12,8 +11,8 @@ public interface BaClientTypeMapper extends BaseMapper<BaClientType> { /** * 閫氳繃ID寰楀埌绫诲瀷鍚嶇О - * @param id - * @return + * @param id 涓婚敭 + * @return 鍚嶇О */ String selectNameById(Long id) ; @@ -75,7 +74,7 @@ /** * 閫氳繃ID鍒犻櫎 - * @param id + * @param id 涓婚敭 */ void deleteByPrimaryKey(Long id) ; } \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaDistrictMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaDistrictMapper.java index e789212..abfb214 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaDistrictMapper.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaDistrictMapper.java @@ -2,7 +2,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.dy.pipIrrGlobal.pojoBa.BaDistrict; -import com.dy.pipIrrGlobal.pojoBa.BaPrivilege; import org.apache.ibatis.annotations.Mapper; import java.util.List; diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaDivideMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaDivideMapper.java index a0a09d6..b22af31 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaDivideMapper.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaDivideMapper.java @@ -5,12 +5,13 @@ @Mapper public interface BaDivideMapper { + /** - * delete by primary key - * @param id primaryKey - * @return deleteCount + * select by primary key + * @param id primary key + * @return object by primary key */ - int deleteByPrimaryKey(Long id); + BaDivide selectByPrimaryKey(Long id); /** * insert record to table @@ -27,13 +28,6 @@ int insertSelective(BaDivide record); /** - * select by primary key - * @param id primary key - * @return object by primary key - */ - BaDivide selectByPrimaryKey(Long id); - - /** * update record selective * @param record the updated record * @return update count @@ -46,4 +40,17 @@ * @return update count */ int updateByPrimaryKey(BaDivide record); + /** + * 瀹為檯鍒犻櫎 + * @param id primaryKey + * @return deleteCount + */ + int deleteByPrimaryKey(Long id); + /** + * 閫昏緫鍒犻櫎 + * @param id primaryKey + * @return deleteCount + */ + int deleteLogicById(Long id); + } \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaBlockMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaBlockMapper.xml index 46df3bd..28fb02a 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaBlockMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaBlockMapper.xml @@ -27,7 +27,7 @@ select count(*) from ba_block - <trim prefix="where "> + <trim prefix="where " suffixOverrides="and"> <if test="name != null"> name like '%#{name,jdbcType=VARCHAR}%' and </if> @@ -38,7 +38,7 @@ phone = '#{phone,jdbcType=VARCHAR}' and </if> <if test="area != null"> - area = #{area,jdbcType=INTEGER} + area = #{area,jdbcType=INTEGER} and </if> </trim> </select> @@ -47,7 +47,7 @@ select <include refid="Base_Column_List" /> from ba_block - <trim prefix="where "> + <trim prefix="where " suffixOverrides="and"> <if test="name != null"> name like '%#{name,jdbcType=VARCHAR}%' and </if> @@ -58,7 +58,7 @@ phone = '#{phone,jdbcType=VARCHAR}' and </if> <if test="area != null"> - area = #{area,jdbcType=INTEGER} + area = #{area,jdbcType=INTEGER} and </if> </trim> order by id DESC diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaClientMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaClientMapper.xml index c195457..be5f478 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaClientMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaClientMapper.xml @@ -33,132 +33,299 @@ disabled </sql> - <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoBa.BaClient"> - <!--@mbg.generated--> - insert into ba_client (id, countyId, townId, villageId, blockId, divideId, - typeId, `name`, num, phone, - idCard, area, district, address, - remark, disabled, deleted - ) - values (#{id,jdbcType=BIGINT}, #{countyId,jdbcType=BIGINT}, - #{townId,jdbcType=BIGINT}, #{villageId,jdbcType=BIGINT}, - #{blockId,jdbcType=BIGINT}, #{divideId,jdbcType=BIGINT}, #{typeId,jdbcType=BIGINT}, - #{name,jdbcType=VARCHAR}, #{num,jdbcType=INTEGER}, - #{phone,jdbcType=VARCHAR}, #{idcard,jdbcType=VARCHAR}, - #{area,jdbcType=FLOAT}, #{district,jdbcType=VARCHAR}, - #{address,jdbcType=VARCHAR},#{remark,jdbcType=VARCHAR}, - #{disabled,typeHandler=com.dy.common.mybatis.envm.EnumCodeTypeHandler, jdbcType=TINYINT}, - #{deleted,typeHandler=com.dy.common.mybatis.envm.EnumCodeTypeHandler, jdbcType=TINYINT} - ) - </insert> - <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoBa.BaClient"> - <!--@mbg.generated--> - insert into ba_client - <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="divideId != null"> - divideId, - </if> - <if test="blockId != null"> - blockId, - </if> - <if test="typeId != null"> - typeId, - </if> - <if test="name != null"> - `name`, - </if> - <if test="num != null"> - num, - </if> - <if test="phone != null"> - phone, - </if> - <if test="idcard != null"> - idCard, - </if> - <if test="area != null"> - area, - </if> - <if test="district != null"> - district, - </if> - <if test="address != null"> - address, - </if> - <if test="remark != null"> - remark, - </if> - <if test="disabled != null"> - disabled, - </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="divideId != null"> - #{divideId,jdbcType=BIGINT}, - </if> - <if test="blockId != null"> - #{blockId,jdbcType=BIGINT}, - </if> - <if test="typeId != null"> - #{typeId,jdbcType=BIGINT}, - </if> - <if test="name != null"> - #{name,jdbcType=VARCHAR}, - </if> - <if test="num != null"> - #{num,jdbcType=INTEGER}, - </if> - <if test="phone != null"> - #{phone,jdbcType=VARCHAR}, - </if> - <if test="idcard != null"> - #{idcard,jdbcType=VARCHAR}, - </if> - <if test="area != null"> - #{area,jdbcType=FLOAT}, - </if> - <if test="district != null"> - #{district,jdbcType=VARCHAR}, - </if> - <if test="address != null"> - #{address,jdbcType=VARCHAR}, - </if> - <if test="remark != null"> - #{remark,jdbcType=VARCHAR}, - </if> - <if test="disabled != null"> - #{disabled,typeHandler=com.dy.common.mybatis.envm.EnumCodeTypeHandler, jdbcType=TINYINT}, - </if> - <if test="deleted != null"> - #{deleted,typeHandler=com.dy.common.mybatis.envm.EnumCodeTypeHandler, jdbcType=TINYINT}, - </if> - </trim> - </insert> + <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> + <!--@mbg.generated--> + select + <include refid="Base_Column_List" /> + from ba_client + where id = #{id,jdbcType=BIGINT} + </select> + <select id="selectCountByType" parameterType="long" resultType="java.lang.Long"> + select + count(*) + from ba_client + where deleted != 1 and typeId = #{typeId,jdbcType=BIGINT} + </select> + <select id="selectTotal" parameterType="java.util.Map" resultType="java.lang.Long"> + select + count(*) + from ba_client + where deleted != 1 + <trim prefix="and" suffixOverrides="and"> + <if test="countyId != null"> + countyId = #{countyId,jdbcType=BIGINT} and + </if> + <if test="townId != null"> + townId = #{townId,jdbcType=BIGINT} and + </if> + <if test="villageId != null"> + villageId = #{villageId,jdbcType=BIGINT} and + </if> + <if test="blockId != null"> + blockId = #{blockId,jdbcType=BIGINT} and + </if> + <if test="name != null"> + name like '%#{name,jdbcType=VARCHAR}%' and + </if> + <if test="num != null"> + num = '#{num,jdbcType=VARCHAR}' and + </if> + <if test="phone != null"> + phone = '#{phone,jdbcType=VARCHAR}' and + </if> + </trim> + </select> + <select id="selectSome" parameterType="java.util.Map" resultMap="BaseResultMap"> + <!--@mbg.generated--> + select + <include refid="part_Column_List" /> + from ba_client + where deleted != 1 + <trim prefix="and" suffixOverrides="and"> + <if test="countyId != null"> + countyId = #{countyId,jdbcType=BIGINT} and + </if> + <if test="townId != null"> + townId = #{townId,jdbcType=BIGINT} and + </if> + <if test="villageId != null"> + villageId = #{villageId,jdbcType=BIGINT} and + </if> + <if test="blockId != null"> + blockId = #{blockId,jdbcType=BIGINT} and + </if> + <if test="name != null"> + name like '%#{name,jdbcType=VARCHAR}%' and + </if> + <if test="num != null"> + num = '#{num,jdbcType=VARCHAR}' and + </if> + <if test="phone != null"> + phone = '#{phone,jdbcType=VARCHAR}' and + </if> + </trim> + order by id DESC + <trim prefix="limit " > + <if test="start != null and count != null"> + #{start}, #{count} + </if> + </trim> + </select> + <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoBa.BaClient"> + <!--@mbg.generated--> + insert into ba_client (id, countyId, townId, villageId, blockId, divideId, + typeId, `name`, num, phone, + idCard, area, district, address, + remark, disabled, deleted + ) + values (#{id,jdbcType=BIGINT}, #{countyId,jdbcType=BIGINT}, + #{townId,jdbcType=BIGINT}, #{villageId,jdbcType=BIGINT}, + #{blockId,jdbcType=BIGINT}, #{divideId,jdbcType=BIGINT}, #{typeId,jdbcType=BIGINT}, + #{name,jdbcType=VARCHAR}, #{num,jdbcType=INTEGER}, + #{phone,jdbcType=VARCHAR}, #{idcard,jdbcType=VARCHAR}, + #{area,jdbcType=FLOAT}, #{district,jdbcType=VARCHAR}, + #{address,jdbcType=VARCHAR},#{remark,jdbcType=VARCHAR}, + #{disabled,typeHandler=com.dy.common.mybatis.envm.EnumCodeTypeHandler, jdbcType=TINYINT}, + #{deleted,typeHandler=com.dy.common.mybatis.envm.EnumCodeTypeHandler, jdbcType=TINYINT} + ) + </insert> + <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoBa.BaClient"> + <!--@mbg.generated--> + insert into ba_client + <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="divideId != null"> + divideId, + </if> + <if test="blockId != null"> + blockId, + </if> + <if test="typeId != null"> + typeId, + </if> + <if test="name != null"> + `name`, + </if> + <if test="num != null"> + num, + </if> + <if test="phone != null"> + phone, + </if> + <if test="idcard != null"> + idCard, + </if> + <if test="area != null"> + area, + </if> + <if test="district != null"> + district, + </if> + <if test="address != null"> + address, + </if> + <if test="remark != null"> + remark, + </if> + <if test="disabled != null"> + disabled, + </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="divideId != null"> + #{divideId,jdbcType=BIGINT}, + </if> + <if test="blockId != null"> + #{blockId,jdbcType=BIGINT}, + </if> + <if test="typeId != null"> + #{typeId,jdbcType=BIGINT}, + </if> + <if test="name != null"> + #{name,jdbcType=VARCHAR}, + </if> + <if test="num != null"> + #{num,jdbcType=INTEGER}, + </if> + <if test="phone != null"> + #{phone,jdbcType=VARCHAR}, + </if> + <if test="idcard != null"> + #{idcard,jdbcType=VARCHAR}, + </if> + <if test="area != null"> + #{area,jdbcType=FLOAT}, + </if> + <if test="district != null"> + #{district,jdbcType=VARCHAR}, + </if> + <if test="address != null"> + #{address,jdbcType=VARCHAR}, + </if> + <if test="remark != null"> + #{remark,jdbcType=VARCHAR}, + </if> + <if test="disabled != null"> + #{disabled,typeHandler=com.dy.common.mybatis.envm.EnumCodeTypeHandler, jdbcType=TINYINT}, + </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.BaClient"> + update ba_client + <trim prefix="set " suffixOverrides=","> + <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="divideId != null"> + divideId = #{divideId,jdbcType=BIGINT}, + </if> + <if test="blockId != null"> + blockId = #{blockId,jdbcType=BIGINT}, + </if> + <if test="typeId != null"> + typeId = #{typeId,jdbcType=BIGINT}, + </if> + <if test="name != null"> + 'name' = #{name,jdbcType=VARCHAR}, + </if> + <if test="num != null"> + num = #{num,jdbcType=INTEGER}, + </if> + <if test="phone != null"> + phone = #{phone,jdbcType=VARCHAR}, + </if> + <if test="idcard != null"> + idcard = #{idcard,jdbcType=VARCHAR}, + </if> + <if test="area != null"> + area = #{area,jdbcType=FLOAT}, + </if> + <if test="district != null"> + district = #{district,jdbcType=VARCHAR}, + </if> + <if test="address != null"> + address = #{address,jdbcType=VARCHAR}, + </if> + <if test="remark != null"> + remark = #{remark,jdbcType=VARCHAR}, + </if> + <if test="disabled != null"> + disabled = #{disabled,typeHandler=com.dy.common.mybatis.envm.EnumCodeTypeHandler, jdbcType=TINYINT}, + </if> + <if test="deleted != null"> + deleted = #{deleted,typeHandler=com.dy.common.mybatis.envm.EnumCodeTypeHandler, jdbcType=TINYINT}, + </if> + </trim> + where id = #{id,jdbcType=BIGINT} + </update> + + <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoBa.BaClient"> + update ba_client + <trim prefix="set " suffixOverrides=","> + countyId = #{countyId,jdbcType=BIGINT}, + townId = #{townId,jdbcType=BIGINT}, + villageId = #{villageId,jdbcType=BIGINT}, + divideId = #{divideId,jdbcType=BIGINT}, + blockId = #{blockId,jdbcType=BIGINT}, + typeId = #{typeId,jdbcType=BIGINT}, + `name` = #{name,jdbcType=VARCHAR}, + num = #{num,jdbcType=INTEGER}, + phone = #{phone,jdbcType=VARCHAR}, + idcard = #{idcard,jdbcType=VARCHAR}, + area = #{area,jdbcType=FLOAT}, + district = #{district,jdbcType=VARCHAR}, + address = #{address,jdbcType=VARCHAR}, + remark = #{remark,jdbcType=VARCHAR}, + disabled = #{disabled,typeHandler=com.dy.common.mybatis.envm.EnumCodeTypeHandler, jdbcType=TINYINT}, + deleted = #{deleted,typeHandler=com.dy.common.mybatis.envm.EnumCodeTypeHandler, jdbcType=TINYINT}, + </trim> + where id = #{id,jdbcType=BIGINT} + </update> + + <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> + <!--@mbg.generated--> + delete from ba_client + where id = #{id,jdbcType=BIGINT} + </delete> + <delete id="deleteLogicById" parameterType="java.lang.Long"> + <!--@mbg.generated--> + update ba_client set deleted = 1 + where id = #{id,jdbcType=BIGINT} + </delete> + </mapper> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaClientTypeMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaClientTypeMapper.xml index 62336f1..fbc1eb5 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaClientTypeMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaClientTypeMapper.xml @@ -89,18 +89,18 @@ <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoBa.BaClientType"> - update ba_role - <set> + update ba_client_type + <trim prefix="set " suffixOverrides=","> <if test="name != null"> - `name` = #{name,jdbcType=VARCHAR}, + `name` = #{name,jdbcType=VARCHAR} </if> - </set> + </trim> where id = #{id,jdbcType=BIGINT} </update> <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoBa.BaClientType"> - update ba_role - set `name` = #{name,jdbcType=VARCHAR}, + update ba_client_type + set `name` = #{name,jdbcType=VARCHAR} where id = #{id,jdbcType=BIGINT} </update> diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaDivideMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaDivideMapper.xml index ed7f77c..3aecb4f 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaDivideMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaDivideMapper.xml @@ -6,10 +6,10 @@ <!--@Table ba_divide--> <id column="id" jdbcType="BIGINT" property="id" /> <result column="name" jdbcType="VARCHAR" property="name" /> - <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="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="villages" jdbcType="VARCHAR" property="villages" /> <result column="area" jdbcType="FLOAT" property="area" /> <result column="header" jdbcType="VARCHAR" property="header" /> @@ -31,11 +31,6 @@ from ba_divide where id = #{id,jdbcType=BIGINT} </select> - <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> - <!--@mbg.generated--> - delete from ba_divide - where id = #{id,jdbcType=BIGINT} - </delete> <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoBa.BaDivide"> <!--@mbg.generated--> insert into ba_divide (id, `name`, countyId, @@ -43,8 +38,8 @@ villages, area, `header`, phone, lng, lat, remark, deleted) - values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{countyid,jdbcType=BIGINT}, - #{townid,jdbcType=BIGINT}, #{villageid,jdbcType=BIGINT}, #{blockid,jdbcType=BIGINT}, + values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{countyId,jdbcType=BIGINT}, + #{townId,jdbcType=BIGINT}, #{villageId,jdbcType=BIGINT}, #{blockId,jdbcType=BIGINT}, #{villages,jdbcType=VARCHAR}, #{area,jdbcType=FLOAT}, #{header,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, #{lng,jdbcType=DOUBLE}, #{lat,jdbcType=DOUBLE}, #{remark,jdbcType=VARCHAR}, #{deleted,jdbcType=TINYINT}) @@ -59,16 +54,16 @@ <if test="name != null"> `name`, </if> - <if test="countyid != null"> + <if test="countyId != null"> countyId, </if> - <if test="townid != null"> + <if test="townId != null"> townId, </if> - <if test="villageid != null"> + <if test="villageId != null"> villageId, </if> - <if test="blockid != null"> + <if test="blockId != null"> blockId, </if> <if test="villages != null"> @@ -103,17 +98,17 @@ <if test="name != null"> #{name,jdbcType=VARCHAR}, </if> - <if test="countyid != null"> - #{countyid,jdbcType=BIGINT}, + <if test="countyId != null"> + #{countyId,jdbcType=BIGINT}, </if> - <if test="townid != null"> - #{townid,jdbcType=BIGINT}, + <if test="townId != null"> + #{townId,jdbcType=BIGINT}, </if> - <if test="villageid != null"> - #{villageid,jdbcType=BIGINT}, + <if test="villageId != null"> + #{villageId,jdbcType=BIGINT}, </if> - <if test="blockid != null"> - #{blockid,jdbcType=BIGINT}, + <if test="blockId != null"> + #{blockId,jdbcType=BIGINT}, </if> <if test="villages != null"> #{villages,jdbcType=VARCHAR}, @@ -148,17 +143,17 @@ <if test="name != null"> `name` = #{name,jdbcType=VARCHAR}, </if> - <if test="countyid != null"> - countyId = #{countyid,jdbcType=BIGINT}, + <if test="countyId != null"> + countyId = #{countyId,jdbcType=BIGINT}, </if> - <if test="townid != null"> - townId = #{townid,jdbcType=BIGINT}, + <if test="townId != null"> + townId = #{townId,jdbcType=BIGINT}, </if> - <if test="villageid != null"> - villageId = #{villageid,jdbcType=BIGINT}, + <if test="villageId != null"> + villageId = #{villageId,jdbcType=BIGINT}, </if> - <if test="blockid != null"> - blockId = #{blockid,jdbcType=BIGINT}, + <if test="blockId != null"> + blockId = #{blockId,jdbcType=BIGINT}, </if> <if test="villages != null"> villages = #{villages,jdbcType=VARCHAR}, @@ -191,10 +186,10 @@ <!--@mbg.generated--> update ba_divide set `name` = #{name,jdbcType=VARCHAR}, - countyId = #{countyid,jdbcType=BIGINT}, - townId = #{townid,jdbcType=BIGINT}, - villageId = #{villageid,jdbcType=BIGINT}, - blockId = #{blockid,jdbcType=BIGINT}, + countyId = #{countyId,jdbcType=BIGINT}, + townId = #{townId,jdbcType=BIGINT}, + villageId = #{villageId,jdbcType=BIGINT}, + blockId = #{blockId,jdbcType=BIGINT}, villages = #{villages,jdbcType=VARCHAR}, area = #{area,jdbcType=FLOAT}, `header` = #{header,jdbcType=VARCHAR}, @@ -205,4 +200,14 @@ deleted = #{deleted,jdbcType=TINYINT} where id = #{id,jdbcType=BIGINT} </update> + <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> + <!--@mbg.generated--> + delete from ba_divide + where id = #{id,jdbcType=BIGINT} + </delete> + <delete id="deleteLogicById" parameterType="java.lang.Long"> + <!--@mbg.generated--> + update ba_divide set deleted = 1 + where id = #{id,jdbcType=BIGINT} + </delete> </mapper> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/client/ClientCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/client/ClientCtrl.java index e0bb7bd..24d5e8b 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/client/ClientCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/client/ClientCtrl.java @@ -1,4 +1,191 @@ package com.dy.pipIrrBase.client; + +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.pojoBa.BaClient; +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.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; + +@Slf4j +@Tag(name = "鍐滄埛绠$悊", description = "鍐滄埛澧炲垹鏀规煡绛夋搷浣�") +@RestController +@RequestMapping(path="client") +@SuppressWarnings("unchecked")//java鐗堟湰瓒婇珮锛屽娉涘瀷绾︽潫瓒婁弗锛屾墍浠ラ厤缃甋uppressWarnings("unchecked") public class ClientCtrl { + + private ClientSv sv ; + + @Autowired + private void setSv(ClientSv sv){ + this.sv = sv ; + } + + /** + * 瀹㈡埛绔姹傚緱鍒版墍鏈夊啘鎴锋暟鎹� + * @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 = BaClient.class))} + ) + }) + @PostMapping(path = "some", consumes = MediaType.APPLICATION_JSON_VALUE) + @SsoAop("-1") + public BaseResponse<QueryResultVo<List<BaClient>>> some(@RequestBody @Parameter(description = "鏌ヨform琛ㄥ崟json鏁版嵁", required = true) QueryVo vo){ + try { + QueryResultVo<List<BaClient>> res = this.sv.selectSome(vo) ; + return BaseResponseUtils.buildSuccess(res); + } catch (Exception e) { + log.error("鏌ヨ鍐滄埛寮傚父", e); + return BaseResponseUtils.buildException(e.getMessage()) ; + } + } + + /** + * 寰楀埌涓�涓啘鎴锋暟鎹� + * @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 = BaClient.class))} + ) + }) + @GetMapping(path = "one", consumes = MediaType.TEXT_PLAIN_VALUE) + @SsoAop("-1") + public BaseResponse<BaClient> one(@Parameter(description = "瀹炰綋id", required = true) Long id){ + return BaseResponseUtils.buildSuccess(this.sv.selectById(id)); + } + + /** + * 淇濆瓨鍐滄埛 + * @param po 淇濆瓨鍐滄埛form琛ㄥ崟瀵硅薄 + * @return 鏄惁鎴愬姛 + */ + @Operation(summary = "淇濆瓨鍐滄埛", description = "鎻愪氦鍐滄埛鏁版嵁锛坒orm琛ㄥ崟锛夛紝杩涜淇濆瓨") + @ApiResponses(value = { + @ApiResponse( + responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, + description = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝false锛氬け璐ワ紙BaseResponse.content锛�", + content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, + schema = @Schema(implementation = Boolean.class))} + ) + }) + @PostMapping(path = "save", consumes = MediaType.APPLICATION_JSON_VALUE) + @SsoAop("-1")//@SsoAop(power = "-1") + public BaseResponse<Boolean> save(@RequestBody @Parameter(description = "form琛ㄥ崟json鏁版嵁", required = true) @Valid BaClient po, @Parameter(hidden = true) 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 = "鎻愪氦鍐滄埛鏁版嵁锛坒orm琛ㄥ崟锛夛紝杩涜淇敼") + @ApiResponses(value = { + @ApiResponse( + responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, + description = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝false锛氬け璐ワ紙BaseResponse.content锛�", + content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, + schema = @Schema(implementation = Boolean.class))} + ) + }) + @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE) + @SsoAop("-1")//@SsoAop(power = "-1") + public BaseResponse<Boolean> update(@RequestBody @Parameter(description = "form琛ㄥ崟json鏁版嵁", required = true) @Valid BaClient po, @Parameter(hidden = true) BindingResult bindingResult){ + if(bindingResult != null && bindingResult.hasErrors()){ + return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); + } + if(po.id == null){ + return BaseResponseUtils.buildFail("鏃犳暟鎹疄浣揑D") ; + } + 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 = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝false锛氬け璐ワ紙BaseResponse.content锛�", + content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, + schema = @Schema(implementation = Boolean.class))} + ) + }) + @GetMapping(path = "delete", consumes = MediaType.TEXT_PLAIN_VALUE) + @SsoAop("-1")//@SsoAop(power = "-1") + public BaseResponse<Boolean> delete(@Parameter(description = "瀹炰綋id", required = true) 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) ; + } + } } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/client/ClientSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/client/ClientSv.java index ffe5a8e..384e6e3 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/client/ClientSv.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/client/ClientSv.java @@ -1,4 +1,89 @@ package com.dy.pipIrrBase.client; + +import com.dy.common.webUtil.QueryResultVo; +import com.dy.pipIrrGlobal.daoBa.BaClientMapper; +import com.dy.pipIrrGlobal.pojoBa.BaClient; +import com.dy.pipIrrGlobal.pojoBa.BaClientType; +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 org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.Map; + +@Slf4j +@Service public class ClientSv { + + private BaClientMapper dao; + + @Autowired + private void setDao(BaClientMapper dao){ + this.dao = dao; + } + + + /** + * 寰楀埌涓�涓啘鎴风被鍨� + * @param id 鍐滄埛绫诲瀷ID + * @return 鍐滄埛绫诲瀷瀹炰綋 + */ + public BaClient selectById(Long id){ + return this.dao.selectById(id) ; + } + + + /** + * 寰楀埌涓�涓敤鎴� + * @param vo 鏌ヨ鏉′欢鍊煎璞� + * @return 鐢ㄦ埛瀹炰綋 + */ + @SuppressWarnings("unchecked") + public QueryResultVo<List<BaClient>> selectSome(QueryVo vo){ + Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(vo) ; + Long itemTotal = this.dao.selectTotal(params) ; + + QueryResultVo<List<BaClient>> rsVo = new QueryResultVo<>() ; + rsVo.pageSize = vo.pageSize ; + rsVo.pageCurr = vo.pageCurr ; + rsVo.calculateAndSet(itemTotal, params); + rsVo.obj = this.dao.selectSome(params) ; + + return rsVo ; + } + + /** + * 淇濆瓨瀹炰綋 + * @param po 瀹炰綋 + * @return 褰卞搷璁板綍鏁伴噺 + */ + @Transactional + public int save(BaClient po){ + return this.dao.insertSelective(po) ; + } + + /** + * 淇濆瓨淇敼瀹炰綋 + * @param po 瀹炰綋 + * @return 褰卞搷璁板綍鏁伴噺 + */ + @Transactional + public int update(BaClient po){ + return this.dao.updateByPrimaryKeySelective(po) ; + } + + + /** + * 淇濆瓨淇敼瀹炰綋 + * @param id 瀹炰綋ID + * @return 褰卞搷璁板綍鏁伴噺 + */ + @Transactional + public int delete(Long id){ + return this.dao.deleteLogicById(id) ; + } + } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/client/QueryVo.java b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/client/QueryVo.java index d830886..7ef84f4 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/client/QueryVo.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/client/QueryVo.java @@ -14,10 +14,17 @@ @Schema(name = "鍐滄埛鏌ヨ鏉′欢") public class QueryVo extends QueryConditionVo { + @Schema(description = "鍘縄D") public Long countyId ; + + @Schema(description = "闀嘔D") public Long townId ; + + @Schema(description = "鏉慖D") public Long villageId ; + @Schema(description = "鐗囧尯ID") + public Long blockId ; @Schema(description = "鍐滄埛濮撳悕") public String name; diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/clientType/ClientTypeCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/clientType/ClientTypeCtrl.java index 6621c38..f93d252 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/clientType/ClientTypeCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/clientType/ClientTypeCtrl.java @@ -2,14 +2,11 @@ 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.role.RoleSv; import com.dy.pipIrrBase.user.QueryVo; -import com.dy.pipIrrGlobal.pojoBa.BaClientType; import com.dy.pipIrrGlobal.pojoBa.BaClientType; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; @@ -23,10 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Objects; @@ -83,9 +77,9 @@ schema = @Schema(implementation = BaClientType.class))} ) }) - @PostMapping(path = "some", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) + @PostMapping(path = "some", consumes = MediaType.APPLICATION_JSON_VALUE) @SsoAop("-1") - public BaseResponse<QueryResultVo<List<BaClientType>>> some(@Parameter(description = "鏌ヨform琛ㄥ崟鏁版嵁", required = true) @Valid QueryVo vo){ + public BaseResponse<QueryResultVo<List<BaClientType>>> some(@RequestBody @Parameter(description = "鏌ヨform琛ㄥ崟json鏁版嵁", required = true) @Valid QueryVo vo){ try { QueryResultVo<List<BaClientType>> res = this.sv.selectSome(vo) ; return BaseResponseUtils.buildSuccess(res); @@ -108,7 +102,7 @@ schema = @Schema(implementation = BaClientType.class))} ) }) - @GetMapping(path = "one") + @GetMapping(path = "one", consumes = MediaType.TEXT_PLAIN_VALUE) @SsoAop("-1") public BaseResponse<BaClientType> one(@Parameter(description = "瀹炰綋id", required = true) Long id){ return BaseResponseUtils.buildSuccess(this.sv.selectById(id)); @@ -128,9 +122,9 @@ schema = @Schema(implementation = Boolean.class))} ) }) - @PostMapping(path = "save", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) + @PostMapping(path = "save", consumes = MediaType.APPLICATION_JSON_VALUE) @SsoAop("-1")//@SsoAop(power = "-1") - public BaseResponse<Boolean> save(@Parameter(description = "form琛ㄥ崟鏁版嵁", required = true) @Valid BaClientType po, @Parameter(hidden = true) BindingResult bindingResult){ + public BaseResponse<Boolean> save(@RequestBody @Parameter(description = "form琛ㄥ崟json鏁版嵁", required = true) @Valid BaClientType po, @Parameter(hidden = true) BindingResult bindingResult){ if(bindingResult != null && bindingResult.hasErrors()){ return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); } @@ -163,9 +157,9 @@ schema = @Schema(implementation = Boolean.class))} ) }) - @PostMapping(path = "update", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) + @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE) @SsoAop("-1")//@SsoAop(power = "-1") - public BaseResponse<Boolean> update(@Parameter(description = "form琛ㄥ崟鏁版嵁", required = true) @Valid BaClientType po, @Parameter(hidden = true) BindingResult bindingResult){ + public BaseResponse<Boolean> update(@RequestBody @Parameter(description = "form琛ㄥ崟json鏁版嵁", required = true) @Valid BaClientType po, @Parameter(hidden = true) BindingResult bindingResult){ if(bindingResult != null && bindingResult.hasErrors()){ return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); } @@ -207,17 +201,22 @@ 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("鏁版嵁搴撳瓨鍌ㄥけ璐�") ; + Long clientCount = this.sv.selectClientByType(id) ; + if(clientCount > 0){ + return BaseResponseUtils.buildFail("鍒犻櫎澶辫触锛屽瓨鍦�" + clientCount + "涓啘鎴峰綊灞炴绫诲瀷锛岃绫诲瀷涓嶈兘琚垹闄�") ; }else{ - return BaseResponseUtils.buildSuccess(true) ; + 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) ; + } } } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/clientType/ClientTypeSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/clientType/ClientTypeSv.java index e6bf1e8..cd15604 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/clientType/ClientTypeSv.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/clientType/ClientTypeSv.java @@ -2,6 +2,7 @@ import com.dy.common.webUtil.QueryResultVo; import com.dy.pipIrrBase.user.QueryVo; +import com.dy.pipIrrGlobal.daoBa.BaClientMapper; import com.dy.pipIrrGlobal.daoBa.BaClientTypeMapper; import com.dy.pipIrrGlobal.pojoBa.BaClientType; import lombok.extern.slf4j.Slf4j; @@ -18,12 +19,26 @@ public class ClientTypeSv { private BaClientTypeMapper dao; + private BaClientMapper cdao; @Autowired private void setDao(BaClientTypeMapper dao){ this.dao = dao; } + @Autowired + private void setDao(BaClientMapper dao){ + this.cdao = dao; + } + + /** + * 鏌ヨ鏌愮被鍨嬪啘鎴锋�绘暟 + * @param typeId 鍐滄埛绫诲瀷ID + * @return 鎬绘暟 + */ + public Long selectClientByType(Long typeId){ + return this.cdao.selectCountByType(typeId) ; + } /** * 寰楀埌鎵�鏈夊啘鎴风被鍨� @@ -93,13 +108,7 @@ */ @Transactional public int delete(Long id){ - //int count = this.dao.deleteLogicById(id) ; - //閫昏緫鍒犻櫎锛屾墍浠ヤ笉瀹為檯鍒犻櫎鍏跺叧鑱旂殑鏉冮檺 - //if(count > 0){ - // this.rolePrivDao.deleteByRoleId(id) ; - //} - //return count ; - return 0 ;// this.dao.deleteLogicById(id) ; + return this.dao.deleteById(id) ; } -- Gitblit v1.8.0