123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277 |
- <?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.PoTetherMapper">
- <resultMap type="PoTether" id="PoTetherResult">
- <result property="tetherId" column="tether_id" />
- <result property="tetherName" column="tether_name" />
- <result property="showTime" column="show_time" />
- <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="total" column="total" />
- <result property="status" column="status" />
- <result property="remark" column="remark" />
- <result property="sellStatus" column="sell_status"/>
- <result property="delFlag" column="del_flag"/>
- <result property="image" column="image" />
- <result property="exchange" column="exchange"/>
- <result property="grounding" column="grounding" />
- <result property="cochain" column="cochain" />
- </resultMap>
- <resultMap type="PoTetherandcollection" id="PoTetherandcollectionResult">
- <result property="collectionId" column="collection_id" />
- <result property="collectionTitle" column="collection_title" />
- <result property="status" column="status" />
- <result property="collectionType" column="collection_type" />
- <result property="createTime" column="create_time" />
- <result property="createBy" column="create_by" />
- <result property="updateTime" column="update_time" />
- <result property="updateBy" column="update_by" />
- <result property="delFlag" column="del_flag" />
- <result property="total" column="total" />
- <result property="remark" column="remark" />
- <result property="image" column="image" />
- <result property="formwork" column="formwork" />
- <result property="price" column="price" />
- <result property="publisherName" column="publisher_name" />
- <result property="story" column="story" />
- <result property="grounding" column="grounding" />
- <result property="cochain" column="cochain" />
- <result property="tetherId" column="tether_id" />
- </resultMap>
- <sql id="selectPoTetherVo">
- select tether_id, tether_name, show_time, create_by, create_time, update_by, update_time, total, status, remark ,sell_status,del_flag,image,exchange ,grounding,cochain ,tether_id from po_tether
- </sql>
- <!--在售-->
- <select id="selectPoTetherSellingList" parameterType="PoTether" resultMap="PoTetherResult">
- <include refid="selectPoTetherVo"/>
- <where>
- <if test="tetherName != null and tetherName != ''"> and tether_name like concat('%', #{tetherName}, '%')</if>
- <if test="showTime != null "> and show_time = #{showTime}</if>
- <if test="total != null "> and total = #{total}</if>
- <if test="status != null and status != ''"> and status = #{status}</if>
- <if test="image != null and image != '' ">and image = #{image}</if>
- <if test="exchange != null">and exchange = #{exchange}</if>
- <if test="grounding != null">and grounding = #{grounding}</if>
- <if test="cochain != null">and cochain = #{cochain}</if>
- <if test="tetherId != null">and tether_id = #{tetherId}</if>
- and del_flag = '0'
- and sell_status = 0
- </where>
- </select>
- <!--获取详细信息-->
- <select id="selectPoTetherByTetherId" parameterType="Long" resultMap="PoTetherResult">
- <include refid="selectPoTetherVo"/>
- where tether_id = #{tetherId}
- </select>
- <!-- 标题时间都不为空-->
- <select id="selectPoTetherListByTitleAndTetherTimeStartAndTetherTimeEnd"
- resultType="PoTether" resultMap="PoTetherResult">
- <include refid="selectPoTetherVo"></include>
- <where>
- <if test="tetherName != null and tetherName != ''"> and tether_name like concat('%', #{tetherName}, '%')</if>
- <if test="tetherTimeStart != null and tetherTimeEnd != null "> and show_time between #{tetherTimeStart} and #{tetherTimeEnd}</if>
- </where>
- </select>
- <!--预售-->
- <select id="selectPoTetherAdvanceList" resultType="PoTether" resultMap="PoTetherResult">
- <include refid="selectPoTetherVo"/>
- <where>
- <if test="tetherName != null and tetherName != ''"> and tether_name like concat('%', #{tetherName}, '%')</if>
- <if test="showTime != null "> and show_time = #{showTime}</if>
- <if test="total != null "> and total = #{total}</if>
- <if test="status != null and status != ''"> and status = #{status}</if>
- <if test="image != null and image != '' ">and image = #{image}</if>
- <if test="exchange != null">and exchange = #{exchange}</if>
- <if test="grounding != null">and grounding = #{grounding}</if>
- <if test="cochain != null">and cochain = #{cochain}</if>
- <if test="tetherId != null">and tether_id = #{tetherId}</if>
- and del_flag = '0'
- and sell_status = 1
- </where>
- </select>
- <!--已过期-->
- <select id="selectPoTetherSelledList" resultType="PoTether" resultMap="PoTetherResult">
- <include refid="selectPoTetherVo"/>
- <where>
- <if test="tetherName != null and tetherName != ''"> and tether_name like concat('%', #{tetherName}, '%')</if>
- <if test="showTime != null "> and show_time = #{showTime}</if>
- <if test="total != null "> and total = #{total}</if>
- <if test="status != null and status != ''"> and status = #{status}</if>
- <if test="image != null and image != '' ">and image = #{image}</if>
- <if test="exchange != null">and exchange = #{exchange}</if>
- <if test="grounding != null">and grounding = #{grounding}</if>
- <if test="cochain != null">and cochain = #{cochain}</if>
- <if test="tetherId != null">and tether_id = #{tetherId}</if>
- and del_flag = '0'
- and sell_status = 2
- </where>
- </select>
- <!--全为空时-->
- <select id="selectPoTetherList" resultType="PoTether" resultMap="PoTetherResult">
- <include refid="selectPoTetherVo"/>
- <where>
- <if test="tetherName != null and tetherName != ''"> and tether_name like concat('%', #{tetherName}, '%')</if>
- <if test="showTime != null "> and show_time = #{showTime}</if>
- <if test="total != null "> and total = #{total}</if>
- <if test="status != null and status != ''"> and status = #{status}</if>
- <if test="image != null and image != '' ">and image = #{image}</if>
- <if test="exchange != null">and exchange = #{exchange}</if>
- <if test="grounding != null">and grounding = #{grounding}</if>
- <if test="cochain != null">and cochain = #{cochain}</if>
- <if test="tetherId != null">and tether_id = #{tetherId}</if>
- and del_flag = '0'
- </where>
- </select>
- <!-- 根据套系id 查询对应藏品按钮里面的藏品信息-->
- <select id="selectPoCollectionListById" resultMap="PoTetherandcollectionResult" >
- select c.collection_title , c.image , c.collection_type , c.create_time , c.create_by
- , c.total , c.status , c.price , c.story , c.grounding , c.cochain ,c.tether_id from po_Tetherandcollection c
- left join po_tether t on t.tether_id = c.tether_id where t.tether_id = #{tetherId}
- </select>
- <!-- 检验标题是否重复-->
- <select id="checkPostTetherTitleUnique" resultType="String" resultMap="PoTetherResult">
- select tether_id, tether_name from po_tether where tether_name = #{tetherName} and del_flag = '0' limit 1
- </select>
- <!-- 检验图片是否重复-->
- <select id="checkPostTetherImageUnique" resultType="String" resultMap="PoTetherResult">
- select tether_id,image from po_tether where image = #{image} and del_flag = '0' limit 1
- </select>
- <!-- 通过id批量查询套系信息-->
- <select id="selectPoTetherByTetherIds" resultType="PoTether">
- <include refid="selectPoTetherVo"/>
- where tether_id in
- <foreach item="tetherId" collection="array" open="(" separator="," close=")">
- #{tetherId}
- </foreach>
- </select>
- <!-- 查询更新完种类数的套系信息-->
- <select id="selectPoTetherCollectionList" resultType="PoTether" resultMap="PoTetherResult">
- <include refid="selectPoTetherVo"/>
- <if test="tetherName != null and tetherName != ''"> and tether_name like concat('%', #{tetherName}, '%')</if>
- <if test="showTime != null "> and show_time = #{showTime}</if>
- <if test="total != null "> and total = #{total}</if>
- <if test="status != null and status != ''"> and status = #{status}</if>
- <if test="image != null and image != '' ">and image = #{image}</if>
- <if test="exchange != null">and exchange = #{exchange}</if>
- <if test="grounding != null">and grounding = #{grounding}</if>
- <if test="cochain != null">and cochain = #{cochain}</if>
- <if test="tetherId != null">and tether_id = #{tetherId}</if>
- </select>
- <!--新增-->
- <insert id="insertPoTether" parameterType="PoTether" useGeneratedKeys="true" keyProperty="tetherId">
- insert into po_tether
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="tetherName != null">tether_name,</if>
- <if test="showTime != null">show_time,</if>
- <if test="createBy != null">create_by,</if>
- <if test="createTime != null">create_time,</if>
- <if test="updateBy != null">update_by,</if>
- <if test="updateTime != null">update_time,</if>
- <if test="total != null">total,</if>
- <if test="status != null">status,</if>
- <if test="remark != null">remark,</if>
- <if test="sellStatus != null">sell_status,</if>
- <if test="image != null and image != ''">image,</if>
- <if test="exchange != null">exchange,</if>
- <if test="grounding != null">grounding,</if>
- <if test="cochain != null">cochain,</if>
- <if test="tetherId != null ">tether_id,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="tetherName != null">#{tetherName},</if>
- <if test="showTime != null">#{showTime},</if>
- <if test="createBy != null">#{createBy},</if>
- <if test="createTime != null">#{createTime},</if>
- <if test="updateBy != null">#{updateBy},</if>
- <if test="updateTime != null">#{updateTime},</if>
- <if test="total != null">#{total},</if>
- <if test="status != null">#{status},</if>
- <if test="remark != null">#{remark},</if>
- <if test="sellStatus != null">#{sellStatus},</if>
- <if test="image != null and image != ''">#{image},</if>
- <if test="exchange != null ">#{exchange},</if>
- <if test="grounding != null">#{grounding},</if>
- <if test="cochain != null">#{cochain},</if>
- <if test="tetherId != null">#{tetherId},</if>
- </trim>
- </insert>
- <update id="updatePoTether" parameterType="PoTether">
- update po_tether
- <trim prefix="SET" suffixOverrides=",">
- <if test="tetherName != null">tether_name = #{tetherName},</if>
- <if test="showTime != null">show_time = #{showTime},</if>
- <if test="createBy != null">create_by = #{createBy},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- <if test="updateBy != null">update_by = #{updateBy},</if>
- <if test="updateTime != null">update_time = #{updateTime},</if>
- <if test="total != null">total = #{total},</if>
- <if test="status != null">status = #{status},</if>
- <if test="remark != null">remark = #{remark},</if>
- <if test="sellStatus != null">sell_status = #{sellStatus},</if>
- <if test="image != null and image != ''">image = #{image},</if>
- <if test="exchange != null">exchange = #{exchange},</if>
- <if test="grounding != null">grounding = #{grounding},</if>
- <if test="cochain != null">cochain = #{cochain},</if>
- <if test="tetherId != null">tether_id #{tetherId},</if>
- </trim>
- where tether_id = #{tetherId}
- </update>
- <!--通过Id删除-->
- <delete id="deletePoTetherByTetherId" parameterType="Long">
- delete from po_tether where tether_id = #{tetherId}
- </delete>
- <!-- 逻辑删除接口-->
- <update id="deletePoTetherByTetherIds" parameterType="String">
- update po_tether set del_flag = '1' where tether_id in
- <foreach item="tetherId" collection="array" open="(" separator="," close=")">
- #{tetherId}
- </foreach>
- </update>
- <!-- 修改状态 是否上链-->
- <update id="updatePoTetherIsCochain" parameterType="PoTether">
- update po_tether set cochain = #{cochain} where tether_id = #{tetherId}
- </update>
- <!-- 修改状态 是否上架-->
- <update id="updatePoTetherIsGrounding" parameterType="PoTether">
- update po_tether set grounding = #{grounding} where tether_id = #{tetherId}
- </update>
- <!-- 更新种类-->
- <update id="updatePostTetherCollection" parameterType="PoTether">
- UPDATE po_tether INNER JOIN (
- SELECT
- po_tether.tether_id,
- ( SELECT COUNT( po_Tetherandcollection.tether_id )
- FROM po_Tetherandcollection WHERE po_tether.tether_id = po_Tetherandcollection.tether_id ) AS total
- FROM
- po_tether
- ) a
- ON po_tether.tether_id = a.tether_id
- SET po_tether.total = a.total
- </update>
- </mapper>
|