| @ -0,0 +1,67 @@ | |||
| package com.fkzy.warn.mapper; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
| import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
| import com.fkzy.warn.model.DictItem; | |||
| import com.fkzy.warn.model.vo.DictItemVO; | |||
| import org.apache.ibatis.annotations.Mapper; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| /** | |||
| * @Author: yuyantian | |||
| * @Date: 2020/12/7 | |||
| * @description | |||
| */ | |||
| @Mapper | |||
| public interface DictItemMapper extends BaseMapper<DictItem> { | |||
| /** | |||
| * 批量逻辑删除 | |||
| * | |||
| * @param dictId 字典id | |||
| */ | |||
| boolean updateByDictId(@Param("dictIdList") List<String> dictId); | |||
| /** | |||
| * 根据字典编码查询字典项集合 | |||
| */ | |||
| List<DictItem> getDictItem(@Param("dictCode") String dictCode); | |||
| /** | |||
| * 根据字典编码查询指定字典项 | |||
| * | |||
| * @param dictCode 字典编码 | |||
| * @param dictItemCode 字典项编码 | |||
| */ | |||
| DictItemVO findByDictCode(@Param("dictCode") String dictCode, | |||
| @Param("dictItemCode") String dictItemCode); | |||
| /** | |||
| * 根据字典名称查询指定字典项 | |||
| * | |||
| * @param dictCode 字典编码 | |||
| * @param dictItemName 字典项名称 | |||
| */ | |||
| DictItemVO findByDictName(@Param("dictCode") String dictCode, | |||
| @Param("dictItemName") String dictItemName); | |||
| /** | |||
| * 分页 | |||
| */ | |||
| Page<DictItemVO> queryPage(@Param("pagination") Page<DictItem> pagination, | |||
| @Param("map") Map map); | |||
| /** | |||
| * 分页查询出的数据总条数 | |||
| */ | |||
| long queryListTotal(JSONObject jsonObject); | |||
| List<String> findByDictId(@Param("dictId") Long dictId); | |||
| String findDictCodeByProductName(@Param("productName")String productName); | |||
| } | |||
| @ -0,0 +1,40 @@ | |||
| package com.fkzy.warn.mapper; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
| import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
| import com.fkzy.warn.model.Dict; | |||
| import com.fkzy.warn.model.vo.DictVO; | |||
| import org.apache.ibatis.annotations.Mapper; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| /** | |||
| * @Author: yuyantian | |||
| * @Date: 2020/12/7 | |||
| * @description | |||
| */ | |||
| @Mapper | |||
| public interface DictMapper extends BaseMapper<Dict> { | |||
| /** | |||
| * 分页 | |||
| */ | |||
| Page<DictVO> queryPage(@Param("pagination") Page<DictVO> pagination, | |||
| @Param("map") Map map); | |||
| /** | |||
| * 分页查询出的数据总条数 | |||
| * | |||
| * @param jsonObject | |||
| * @return | |||
| */ | |||
| long queryListTotal(JSONObject jsonObject); | |||
| /** | |||
| * 批量逻辑删除字典 | |||
| */ | |||
| boolean updateBatch(@Param("idList") List<String> idList); | |||
| } | |||
| @ -0,0 +1,98 @@ | |||
| package com.fkzy.warn.model; | |||
| import com.baomidou.mybatisplus.annotation.IdType; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.baomidou.mybatisplus.annotation.TableId; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.baomidou.mybatisplus.extension.activerecord.Model; | |||
| import io.swagger.annotations.ApiModelProperty; | |||
| import lombok.Data; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| /** | |||
| * @author yuyantian | |||
| * @date 2023/10/18 10:45 | |||
| * @description 数据字典 | |||
| */ | |||
| @TableName("t_sys_dict") | |||
| @Data | |||
| public class Dict extends Model<Dict> { | |||
| /** | |||
| * id | |||
| */ | |||
| @ApiModelProperty("id") | |||
| @TableId(value = "id", type = IdType.AUTO) | |||
| private Integer id; | |||
| /** | |||
| * 字典名称 | |||
| */ | |||
| @ApiModelProperty("字典名称") | |||
| @TableField(value = "dict_name") | |||
| private String dictName; | |||
| /** | |||
| * 字典code | |||
| */ | |||
| @ApiModelProperty("字典code") | |||
| @TableField(value = "dict_code") | |||
| private String dictCode; | |||
| /** | |||
| * 排序 | |||
| */ | |||
| @ApiModelProperty("排序") | |||
| @TableField(value = "dict_rank") | |||
| private String dictRank; | |||
| /** | |||
| * 字典描述 | |||
| */ | |||
| @ApiModelProperty("字典描述") | |||
| @TableField(value = "dict_desc") | |||
| private String dictDesc; | |||
| /** | |||
| * 是否删除:0否1是 | |||
| */ | |||
| @ApiModelProperty("是否删除:0否1是") | |||
| @TableField(value = "is_del") | |||
| private Integer isDel; | |||
| /** | |||
| * 创建时间 | |||
| */ | |||
| @ApiModelProperty("创建时间") | |||
| @TableField(value = "create_time") | |||
| private Date createTime; | |||
| /** | |||
| * 修改时间 | |||
| */ | |||
| @ApiModelProperty("修改时间") | |||
| @TableField(value = "edit_time") | |||
| private String editTime; | |||
| /** | |||
| * 删除时间 | |||
| */ | |||
| @ApiModelProperty("删除时间") | |||
| @TableField(value = "delete_time") | |||
| private String deleteTime; | |||
| /** | |||
| * 创建人 | |||
| */ | |||
| @ApiModelProperty("创建人") | |||
| @TableField(value = "creator") | |||
| private String creator; | |||
| /** | |||
| * 操作人 | |||
| */ | |||
| @ApiModelProperty("操作人") | |||
| @TableField(value = "operator") | |||
| private String operator; | |||
| /** | |||
| * 数据子项 | |||
| */ | |||
| @ApiModelProperty("数据子项") | |||
| @TableField(exist = false) | |||
| private List<DictItem> dictItems; | |||
| } | |||
| @ -0,0 +1,96 @@ | |||
| package com.fkzy.warn.model; | |||
| import com.baomidou.mybatisplus.annotation.IdType; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.baomidou.mybatisplus.annotation.TableId; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.baomidou.mybatisplus.extension.activerecord.Model; | |||
| import io.swagger.annotations.ApiModelProperty; | |||
| import lombok.Data; | |||
| import java.util.Date; | |||
| /** | |||
| * @author yuyantian | |||
| * @date 2023/10/18 10:45 | |||
| * @description 数据字典项 | |||
| */ | |||
| @TableName("t_sys_dict_item") | |||
| @Data | |||
| public class DictItem extends Model<DictItem> { | |||
| /** | |||
| * id | |||
| */ | |||
| @ApiModelProperty("id") | |||
| @TableId(value = "id", type = IdType.AUTO) | |||
| private Integer id; | |||
| /** | |||
| * 字典id | |||
| */ | |||
| @ApiModelProperty("字典id") | |||
| @TableField(value = "dict_id") | |||
| private String dictId; | |||
| /** | |||
| * 字典项名称 | |||
| */ | |||
| @ApiModelProperty("字典项名称") | |||
| @TableField(value = "dict_item_name") | |||
| private String dictItemName; | |||
| /** | |||
| * 字典项code | |||
| */ | |||
| @ApiModelProperty("字典项code") | |||
| @TableField(value = "dict_item_code") | |||
| private String dictItemCode; | |||
| /** | |||
| * 排序 | |||
| */ | |||
| @ApiModelProperty("排序") | |||
| @TableField(value = "dict_item_rank") | |||
| private Integer dictItemRank; | |||
| /** | |||
| * 字典项描述 | |||
| */ | |||
| @ApiModelProperty("字典项描述") | |||
| @TableField(value = "dict_item_desc") | |||
| private String dictItemDesc; | |||
| /** | |||
| * 是否删除:0否1是 | |||
| */ | |||
| @ApiModelProperty("是否删除:0否1是") | |||
| @TableField(value = "is_del") | |||
| private Integer isDel; | |||
| /** | |||
| * 创建时间 | |||
| */ | |||
| @ApiModelProperty("创建时间") | |||
| @TableField(value = "create_time") | |||
| private Date createTime; | |||
| /** | |||
| * 修改时间 | |||
| */ | |||
| @ApiModelProperty("修改时间") | |||
| @TableField(value = "edit_time") | |||
| private String editTime; | |||
| /** | |||
| * 删除时间 | |||
| */ | |||
| @ApiModelProperty("删除时间") | |||
| @TableField(value = "delete_time") | |||
| private String deleteTime; | |||
| /** | |||
| * 创建人 | |||
| */ | |||
| @ApiModelProperty("创建人") | |||
| @TableField(value = "creator") | |||
| private String creator; | |||
| /** | |||
| * 操作人 | |||
| */ | |||
| @ApiModelProperty("操作人") | |||
| @TableField(value = "operator") | |||
| private String operator; | |||
| } | |||
| @ -0,0 +1,52 @@ | |||
| package com.fkzy.warn.model.vo; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.baomidou.mybatisplus.extension.activerecord.Model; | |||
| import io.swagger.annotations.ApiModelProperty; | |||
| import lombok.Data; | |||
| /** | |||
| * @author yuyantian | |||
| * @date 2023/10/18 10:45 | |||
| * @description 数据字典项vo | |||
| */ | |||
| @Data | |||
| public class DictItemVO extends Model<DictItemVO> { | |||
| /** | |||
| * id | |||
| */ | |||
| @ApiModelProperty("id") | |||
| private Integer id; | |||
| /** | |||
| * 字典id | |||
| */ | |||
| @ApiModelProperty("字典id") | |||
| private String dictId; | |||
| /** | |||
| * 字典项名称 | |||
| */ | |||
| @ApiModelProperty("字典项名称") | |||
| private String dictItemName; | |||
| /** | |||
| * 字典项code | |||
| */ | |||
| @ApiModelProperty("字典项code") | |||
| private String dictItemCode; | |||
| /** | |||
| * 排序 | |||
| */ | |||
| @ApiModelProperty("排序") | |||
| private Integer dictItemRank; | |||
| /** | |||
| * 字典项描述 | |||
| */ | |||
| @ApiModelProperty("字典项描述") | |||
| @TableField(value = "dict_item_desc") | |||
| private String dictItemDesc; | |||
| } | |||
| @ -0,0 +1,43 @@ | |||
| package com.fkzy.warn.model.vo; | |||
| import com.baomidou.mybatisplus.extension.activerecord.Model; | |||
| import io.swagger.annotations.ApiModelProperty; | |||
| import lombok.Data; | |||
| /** | |||
| * @author yuyantian | |||
| * @date 2023/10/18 10:45 | |||
| * @description 数据字典vo | |||
| */ | |||
| @Data | |||
| public class DictVO extends Model<DictVO> { | |||
| /** | |||
| * id | |||
| */ | |||
| @ApiModelProperty("id") | |||
| private Integer id; | |||
| /** | |||
| * 字典名称 | |||
| */ | |||
| @ApiModelProperty("字典名称") | |||
| private String dictName; | |||
| /** | |||
| * 字典code | |||
| */ | |||
| @ApiModelProperty("字典code") | |||
| private String dictCode; | |||
| /** | |||
| * 排序 | |||
| */ | |||
| @ApiModelProperty("排序") | |||
| private String dictRank; | |||
| /** | |||
| * 字典描述 | |||
| */ | |||
| @ApiModelProperty("字典描述") | |||
| private String dictDesc; | |||
| } | |||
| @ -0,0 +1,119 @@ | |||
| <?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.smyq.app.mapper.DictItemMapper"> | |||
| <!--数据字典项--> | |||
| <resultMap id="dictItem_result" type="com.fkzy.warn.model.vo.DictItemVO"> | |||
| <result column="id" property="id" jdbcType="INTEGER"/> | |||
| <result column="dict_id" property="dictId" jdbcType="VARCHAR"/> | |||
| <result column="dict_item_name" property="dictItemName" jdbcType="VARCHAR"/> | |||
| <result column="dict_item_code" property="dictItemCode" jdbcType="VARCHAR"/> | |||
| <result column="dict_item_desc" property="dictItemDesc" jdbcType="VARCHAR"/> | |||
| <result column="dict_item_rank" property="dictItemRank" jdbcType="INTEGER"/> | |||
| </resultMap> | |||
| <update id="updateByDictId"> | |||
| <foreach collection="dictIdList" index="index" item="id" open="" separator=";" close=""> | |||
| update t_sys_dict_item | |||
| <set> | |||
| is_del=1 | |||
| </set> | |||
| WHERE dict_id=#{id} | |||
| </foreach> | |||
| </update> | |||
| <select id="getDictItem" resultMap="dictItem_result"> | |||
| SELECT | |||
| dt.id, | |||
| dt.dict_id, | |||
| dt.dict_item_name, | |||
| dt.dict_item_code, | |||
| dt.dict_item_desc, | |||
| dt.dict_item_rank, | |||
| dt.is_del, | |||
| dt.create_time | |||
| FROM | |||
| t_sys_dict_item dt, | |||
| t_sys_dict d | |||
| WHERE | |||
| d.id = dt.dict_id | |||
| <if test="dictCode !=null"> | |||
| AND d.dict_code = #{dictCode} | |||
| </if> | |||
| ORDER BY | |||
| dt.dict_item_rank ASC; | |||
| </select> | |||
| <select id="findByDictCode" resultMap="dictItem_result"> | |||
| SELECT | |||
| dt.id, | |||
| dt.dict_id, | |||
| dt.dict_item_name, | |||
| dt.dict_item_code, | |||
| dt.dict_item_desc, | |||
| dt.dict_item_rank, | |||
| dt.is_del, | |||
| dt.create_time | |||
| FROM | |||
| t_sys_dict_item dt, | |||
| t_sys_dict d | |||
| WHERE | |||
| d.id = dt.dict_id | |||
| AND d.dict_code= #{dictCode} | |||
| AND dt.dict_item_code = #{dictItemCode} | |||
| ORDER BY | |||
| dt.dict_item_rank ASC | |||
| </select> | |||
| <select id="findByDictName" resultMap="dictItem_result"> | |||
| SELECT | |||
| dt.id, | |||
| dt.dict_id, | |||
| dt.dict_item_name, | |||
| dt.dict_item_code, | |||
| dt.dict_item_desc, | |||
| dt.dict_item_rank, | |||
| dt.is_del, | |||
| dt.create_time | |||
| FROM | |||
| t_sys_dict_item dt, | |||
| t_sys_dict d | |||
| WHERE | |||
| d.id = dt.dict_id | |||
| AND d.dict_code= #{dictCode} | |||
| AND dt.dict_item_name = #{dictItemName} | |||
| ORDER BY | |||
| dt.dict_item_rank ASC | |||
| </select> | |||
| <select id="queryPage" resultMap="dictItem_result"> | |||
| select | |||
| id, | |||
| dict_id , | |||
| dict_item_name , | |||
| dict_item_code , | |||
| dict_item_desc , | |||
| dict_item_rank , | |||
| is_del , | |||
| create_time | |||
| FROM | |||
| t_sys_dict_item as a | |||
| WHERE is_del=0 | |||
| AND dict_id =#{map.id} | |||
| </select> | |||
| <select id="findByDictId" resultType="java.lang.String"> | |||
| select dict_item_name from t_sys_dict_item where dict_id = #{dictId} | |||
| </select> | |||
| <select id="findDictCodeByProductName" resultType="java.lang.String"> | |||
| select dict_item_code from t_sys_dict_item where dict_item_name = #{productName} | |||
| </select> | |||
| </mapper> | |||
| @ -0,0 +1,65 @@ | |||
| <?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.smyq.app.mapper.DictMapper"> | |||
| <!--数据字典--> | |||
| <resultMap id="dict_result" type="com.fkzy.warn.model.vo.DictVO"> | |||
| <result column="id" property="id" jdbcType="INTEGER"/> | |||
| <result column="dict_name" property="dictName" jdbcType="VARCHAR"/> | |||
| <result column="dict_code" property="dictCode" jdbcType="VARCHAR"/> | |||
| <result column="dict_rank" property="dictRank" jdbcType="INTEGER"/> | |||
| <result column="dict_desc" property="dictDesc" jdbcType="VARCHAR"/> | |||
| </resultMap> | |||
| <select id="queryPage" resultMap="dict_result"> | |||
| SELECT | |||
| * | |||
| FROM | |||
| t_sys_dict | |||
| WHERE | |||
| is_del = 0 | |||
| <if test="null !=map.dictCode"> | |||
| AND dict_code LIKE '%${map.dictCode}%' | |||
| </if> | |||
| <if test=" null !=map.dictName"> | |||
| AND dict_name LIKE '%${map.dictName}%' | |||
| </if> | |||
| UNION | |||
| SELECT | |||
| * | |||
| FROM | |||
| t_sys_dict | |||
| WHERE | |||
| is_del = 0 | |||
| AND id IN ( SELECT dict_id as id FROM t_sys_dict_item WHERE is_del = 0 | |||
| <if test="null !=map.dictCode"> | |||
| AND dict_item_code LIKE '%${map.dictCode}%' | |||
| </if> | |||
| <if test=" null !=map.dictName"> | |||
| AND dict_item_name LIKE '%${map.dictName}%' | |||
| </if> | |||
| ) | |||
| </select> | |||
| <update id="updateBatch"> | |||
| <foreach collection="idList" index="index" item="id" open="" separator=";" close=""> | |||
| update t_sys_dict | |||
| <set> | |||
| is_del =1 | |||
| </set> | |||
| WHERE id=#{id} | |||
| </foreach> | |||
| </update> | |||
| </mapper> | |||