SysDicMapper.xml 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.gxzc.zen.api.sys.mapper.SysDicMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.gxzc.zen.api.sys.model.SysDic">
  6. <result column="id" property="id"/>
  7. <result column="enable" property="enable"/>
  8. <result column="remark" property="remark"/>
  9. <result column="create_time" property="createTime"/>
  10. <result column="create_by" property="createBy"/>
  11. <result column="update_time" property="updateTime"/>
  12. <result column="update_by" property="updateBy"/>
  13. <result column="key" property="key"/>
  14. <result column="value" property="value"/>
  15. <result column="label" property="label"/>
  16. <result column="sort" property="sort"/>
  17. </resultMap>
  18. <sql id="dynamicSqlWhere">
  19. WHERE 1=1
  20. <if test="enable != null">
  21. <choose>
  22. <when test="enable == true">
  23. AND enable = 1
  24. </when>
  25. <otherwise>
  26. AND enable = 0
  27. </otherwise>
  28. </choose>
  29. </if>
  30. <if test="key != null and key != ''">
  31. AND `key` = #{key}
  32. </if>
  33. </sql>
  34. <select id="selectList" resultType="com.gxzc.zen.api.sys.model.SysDic">
  35. SELECT *
  36. FROM sys_dic
  37. <include refid="dynamicSqlWhere"/>
  38. </select>
  39. </mapper>