CrtLoraStyleDao.xml 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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.backendsys.modules.crt.dao.CrtLoraStyleDao">
  4. <sql id="includeCrtLoraStyle">
  5. s.id,
  6. s.category_id,
  7. COALESCE(sc.category_name, '') category_name,
  8. s.name,
  9. COALESCE(s.thumb, '') thumb,
  10. s.lora_style_name,
  11. s.lora_style_path
  12. </sql>
  13. <resultMap id="resultMapCrtLoraStyle" type="java.util.LinkedHashMap">
  14. <id property="id" column="id" jdbcType="BIGINT" />
  15. <result property="category_id" column="category_id" javaType="java.lang.Long" />
  16. <result property="category_name" column="category_name" />
  17. <result property="name" column="name" />
  18. <result property="thumb" column="thumb" />
  19. <result property="lora_style_name" column="lora_style_name" />
  20. <result property="lora_style_path" column="lora_style_path" />
  21. </resultMap>
  22. <!-- 查 列表 -->
  23. <select id="selectCrtLoraStyleList" resultMap="resultMapCrtLoraStyle">
  24. SELECT
  25. <include refid="includeCrtLoraStyle" />
  26. FROM crt_lora_style s
  27. LEFT JOIN crt_lora_style_category sc ON s.category_id = sc.id
  28. <where>
  29. <if test="category_id != null and category_id != ''">
  30. AND s.category_id = #{category_id}
  31. </if>
  32. <if test="name != null and name != ''">
  33. AND s.name LIKE CONCAT('%', #{name}, '%')
  34. </if>
  35. </where>
  36. </select>
  37. </mapper>