SysInfoConfigMapper.xml 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ruoyi.opt.mapper.SysInfoConfigMapper">
  6. <resultMap type="SysInfoConfig" id="SysInfoConfigResult">
  7. <result property="confId" column="conf_id" />
  8. <result property="typeCd" column="type_cd" />
  9. <result property="sceneTpCd" column="scene_tp_cd" />
  10. <result property="sceneTpNm" column="scene_tp_nm" />
  11. <result property="content" column="content" />
  12. <result property="status" column="status" />
  13. <result property="createBy" column="create_by" />
  14. <result property="createTime" column="create_time" />
  15. <result property="updateBy" column="update_by" />
  16. <result property="updateTime" column="update_time" />
  17. </resultMap>
  18. <sql id="selectSysInfoConfigVo">
  19. select c.conf_id, c.type_cd, c.scene_tp_cd, c.content, c.STATUS, c.create_by, c.create_time, c.update_by, c.update_time,
  20. (SELECT a.dict_label FROM sys_dict_data a WHERE a.dict_value = c.scene_tp_cd
  21. AND a.dict_type = (SELECT d.child_dict_type FROM sys_dict_data d WHERE d.dict_type = 'sys_tp_cd' AND d.dict_value = c.type_cd)
  22. ) AS scene_tp_nm
  23. FROM
  24. sys_info_config c
  25. </sql>
  26. <select id="selectSysInfoConfigList" parameterType="SysInfoConfig" resultMap="SysInfoConfigResult">
  27. <include refid="selectSysInfoConfigVo"/>
  28. <where>
  29. <if test="typeCd != null and typeCd != ''"> and c.type_cd = #{typeCd}</if>
  30. <if test="sceneTpCd != null and sceneTpCd != ''"> and c.scene_tp_cd = #{sceneTpCd}</if>
  31. <if test="content != null and content != ''"> and c.content = #{content}</if>
  32. <if test="status != null and status != ''"> and c.status = #{status}</if>
  33. </where>
  34. </select>
  35. <select id="selectSysInfoConfigByConfId" parameterType="Long" resultMap="SysInfoConfigResult">
  36. <include refid="selectSysInfoConfigVo"/>
  37. where c.conf_id = #{confId}
  38. </select>
  39. <insert id="insertSysInfoConfig" parameterType="SysInfoConfig" useGeneratedKeys="true" keyProperty="confId">
  40. insert into sys_info_config
  41. <trim prefix="(" suffix=")" suffixOverrides=",">
  42. <if test="typeCd != null">type_cd,</if>
  43. <if test="sceneTpCd != null">scene_tp_cd,</if>
  44. <if test="content != null">content,</if>
  45. <if test="status != null">status,</if>
  46. <if test="createBy != null">create_by,</if>
  47. <if test="createTime != null">create_time,</if>
  48. <if test="updateBy != null">update_by,</if>
  49. <if test="updateTime != null">update_time,</if>
  50. </trim>
  51. <trim prefix="values (" suffix=")" suffixOverrides=",">
  52. <if test="typeCd != null">#{typeCd},</if>
  53. <if test="sceneTpCd != null">#{sceneTpCd},</if>
  54. <if test="content != null">#{content},</if>
  55. <if test="status != null">#{status},</if>
  56. <if test="createBy != null">#{createBy},</if>
  57. <if test="createTime != null">#{createTime},</if>
  58. <if test="updateBy != null">#{updateBy},</if>
  59. <if test="updateTime != null">#{updateTime},</if>
  60. </trim>
  61. </insert>
  62. <update id="updateSysInfoConfig" parameterType="SysInfoConfig">
  63. update sys_info_config
  64. <trim prefix="SET" suffixOverrides=",">
  65. <if test="typeCd != null">type_cd = #{typeCd},</if>
  66. <if test="sceneTpCd != null">scene_tp_cd = #{sceneTpCd},</if>
  67. <if test="content != null">content = #{content},</if>
  68. <if test="status != null">status = #{status},</if>
  69. <if test="createBy != null">create_by = #{createBy},</if>
  70. <if test="createTime != null">create_time = #{createTime},</if>
  71. <if test="updateBy != null">update_by = #{updateBy},</if>
  72. <if test="updateTime != null">update_time = #{updateTime},</if>
  73. </trim>
  74. where conf_id = #{confId}
  75. </update>
  76. <delete id="deleteSysInfoConfigByConfId" parameterType="Long">
  77. delete from sys_info_config where conf_id = #{confId}
  78. </delete>
  79. <delete id="deleteSysInfoConfigByConfIds" parameterType="String">
  80. delete from sys_info_config where conf_id in
  81. <foreach item="confId" collection="array" open="(" separator="," close=")">
  82. #{confId}
  83. </foreach>
  84. </delete>
  85. <resultMap type="ConfigDictData" id="ConfigDictDataResult">
  86. <result property="v" column="dict_value" />
  87. <result property="n" column="dict_label" />
  88. <result property="childDictType" column="child_dict_type" />
  89. </resultMap>
  90. <select id="selectDictDataListByDictType" parameterType="String" resultMap="ConfigDictDataResult">
  91. select d.dict_value, d.dict_label ,d.child_dict_type from sys_dict_data d where d.dict_type = #{dictType}
  92. </select>
  93. <select id="checkSysConfigExistByTypeCdAndSceneTpCd" parameterType="SysInfoConfig" resultType="int">
  94. select count(1) from sys_info_config s where s.type_cd = #{typeCd} and s.scene_tp_cd = #{sceneTpCd}
  95. <if test="confId != null">
  96. and s.conf_id != #{confId}
  97. </if>
  98. </select>
  99. </mapper>