123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- <?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.ruoyi.system.mapper.ZbGalleryMapper">
- <resultMap type="com.ruoyi.system.domain.grallery.ZbGallery" id="ZbGalleryResult">
- <result property="id" column="id"/>
- <result property="name" column="name"/>
- <result property="cnName" column="cn_name"/>
- <result property="ptName" column="pt_name"/>
- <result property="latinName" column="latin_name"/>
- <result property="distribution" column="distribution"/>
- <result property="host" column="host"/>
- <result property="form" column="form"/>
- <result property="symptom" column="symptom"/>
- <result property="category" column="category"/>
- <result property="categoryId" column="category_id"/>
- <result property="createBy" column="create_by"/>
- <result property="createTime" column="create_time"/>
- <result property="updateBy" column="update_by"/>
- <result property="updateTime" column="update_time"/>
- <result property="remark" column="remark"/>
- </resultMap>
- <sql id="selectZbGalleryVo">
- select id, name, cn_name, pt_name, latin_name, distribution, years, celebrity, host, form, symptom, category, category_id, create_by, create_time, update_by, update_time, remark from zb_gallery
- </sql>
- <select id="selectZbGalleryList" resultType="com.ruoyi.system.dto.GalleryDto">
- SELECT
- zg.*,
- zgc.`name` categoryName
- FROM
- zb_gallery zg
- JOIN zb_gallery_category zgc on zgc.id = zg.category_id
- <where>
- <if test="obj != null">
- <if test="obj.name != null and obj.name != ''">
- and zg.name like concat('%', #{obj.name}, '%')
- </if>
- <if test="obj.cnName != null and obj.cnName != ''">
- and zg.cn_name like concat('%', #{obj.cnName}, '%')
- </if>
- <if test="obj.ptName != null and obj.ptName != ''">
- and zg.pt_name like concat('%', #{obj.ptName}, '%')
- </if>
- <if test="obj.latinName != null and obj.latinName != ''">
- and zg.latin_name like concat('%', #{obj.latinName}, '%')
- </if>
- <if test="obj.distribution != null and obj.distribution != ''">
- and zg.distribution = #{obj.distribution}
- </if>
- <if test="obj.host != null and obj.host != ''">
- and zg.host = #{obj.host}
- </if>
- <if test="obj.form != null and obj.form != ''">
- and zg.form = #{obj.form}
- </if>
- <if test="obj.symptom != null and obj.symptom != ''">
- and zg.symptom = #{obj.symptom}
- </if>
- <if test="obj.category != null and obj.category != ''">
- and zg.category = #{obj.category}
- </if>
- <if test="obj.categoryId != null ">
- and zg.category_id = #{obj.categoryId}
- </if>
- </if>
- </where>
- order by zg.create_time DESC
- </select>
- <resultMap id="GalleryDtoMap" type="com.ruoyi.system.dto.GalleryDto">
- <result property="id" column="id"/>
- <result property="name" column="name"/>
- <result property="cnName" column="cn_name"/>
- <result property="ptName" column="pt_name"/>
- <result property="latinName" column="latin_name"/>
- <result property="distribution" column="distribution"/>
- <result property="host" column="host"/>
- <result property="years" column="years"/>
- <result property="celebrity" column="celebrity"/>
- <result property="form" column="form"/>
- <result property="symptom" column="symptom"/>
- <result property="category" column="category"/>
- <result property="categoryId" column="category_id"/>
- <result property="remark" column="remark"/>
- <result property="categoryName" column="categoryName"/>
- <collection property="imgInfos" ofType="com.ruoyi.system.dto.GalleryDto$ImgInfosDTO">
- <result property="author" column="author"/>
- <result property="location" column="location"/>
- <result property="watermarkType" column="watermark_type"/>
- <result property="watermarkColor" column="watermark_color"/>
- <result property="url" column="url"/>
- </collection>
- </resultMap>
- <select id="selectGalleryDto" resultMap="GalleryDtoMap">
- SELECT
- zg.*,
- zf.url,
- zgi.watermark_type,
- zgi.location,
- zgi.author,
- zgc.name categoryName
- FROM
- zb_gallery zg
- LEFT JOIN zb_gallery_img zgi ON zg.id = zgi.gallert_id
- LEFT JOIN zb_file zf ON zf.id = zgi.thumb_id
- left join zb_gallery_category zgc on zgc.id = zg.category_id
- <if test="categoryIds != null and categoryIds.size() > 0">
- WHERE zg.category_id in
- <foreach collection="categoryIds" open="(" close=")" item="item" separator=",">
- #{item}
- </foreach>
- </if>
- </select>
- <select id="selectGalleryDtoThumbnail" resultMap="GalleryDtoMap">
- SELECT
- zg.*,
- ifnull(zf.thumbnail_url,zf.url) as url,
- zgi.watermark_type,
- zgi.location,
- zgi.author,
- zgc.name categoryName
- FROM
- zb_gallery zg
- LEFT JOIN zb_gallery_img zgi ON zg.id = zgi.gallert_id
- LEFT JOIN zb_file zf ON zf.id = zgi.thumb_id
- left join zb_gallery_category zgc on zgc.id = zg.category_id
- <if test="categoryIds != null and categoryIds.size() > 0">
- WHERE zg.category_id in
- <foreach collection="categoryIds" open="(" close=")" item="item" separator=",">
- #{item}
- </foreach>
- </if>
- ORDER BY zg.name
- </select>
- <select id="checkCategoryHasValue" resultType="java.lang.Integer">
- SELECT
- 1
- FROM
- zb_gallery where category_id = #{categoryId} limit 1
- </select>
- </mapper>
|