123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- <?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.fdage.dao.cust.TbCollectionMapperCust">
- <select id="timeList" resultType="com.fdage.pojo.TbCollectionTime">
- select id, name
- from tb_collection_time
- order by order_num
- </select>
- <select id="typeList" resultType="com.fdage.pojo.TbCollectionType">
- select id, name
- from tb_collection_type
- WHERE 1 = 1
- <if test="state != null">
- and state = #{state}
- </if>
- </select>
- <select id="findList" parameterType="com.fdage.request.RequestCollection" resultType="com.fdage.respon.ResponCollection">
- select a.id, a.name, a.type_id as typeId, a.time_id as timeId, a.discovery_time as discoveryTime,
- a.repair_time as repairTime, a.venue, a.model_url as modelUrl, a.content_url as contentUrl, a.state,
- a.create_time as createTime, a.description, b.name as timeName, c.name as typeName, a.pic, a.num,
- a.like_num as likeNum, a.open_num as openNum, a.search_num as searchNum, download_num as downloadNum,
- a.unity_pic as unityPic, a.unity_url as unityUrl, a.icon, a.dir_code as dirCode, a.type, a.url_list, a.qr_code
- from tb_collection a LEFT JOIN tb_collection_time b on a.time_id = b.id
- LEFT JOIN tb_collection_type c ON a.type_id = c.id
- WHERE 1 = 1
- <if test="typeId != null">
- and a.type_id = #{typeId}
- </if>
- <if test="timeId != null">
- and a.time_id = #{timeId}
- </if>
- <if test="name != null and name != ''">
- and a.name LIKE CONCAT('%', #{name}, '%')
- </if>
- <if test="state != null">
- and a.state = #{state}
- </if>
- </select>
- <select id="findListByExhibitionId" parameterType="java.lang.Long" resultType="com.fdage.respon.ResponCollection">
- select a.id, a.name, a.type_id as typeId, a.time_id as timeId, a.discovery_time as discoveryTime,
- a.repair_time as repairTime, a.venue, a.model_url as modelUrl, a.content_url as contentUrl, a.state,
- a.create_time as createTime, a.description, b.name as timeName, c.name as typeName, a.pic, a.num,
- a.like_num as likeNum, a.open_num as openNum, a.search_num as searchNum, download_num as downloadNum,
- a.unity_pic as unityPic, a.unity_url as unityUrl, a.type, a.url_list, a.qr_code
- from tb_collection a LEFT JOIN tb_collection_time b on a.time_id = b.id
- LEFT JOIN tb_collection_type c ON a.type_id = c.id
- LEFT JOIN tb_exhibition_collection d ON a.id = d.collection_id
- WHERE d.exhibition_id = #{id}
- </select>
- <select id="searchListByName" parameterType="com.fdage.request.RequestCollection" resultType="com.fdage.respon.ResponCollection">
- select a.id, a.name, a.type_id as typeId, a.time_id as timeId, a.discovery_time as discoveryTime,
- a.repair_time as repairTime, a.venue, a.model_url as modelUrl, a.content_url as contentUrl, a.state,
- a.create_time as createTime, a.description, b.name as timeName, c.name as typeName, a.pic, a.num,
- a.like_num as likeNum, a.open_num as openNum, a.search_num as searchNum, download_num as downloadNum,
- a.unity_pic as unityPic, a.unity_url as unityUrl, a.type, a.url_list, a.qr_code
- from tb_collection a LEFT JOIN tb_collection_time b on a.time_id = b.id
- LEFT JOIN tb_collection_type c ON a.type_id = c.id
- WHERE 1 = 1
- <if test="name != null and name != ''">
- and a.name LIKE CONCAT('%', #{name}, '%')
- </if>
- <if test="typeId != null and typeId != ''">
- and a.type_id = #{typeId}
- </if>
- </select>
- <update id="addLikeNumById" parameterType="java.lang.Long">
- UPDATE tb_collection SET like_num = like_num + 1 WHERE id = #{id}
- </update>
- <update id="addOpenNumById" parameterType="java.lang.Long">
- UPDATE tb_collection SET open_num = open_num + 1 WHERE id = #{id}
- </update>
- <update id="addSearchNumById" parameterType="java.lang.Long">
- UPDATE tb_collection SET search_num = search_num + 1 WHERE id = #{id}
- </update>
- <update id="addDownloadNumById" parameterType="java.lang.Long">
- UPDATE tb_collection SET download_num = download_num + 1 WHERE id = #{id}
- </update>
- <select id="findByName" parameterType="java.lang.String" resultMap="com.fdage.dao.base.TbCollectionMapper.BaseResultMap">
- select
- <include refid="com.fdage.dao.base.TbCollectionMapper.Base_Column_List" />
- ,
- <include refid="com.fdage.dao.base.TbCollectionMapper.Blob_Column_List" />
- from tb_collection
- where name = #{name}
- </select>
- <select id="collectionTotal" resultType="com.fdage.respon.ResponStatistics">
- SELECT COUNT(*) AS total, SUM(like_num) AS likeTotal, SUM(download_num) AS downloadNum
- FROM `tb_collection`
- </select>
- <select id="findListOrderBy" parameterType="List" resultType="com.fdage.respon.ResponCollection">
- select a.id, a.name, a.type_id as typeId, a.time_id as timeId, a.discovery_time as discoveryTime,
- a.repair_time as repairTime, a.venue, a.model_url as modelUrl, a.content_url as contentUrl, a.state,
- a.create_time as createTime, a.description, b.name as timeName, c.name as typeName, a.pic, a.num,
- a.like_num as likeNum, a.open_num as openNum, a.search_num as searchNum, download_num as downloadNum,
- a.unity_pic as unityPic, a.unity_url as unityUrl, a.type, a.url_list, a.qr_code
- from tb_collection a LEFT JOIN tb_collection_time b on a.time_id = b.id
- LEFT JOIN tb_collection_type c ON a.type_id = c.id
- WHERE 1 = 1
- <choose>
- <when test="sidx != null and sidx.trim() != ''">
- order by ${sidx} ${order}
- </when>
- <otherwise>
- order by a.id desc
- </otherwise>
- </choose>
- </select>
- <select id="typeTotal" resultType="Map">
- SELECT SUM(a.type_id) AS typeNum, b.name AS typeName
- FROM `tb_collection` a LEFT JOIN `tb_collection_type` b ON a.type_id = b.id
- GROUP BY a.type_id
- </select>
- </mapper>
|