| | |
| | | |
| | | @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 |
| | |
| | | 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 |
| | |
| | | * @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); |
| | | } |
| | |
| | | |
| | | 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 |
| | |
| | | * @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); |
| | | |
| | | } |
| | |
| | | |
| | | 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; |
| | |
| | | public interface BaClientTypeMapper extends BaseMapper<BaClientType> { |
| | | /** |
| | | * 通过ID得到类型名称 |
| | | * @param id |
| | | * @return |
| | | * @param id 主键 |
| | | * @return 名称 |
| | | */ |
| | | String selectNameById(Long id) ; |
| | | |
| | |
| | | |
| | | /** |
| | | * 通过ID删除 |
| | | * @param id |
| | | * @param id 主键 |
| | | */ |
| | | void deleteByPrimaryKey(Long id) ; |
| | | } |
| | |
| | | |
| | | 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; |
| | |
| | | |
| | | @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 |
| | |
| | | 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 |
| | |
| | | * @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); |
| | | |
| | | } |
| | |
| | | select |
| | | count(*) |
| | | from ba_block |
| | | <trim prefix="where "> |
| | | <trim prefix="where " suffixOverrides="and"> |
| | | <if test="name != null"> |
| | | name like '%#{name,jdbcType=VARCHAR}%' and |
| | | </if> |
| | |
| | | phone = '#{phone,jdbcType=VARCHAR}' and |
| | | </if> |
| | | <if test="area != null"> |
| | | area = #{area,jdbcType=INTEGER} |
| | | area = #{area,jdbcType=INTEGER} and |
| | | </if> |
| | | </trim> |
| | | </select> |
| | |
| | | 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> |
| | |
| | | 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 |
| | |
| | | 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> |
| | |
| | | |
| | | |
| | | <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> |
| | | |
| | |
| | | <!--@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" /> |
| | |
| | | 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, |
| | |
| | | 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}) |
| | |
| | | <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"> |
| | |
| | | <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}, |
| | |
| | | <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}, |
| | |
| | | <!--@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}, |
| | |
| | | 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> |
| | |
| | | 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版本越高,对泛型约束越严,所以配置SuppressWarnings("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 = "提交农户数据(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("-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 = "提交农户数据(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("-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("无数据实体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("-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) ; |
| | | } |
| | | } |
| | | } |
| | |
| | | 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) ; |
| | | } |
| | | |
| | | } |
| | |
| | | @Schema(name = "农户查询条件") |
| | | public class QueryVo extends QueryConditionVo { |
| | | |
| | | @Schema(description = "县ID") |
| | | public Long countyId ; |
| | | |
| | | @Schema(description = "镇ID") |
| | | public Long townId ; |
| | | |
| | | @Schema(description = "村ID") |
| | | public Long villageId ; |
| | | |
| | | @Schema(description = "片区ID") |
| | | public Long blockId ; |
| | | |
| | | @Schema(description = "农户姓名") |
| | | public String name; |
| | |
| | | |
| | | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | 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); |
| | |
| | | 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)); |
| | |
| | | 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()); |
| | | } |
| | |
| | | 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()); |
| | | } |
| | |
| | | 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) ; |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | 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; |
| | |
| | | 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) ; |
| | | } |
| | | |
| | | /** |
| | | * 得到所有农户类型 |
| | |
| | | */ |
| | | @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) ; |
| | | } |
| | | |
| | | |