Administrator
2024-06-26 0980124ec2e8deab58b072a83ebed43390d8024f
2024-06-26 朱宝民 添加字典、字典项管理
9个文件已添加
740 ■■■■■ 已修改文件
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaDictItemMapper.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaDictMapper.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoBa/BaDict.java 96 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoBa/BaDictItem.java 107 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voBa/VoDictItem.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaDictItemMapper.xml 200 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaDictMapper.xml 167 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/dict/DictCtrl.java 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/dict/DictSv.java 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaDictItemMapper.java
New file
@@ -0,0 +1,37 @@
package com.dy.pipIrrGlobal.daoBa;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dy.pipIrrGlobal.pojoBa.BaDictItem;
import com.dy.pipIrrGlobal.voBa.VoDictItem;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
 * @author ZhuBaoMin
 * @date 2024-06-26 20:14
 * @LastEditTime 2024-06-26 20:14
 * @Description
 */
@Mapper
public interface BaDictItemMapper extends BaseMapper<BaDictItem> {
    int deleteByPrimaryKey(Integer id);
    int insert(BaDictItem record);
    int insertSelective(BaDictItem record);
    BaDictItem selectByPrimaryKey(Integer id);
    int updateByPrimaryKeySelective(BaDictItem record);
    int updateByPrimaryKey(BaDictItem record);
    /**
     * 根据字典Code获取字典项
     * @param dictCode
     * @return
     */
    List<VoDictItem> getDictItemsByDictCode(String dictCode);
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaDictMapper.java
New file
@@ -0,0 +1,27 @@
package com.dy.pipIrrGlobal.daoBa;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dy.pipIrrGlobal.pojoBa.BaDict;
import org.apache.ibatis.annotations.Mapper;
/**
 * @author ZhuBaoMin
 * @date 2024-06-26 20:14
 * @LastEditTime 2024-06-26 20:14
 * @Description
 */
@Mapper
public interface BaDictMapper extends BaseMapper<BaDict> {
    int deleteByPrimaryKey(Integer id);
    int insert(BaDict record);
    int insertSelective(BaDict record);
    BaDict selectByPrimaryKey(Integer id);
    int updateByPrimaryKeySelective(BaDict record);
    int updateByPrimaryKey(BaDict record);
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoBa/BaDict.java
New file
@@ -0,0 +1,96 @@
package com.dy.pipIrrGlobal.pojoBa;
import com.alibaba.fastjson2.annotation.JSONField;
import com.alibaba.fastjson2.writer.ObjectWriterImplToString;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.*;
import java.util.Date;
/**
 * @author ZhuBaoMin
 * @date 2024-06-26 20:14
 * @LastEditTime 2024-06-26 20:14
 * @Description
 */
/**
 * 字典表
 */
@TableName(value="ba_dict", autoResultMap = true)
@Data
@ToString
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "字典实体")
public class BaDict {
    public static final long serialVersionUID = 202406262028001L;
    /**
    * 主键
    */
    @JSONField(serializeUsing = ObjectWriterImplToString.class)
    @TableId(type = IdType.INPUT)
    private Integer id;
    /**
    * 标识
    */
    @NotBlank(message = "标识不能为空")
    private String code;
    /**
    * 名称
    */
    @NotBlank(message = "名称不能为空")
    private String title;
    /**
    * 值类型;1-Number,2-String,3-Boolean
    */
    @NotNull(message = "值类型不能为空")
    private Byte valueType;
    /**
    * hash值;当字典项被修改时变更
    */
    @NotBlank(message = "hash值不能为空")
    private String hashCode;
    /**
    * 备注
    */
    private String remarks;
    /**
    * 逻辑删除标识;未删除为 0,已删除为删除时间
    */
    @JSONField(serializeUsing = ObjectWriterImplToString.class)
    private Long deleted;
    /**
    * 创建人
    */
    private Integer createBy;
    /**
    * 修改人
    */
    private Integer updateBy;
    /**
    * 创建时间
    */
    private Date createTime;
    /**
    * 修改时间
    */
    private Date updateTime;
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoBa/BaDictItem.java
New file
@@ -0,0 +1,107 @@
package com.dy.pipIrrGlobal.pojoBa;
import com.alibaba.fastjson2.annotation.JSONField;
import com.alibaba.fastjson2.writer.ObjectWriterImplToString;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.*;
import java.util.Date;
/**
 * @author ZhuBaoMin
 * @date 2024-06-26 20:14
 * @LastEditTime 2024-06-26 20:14
 * @Description
 */
/**
 * 字典项
 */
@TableName(value="ba_dict_item", autoResultMap = true)
@Data
@ToString
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "字典项实体")
public class BaDictItem {
    public static final long serialVersionUID = 202406262029001L;
    /**
    * 主键
    */
    @JSONField(serializeUsing = ObjectWriterImplToString.class)
    @TableId(type = IdType.INPUT)
    private Integer id;
    /**
    * 字典Code
    */
    @NotBlank(message = "字典Code不能为空")
    private String dictCode;
    /**
    * 数据值
    */
    @NotBlank(message = "数据值不能为空")
    private String value;
    /**
    * 标签
    */
    @NotBlank(message = "标签不能为空")
    private String name;
    /**
    * 状态;1-启用,0-禁用
    */
    @NotNull(message = "状态不能为空")
    private Byte status;
    /**
    * 附加属性
    */
    private String attributes;
    /**
    * 排序(升序)
    */
    @NotNull(message = "排序不能为空")
    private Integer sort;
    /**
    * 备注
    */
    private String remarks;
    /**
    * 逻辑删除标识;未删除为 0,已删除为删除时间
    */
    @JSONField(serializeUsing = ObjectWriterImplToString.class)
    private Long deleted;
    /**
    * 创建人
    */
    private Integer createBy;
    /**
    * 修改人
    */
    private Integer updateBy;
    /**
    * 创建时间
    */
    private Date createTime;
    /**
    * 修改时间
    */
    private Date updateTime;
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voBa/VoDictItem.java
New file
@@ -0,0 +1,28 @@
package com.dy.pipIrrGlobal.voBa;
import com.dy.common.po.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
 * @author ZhuBaoMin
 * @date 2024-06-26 20:58
 * @LastEditTime 2024-06-26 20:58
 * @Description
 */
@Data
@Schema(title = "字典项视图对象")
public class VoDictItem implements BaseEntity {
    private static final long serialVersionUID = 202406262059001L;
    /**
     * 标签
     */
    private String name;
    /**
     * 数据值
     */
    private String value;
}
pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaDictItemMapper.xml
New file
@@ -0,0 +1,200 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.dy.pipIrrGlobal.daoBa.BaDictItemMapper">
  <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoBa.BaDictItem">
    <!--@mbg.generated-->
    <!--@Table ba_dict_item-->
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="dict_code" jdbcType="VARCHAR" property="dictCode" />
    <result column="value" jdbcType="VARCHAR" property="value" />
    <result column="name" jdbcType="VARCHAR" property="name" />
    <result column="status" jdbcType="TINYINT" property="status" />
    <result column="attributes" jdbcType="LONGVARCHAR" property="attributes" />
    <result column="sort" jdbcType="INTEGER" property="sort" />
    <result column="remarks" jdbcType="VARCHAR" property="remarks" />
    <result column="deleted" jdbcType="BIGINT" property="deleted" />
    <result column="create_by" jdbcType="INTEGER" property="createBy" />
    <result column="update_by" jdbcType="INTEGER" property="updateBy" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, dict_code, `value`, `name`, `status`, `attributes`, sort, remarks, deleted, create_by,
    update_by, create_time, update_time
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select
    <include refid="Base_Column_List" />
    from ba_dict_item
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    <!--@mbg.generated-->
    delete from ba_dict_item
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.dy.pipIrrGlobal.pojoBa.BaDictItem" useGeneratedKeys="true">
    <!--@mbg.generated-->
    insert into ba_dict_item (dict_code, `value`, `name`,
      `status`, `attributes`, sort,
      remarks, deleted, create_by,
      update_by, create_time, update_time
      )
    values (#{dictCode,jdbcType=VARCHAR}, #{value,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
      #{status,jdbcType=TINYINT}, #{attributes,jdbcType=LONGVARCHAR}, #{sort,jdbcType=INTEGER},
      #{remarks,jdbcType=VARCHAR}, #{deleted,jdbcType=BIGINT}, #{createBy,jdbcType=INTEGER},
      #{updateBy,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
      )
  </insert>
  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.dy.pipIrrGlobal.pojoBa.BaDictItem" useGeneratedKeys="true">
    <!--@mbg.generated-->
    insert into ba_dict_item
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="dictCode != null">
        dict_code,
      </if>
      <if test="value != null">
        `value`,
      </if>
      <if test="name != null">
        `name`,
      </if>
      <if test="status != null">
        `status`,
      </if>
      <if test="attributes != null">
        `attributes`,
      </if>
      <if test="sort != null">
        sort,
      </if>
      <if test="remarks != null">
        remarks,
      </if>
      <if test="deleted != null">
        deleted,
      </if>
      <if test="createBy != null">
        create_by,
      </if>
      <if test="updateBy != null">
        update_by,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="updateTime != null">
        update_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="dictCode != null">
        #{dictCode,jdbcType=VARCHAR},
      </if>
      <if test="value != null">
        #{value,jdbcType=VARCHAR},
      </if>
      <if test="name != null">
        #{name,jdbcType=VARCHAR},
      </if>
      <if test="status != null">
        #{status,jdbcType=TINYINT},
      </if>
      <if test="attributes != null">
        #{attributes,jdbcType=LONGVARCHAR},
      </if>
      <if test="sort != null">
        #{sort,jdbcType=INTEGER},
      </if>
      <if test="remarks != null">
        #{remarks,jdbcType=VARCHAR},
      </if>
      <if test="deleted != null">
        #{deleted,jdbcType=BIGINT},
      </if>
      <if test="createBy != null">
        #{createBy,jdbcType=INTEGER},
      </if>
      <if test="updateBy != null">
        #{updateBy,jdbcType=INTEGER},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateTime != null">
        #{updateTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoBa.BaDictItem">
    <!--@mbg.generated-->
    update ba_dict_item
    <set>
      <if test="dictCode != null">
        dict_code = #{dictCode,jdbcType=VARCHAR},
      </if>
      <if test="value != null">
        `value` = #{value,jdbcType=VARCHAR},
      </if>
      <if test="name != null">
        `name` = #{name,jdbcType=VARCHAR},
      </if>
      <if test="status != null">
        `status` = #{status,jdbcType=TINYINT},
      </if>
      <if test="attributes != null">
        `attributes` = #{attributes,jdbcType=LONGVARCHAR},
      </if>
      <if test="sort != null">
        sort = #{sort,jdbcType=INTEGER},
      </if>
      <if test="remarks != null">
        remarks = #{remarks,jdbcType=VARCHAR},
      </if>
      <if test="deleted != null">
        deleted = #{deleted,jdbcType=BIGINT},
      </if>
      <if test="createBy != null">
        create_by = #{createBy,jdbcType=INTEGER},
      </if>
      <if test="updateBy != null">
        update_by = #{updateBy,jdbcType=INTEGER},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateTime != null">
        update_time = #{updateTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoBa.BaDictItem">
    <!--@mbg.generated-->
    update ba_dict_item
    set dict_code = #{dictCode,jdbcType=VARCHAR},
      `value` = #{value,jdbcType=VARCHAR},
      `name` = #{name,jdbcType=VARCHAR},
      `status` = #{status,jdbcType=TINYINT},
      `attributes` = #{attributes,jdbcType=LONGVARCHAR},
      sort = #{sort,jdbcType=INTEGER},
      remarks = #{remarks,jdbcType=VARCHAR},
      deleted = #{deleted,jdbcType=BIGINT},
      create_by = #{createBy,jdbcType=INTEGER},
      update_by = #{updateBy,jdbcType=INTEGER},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      update_time = #{updateTime,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=INTEGER}
  </update>
  <!--根据字典Code获取字典项-->
  <select id="getDictItemsByDictCode" resultType="com.dy.pipIrrGlobal.voBa.VoDictItem">
    SELECT
       name, value
    FROM ba_dict_item
    WHERE deleted = 0 AND status = 1 AND dict_code = #{dictCode}
    ORDER BY sort
  </select>
</mapper>
pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaDictMapper.xml
New file
@@ -0,0 +1,167 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.dy.pipIrrGlobal.daoBa.BaDictMapper">
  <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoBa.BaDict">
    <!--@mbg.generated-->
    <!--@Table ba_dict-->
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="code" jdbcType="VARCHAR" property="code" />
    <result column="title" jdbcType="VARCHAR" property="title" />
    <result column="value_type" jdbcType="TINYINT" property="valueType" />
    <result column="hash_code" jdbcType="VARCHAR" property="hashCode" />
    <result column="remarks" jdbcType="VARCHAR" property="remarks" />
    <result column="deleted" jdbcType="BIGINT" property="deleted" />
    <result column="create_by" jdbcType="INTEGER" property="createBy" />
    <result column="update_by" jdbcType="INTEGER" property="updateBy" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, code, title, value_type, hash_code, remarks, deleted, create_by, update_by, create_time,
    update_time
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select
    <include refid="Base_Column_List" />
    from ba_dict
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    <!--@mbg.generated-->
    delete from ba_dict
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.dy.pipIrrGlobal.pojoBa.BaDict" useGeneratedKeys="true">
    <!--@mbg.generated-->
    insert into ba_dict (code, title, value_type,
      hash_code, remarks, deleted,
      create_by, update_by, create_time,
      update_time)
    values (#{code,jdbcType=VARCHAR}, #{title,jdbcType=VARCHAR}, #{valueType,jdbcType=TINYINT},
      #{hashCode,jdbcType=VARCHAR}, #{remarks,jdbcType=VARCHAR}, #{deleted,jdbcType=BIGINT},
      #{createBy,jdbcType=INTEGER}, #{updateBy,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
      #{updateTime,jdbcType=TIMESTAMP})
  </insert>
  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.dy.pipIrrGlobal.pojoBa.BaDict" useGeneratedKeys="true">
    <!--@mbg.generated-->
    insert into ba_dict
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="code != null">
        code,
      </if>
      <if test="title != null">
        title,
      </if>
      <if test="valueType != null">
        value_type,
      </if>
      <if test="hashCode != null">
        hash_code,
      </if>
      <if test="remarks != null">
        remarks,
      </if>
      <if test="deleted != null">
        deleted,
      </if>
      <if test="createBy != null">
        create_by,
      </if>
      <if test="updateBy != null">
        update_by,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="updateTime != null">
        update_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="code != null">
        #{code,jdbcType=VARCHAR},
      </if>
      <if test="title != null">
        #{title,jdbcType=VARCHAR},
      </if>
      <if test="valueType != null">
        #{valueType,jdbcType=TINYINT},
      </if>
      <if test="hashCode != null">
        #{hashCode,jdbcType=VARCHAR},
      </if>
      <if test="remarks != null">
        #{remarks,jdbcType=VARCHAR},
      </if>
      <if test="deleted != null">
        #{deleted,jdbcType=BIGINT},
      </if>
      <if test="createBy != null">
        #{createBy,jdbcType=INTEGER},
      </if>
      <if test="updateBy != null">
        #{updateBy,jdbcType=INTEGER},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateTime != null">
        #{updateTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoBa.BaDict">
    <!--@mbg.generated-->
    update ba_dict
    <set>
      <if test="code != null">
        code = #{code,jdbcType=VARCHAR},
      </if>
      <if test="title != null">
        title = #{title,jdbcType=VARCHAR},
      </if>
      <if test="valueType != null">
        value_type = #{valueType,jdbcType=TINYINT},
      </if>
      <if test="hashCode != null">
        hash_code = #{hashCode,jdbcType=VARCHAR},
      </if>
      <if test="remarks != null">
        remarks = #{remarks,jdbcType=VARCHAR},
      </if>
      <if test="deleted != null">
        deleted = #{deleted,jdbcType=BIGINT},
      </if>
      <if test="createBy != null">
        create_by = #{createBy,jdbcType=INTEGER},
      </if>
      <if test="updateBy != null">
        update_by = #{updateBy,jdbcType=INTEGER},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateTime != null">
        update_time = #{updateTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoBa.BaDict">
    <!--@mbg.generated-->
    update ba_dict
    set code = #{code,jdbcType=VARCHAR},
      title = #{title,jdbcType=VARCHAR},
      value_type = #{valueType,jdbcType=TINYINT},
      hash_code = #{hashCode,jdbcType=VARCHAR},
      remarks = #{remarks,jdbcType=VARCHAR},
      deleted = #{deleted,jdbcType=BIGINT},
      create_by = #{createBy,jdbcType=INTEGER},
      update_by = #{updateBy,jdbcType=INTEGER},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      update_time = #{updateTime,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=INTEGER}
  </update>
</mapper>
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/dict/DictCtrl.java
New file
@@ -0,0 +1,43 @@
package com.dy.pipIrrBase.dict;
import com.dy.common.aop.SsoAop;
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
import com.dy.pipIrrGlobal.voBa.VoDictItem;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
 * @author ZhuBaoMin
 * @date 2024-06-26 20:36
 * @LastEditTime 2024-06-26 20:36
 * @Description
 */
@Slf4j
@Tag(name = "字典项管理", description = "字典项管理")
@RestController
@RequestMapping(path="dict_item")
public class DictCtrl {
    @Autowired
    private DictSv dictSv;
    /**
     * 根据字典Code获取字典项
     * @param dictCode
     * @return
     */
    @GetMapping(path = "some")
    @SsoAop()
    public BaseResponse<List<VoDictItem>> some(@RequestParam String dictCode){
        return BaseResponseUtils.buildSuccess(dictSv.getDictItemsByDictCode(dictCode));
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/dict/DictSv.java
New file
@@ -0,0 +1,35 @@
package com.dy.pipIrrBase.dict;
import com.dy.pipIrrGlobal.daoBa.BaDictItemMapper;
import com.dy.pipIrrGlobal.voBa.VoDictItem;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
/**
 * @author ZhuBaoMin
 * @date 2024-06-26 20:36
 * @LastEditTime 2024-06-26 20:36
 * @Description
 */
@Slf4j
@Service
public class DictSv {
    @Autowired
    private BaDictItemMapper dictItemMapper;
    /**
     * 根据字典Code获取字典项
     * @param dictCode
     * @return
     */
    public List<VoDictItem> getDictItemsByDictCode(String dictCode){
        List<VoDictItem> rs = Optional.ofNullable(dictItemMapper.getDictItemsByDictCode(dictCode)).orElse(new ArrayList<>());
        return rs ;
    }
}