| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365 |
- <?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.web.pcApi.mapper.TCommodityManageMapper">
-
- <resultMap type="TCommodityManage" id="TCommodityManageResult">
- <result property="id" column="id" />
- <result property="typeId" column="type_id" />
- <result property="typeSelected" column="type_selected" />
- <result property="commodityName" column="commodity_name" />
- <result property="departurePlace" column="departure_place" />
- <result property="adultPrice" column="adult_price" />
- <result property="childPrice" column="child_price" />
- <result property="stock" column="stock" />
- <result property="childPriceExplain" column="child_price_explain" />
- <result property="faceImg" column="face_img" />
- <result property="commodityImg" column="commodity_img" />
- <result property="isCoupon" column="is_coupon" />
- <result property="periodStart" column="period_start" />
- <result property="periodEnd" column="period_end" />
- <result property="periodWeek" column="period_week" />
- <result property="targetPeopleNum" column="target_people_num" />
- <result property="advancePeriod" column="advance_period" />
- <result property="attention" column="attention" />
- <result property="specification" column="specification" />
- <result property="saleNum" column="sale_num" />
- <result property="isRecommend" column="is_recommend" />
- <result property="isPreferred" column="is_preferred" />
- <result property="status" column="status" />
- <result property="deptId" column="dept_id" />
- <result property="delFlag" column="del_flag" />
- <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" />
- <result property="typeName" column="type_name" />
- </resultMap>
- <resultMap id="TCommodityManageTCommodityJourneyInformationResult" type="TCommodityManage" extends="TCommodityManageResult">
- <collection property="commodityJourneyInformationList" notNullColumn="sub_id" javaType="java.util.List" resultMap="TCommodityJourneyInformationResult" />
- </resultMap>
- <resultMap type="TCommodityJourneyInformation" id="TCommodityJourneyInformationResult">
- <result property="id" column="sub_id" />
- <result property="commodityId" column="sub_commodity_id" />
- <result property="journeyTime" column="sub_journey_time" />
- <result property="detail" column="sub_detail" />
- <result property="createBy" column="sub_create_by" />
- <result property="createTime" column="sub_create_time" />
- <result property="updateBy" column="sub_update_by" />
- <result property="updateTime" column="sub_update_time" />
- <result property="remark" column="sub_remark" />
- </resultMap>
- <sql id="selectTCommodityManageVo">
- SELECT
- a.id,
- a.type_id,
- a.type_selected,
- a.commodity_name,
- a.departure_place,
- a.adult_price,
- a.child_price,
- a.stock,
- a.child_price_explain,
- a.face_img,
- a.commodity_img,
- a.is_coupon,
- a.period_start,
- a.period_end,
- a.period_week,
- a.target_people_num,
- a.advance_period,
- a.attention,
- a.specification,
- a.sale_num,
- a.is_recommend,
- a.is_preferred,
- a.STATUS,
- a.dept_id,
- a.del_flag,
- a.create_by,
- a.create_time,
- a.update_by,
- a.update_time,
- a.remark,
- b.type_name
- FROM
- t_commodity_manage a
- INNER JOIN sys_dept c on c.dept_id = a.dept_id
- <if test="liffId != null "> and c.liff_id = #{liffId}</if>
- LEFT JOIN t_commodity_type b on a.type_id = b.id
- </sql>
- <select id="selectTCommodityManageList" parameterType="TCommodityManage" resultMap="TCommodityManageResult">
- <include refid="selectTCommodityManageVo"/>
- where a.del_flag = '0'
- <if test="typeId != null "> and a.type_id = #{typeId}</if>
- <if test="typeSelected != null "> and a.type_selected = #{typeSelected}</if>
- <if test="commodityName != null and commodityName != ''"> and a.commodity_name like concat('%', #{commodityName}, '%')</if>
- <if test="departurePlace != null and departurePlace != ''"> and a.departure_place = #{departurePlace}</if>
- <if test="adultPrice != null "> and a.adult_price = #{adultPrice}</if>
- <if test="childPrice != null "> and a.child_price = #{childPrice}</if>
- <if test="stock != null "> and a.stock = #{stock}</if>
- <if test="childPriceExplain != null and childPriceExplain != ''"> and a.child_price_explain = #{childPriceExplain}</if>
- <if test="faceImg != null and faceImg != ''"> and a.face_img = #{faceImg}</if>
- <if test="commodityImg != null and commodityImg != ''"> and a.commodity_img = #{commodityImg}</if>
- <if test="isCoupon != null and isCoupon != ''"> and a.is_coupon = #{isCoupon}</if>
- <if test="periodStart != null and periodStart != ''"> and a.period_start = #{periodStart}</if>
- <if test="periodEnd != null and periodEnd != ''"> and a.period_end = #{periodEnd}</if>
- <if test="periodWeek != null and periodWeek != ''"> and a.period_week = #{periodWeek}</if>
- <if test="targetPeopleNum != null "> and a.target_people_num = #{targetPeopleNum}</if>
- <if test="advancePeriod != null "> and a.advance_period = #{advancePeriod}</if>
- <if test="attention != null and attention != ''"> and a.attention = #{attention}</if>
- <if test="specification != null and specification != ''"> and a.specification = #{specification}</if>
- <if test="saleNum != null "> and a.sale_num = #{saleNum}</if>
- <if test="isRecommend != null and isRecommend != ''"> and a.is_recommend = #{isRecommend}</if>
- <if test="isPreferred != null and isPreferred != ''"> and a.is_preferred = #{isPreferred}</if>
- <if test="status != null and status != ''"> and a.status = #{status}</if>
- <if test="deptId != null "> and a.dept_id = #{deptId}</if>
- <if test="params.beginDate != null and params.beginDate != ''"><!-- 开始时间检索 -->
- and date_format(a.period_start,'%y%m%d') >= date_format(#{params.beginDate},'%y%m%d')
- </if>
- <if test="params.endDate != null and params.endDate != ''"><!-- 结束时间检索 -->
- and date_format(a.period_end,'%y%m%d') <= date_format(#{params.endDate},'%y%m%d')
- </if>
- <!-- 数据范围过滤 -->
- ${params.dataScope}
- order by a.create_time desc
- </select>
- <select id="selectTCommodityManageList4H5" parameterType="TCommodityManage" resultMap="TCommodityManageResult">
- <include refid="selectTCommodityManageVo"/>
- where a.del_flag = '0' and date_format(now(),'%Y-%m-%d') <= a.period_end
- <if test="typeId != null "> and a.type_selected like concat('%', #{typeId},'%')</if>
- <if test="commodityName != null and commodityName != ''"> and a.commodity_name like concat('%', #{commodityName}, '%')</if>
- <if test="departurePlace != null and departurePlace != ''"> and a.departure_place = #{departurePlace}</if>
- <if test="adultPrice != null "> and a.adult_price = #{adultPrice}</if>
- <if test="childPrice != null "> and a.child_price = #{childPrice}</if>
- <if test="stock != null "> and a.stock = #{stock}</if>
- <if test="childPriceExplain != null and childPriceExplain != ''"> and a.child_price_explain = #{childPriceExplain}</if>
- <if test="faceImg != null and faceImg != ''"> and a.face_img = #{faceImg}</if>
- <if test="commodityImg != null and commodityImg != ''"> and a.commodity_img = #{commodityImg}</if>
- <if test="isCoupon != null and isCoupon != ''"> and a.is_coupon = #{isCoupon}</if>
- <if test="periodStart != null and periodStart != ''"> and a.period_start = #{periodStart}</if>
- <if test="periodEnd != null and periodEnd != ''"> and a.period_end = #{periodEnd}</if>
- <if test="periodWeek != null and periodWeek != ''"> and a.period_week = #{periodWeek}</if>
- <if test="targetPeopleNum != null "> and a.target_people_num = #{targetPeopleNum}</if>
- <if test="advancePeriod != null "> and a.advance_period = #{advancePeriod}</if>
- <if test="attention != null and attention != ''"> and a.attention = #{attention}</if>
- <if test="specification != null and specification != ''"> and a.specification = #{specification}</if>
- <if test="saleNum != null "> and a.sale_num = #{saleNum}</if>
- <if test="isRecommend != null and isRecommend != ''"> and a.is_recommend = #{isRecommend}</if>
- <if test="isPreferred != null and isPreferred != ''"> and a.is_preferred = #{isPreferred}</if>
- <if test="status != null and status != ''"> and a.status = #{status}</if>
- <if test="deptId != null "> and a.dept_id = #{deptId}</if>
- <if test="params.beginDate != null and params.beginDate != ''"><!-- 开始时间检索 -->
- and date_format(a.create_time,'%y%m%d') >= date_format(#{params.beginDate},'%y%m%d')
- </if>
- <if test="params.endDate != null and params.endDate != ''"><!-- 结束时间检索 -->
- and date_format(a.create_time,'%y%m%d') <= date_format(#{params.endDate},'%y%m%d')
- </if>
- order by a.create_time desc
- </select>
-
- <select id="selectTCommodityManageById" parameterType="Long" resultMap="TCommodityManageTCommodityJourneyInformationResult">
- select a.id, a.type_id, a.type_selected, a.commodity_name, a.departure_place, a.adult_price, a.child_price, a.stock, a.child_price_explain, a.face_img, a.commodity_img, a.is_coupon, a.period_start, a.period_end, a.period_week, a.target_people_num, a.advance_period, a.attention, a.specification, a.sale_num, a.is_recommend, a.is_preferred, a.status, a.dept_id, a.del_flag, a.create_by, a.create_time, a.update_by, a.update_time, a.remark,
- b.id as sub_id, b.commodity_id as sub_commodity_id, b.journey_time as sub_journey_time, b.detail as sub_detail, b.create_by as sub_create_by, b.create_time as sub_create_time, b.update_by as sub_update_by, b.update_time as sub_update_time, b.remark as sub_remark
- from t_commodity_manage a
- left join t_commodity_journey_information b on b.commodity_id = a.id
- where a.id = #{id}
- </select>
-
- <insert id="insertTCommodityManage" parameterType="TCommodityManage" useGeneratedKeys="true" keyProperty="id">
- insert into t_commodity_manage
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="typeId != null">type_id,</if>
- <if test="typeSelected != null">type_selected,</if>
- <if test="commodityName != null and commodityName != ''">commodity_name,</if>
- <if test="departurePlace != null and departurePlace != ''">departure_place,</if>
- <if test="adultPrice != null">adult_price,</if>
- <if test="childPrice != null">child_price,</if>
- <if test="stock != null">stock,</if>
- <if test="childPriceExplain != null and childPriceExplain != ''">child_price_explain,</if>
- <if test="faceImg != null and faceImg != ''">face_img,</if>
- <if test="commodityImg != null and commodityImg != ''">commodity_img,</if>
- <if test="isCoupon != null and isCoupon != ''">is_coupon,</if>
- <if test="periodStart != null and periodStart != ''">period_start,</if>
- <if test="periodEnd != null and periodEnd != ''">period_end,</if>
- <if test="periodWeek != null and periodWeek != ''">period_week,</if>
- <if test="targetPeopleNum != null">target_people_num,</if>
- <if test="advancePeriod != null">advance_period,</if>
- <if test="attention != null and attention != ''">attention,</if>
- <if test="specification != null and specification != ''">specification,</if>
- <if test="saleNum != null">sale_num,</if>
- <if test="isRecommend != null">is_recommend,</if>
- <if test="isPreferred != null">is_preferred,</if>
- <if test="status != null">status,</if>
- <if test="deptId != null">dept_id,</if>
- <if test="delFlag != null">del_flag,</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="remark != null">remark,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="typeId != null">#{typeId},</if>
- <if test="typeSelected != null">#{typeSelected},</if>
- <if test="commodityName != null and commodityName != ''">#{commodityName},</if>
- <if test="departurePlace != null and departurePlace != ''">#{departurePlace},</if>
- <if test="adultPrice != null">#{adultPrice},</if>
- <if test="childPrice != null">#{childPrice},</if>
- <if test="stock != null">#{stock},</if>
- <if test="childPriceExplain != null and childPriceExplain != ''">#{childPriceExplain},</if>
- <if test="faceImg != null and faceImg != ''">#{faceImg},</if>
- <if test="commodityImg != null and commodityImg != ''">#{commodityImg},</if>
- <if test="isCoupon != null and isCoupon != ''">#{isCoupon},</if>
- <if test="periodStart != null and periodStart != ''">#{periodStart},</if>
- <if test="periodEnd != null and periodEnd != ''">#{periodEnd},</if>
- <if test="periodWeek != null and periodWeek != ''">#{periodWeek},</if>
- <if test="targetPeopleNum != null">#{targetPeopleNum},</if>
- <if test="advancePeriod != null">#{advancePeriod},</if>
- <if test="attention != null and attention != ''">#{attention},</if>
- <if test="specification != null and specification != ''">#{specification},</if>
- <if test="saleNum != null">#{saleNum},</if>
- <if test="isRecommend != null">#{isRecommend},</if>
- <if test="isPreferred != null">#{isPreferred},</if>
- <if test="status != null">#{status},</if>
- <if test="deptId != null">#{deptId},</if>
- <if test="delFlag != null">#{delFlag},</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="remark != null">#{remark},</if>
- </trim>
- </insert>
- <update id="updateTCommodityManage" parameterType="TCommodityManage">
- update t_commodity_manage
- <trim prefix="SET" suffixOverrides=",">
- <if test="typeId != null">type_id = #{typeId},</if>
- <if test="typeSelected != null">type_selected = #{typeSelected},</if>
- <if test="commodityName != null and commodityName != ''">commodity_name = #{commodityName},</if>
- <if test="departurePlace != null and departurePlace != ''">departure_place = #{departurePlace},</if>
- <if test="adultPrice != null">adult_price = #{adultPrice},</if>
- <if test="childPrice != null">child_price = #{childPrice},</if>
- <if test="stock != null">stock = #{stock},</if>
- <if test="childPriceExplain != null and childPriceExplain != ''">child_price_explain = #{childPriceExplain},</if>
- <if test="faceImg != null and faceImg != ''">face_img = #{faceImg},</if>
- <if test="commodityImg != null and commodityImg != ''">commodity_img = #{commodityImg},</if>
- <if test="isCoupon != null and isCoupon != ''">is_coupon = #{isCoupon},</if>
- <if test="periodStart != null and periodStart != ''">period_start = #{periodStart},</if>
- <if test="periodEnd != null and periodEnd != ''">period_end = #{periodEnd},</if>
- <if test="periodWeek != null and periodWeek != ''">period_week = #{periodWeek},</if>
- <if test="targetPeopleNum != null">target_people_num = #{targetPeopleNum},</if>
- <if test="advancePeriod != null">advance_period = #{advancePeriod},</if>
- <if test="attention != null and attention != ''">attention = #{attention},</if>
- <if test="specification != null and specification != ''">specification = #{specification},</if>
- <if test="saleNum != null">sale_num = #{saleNum},</if>
- <if test="isRecommend != null">is_recommend = #{isRecommend},</if>
- <if test="isPreferred != null">is_preferred = #{isPreferred},</if>
- <if test="status != null">status = #{status},</if>
- <if test="deptId != null">dept_id = #{deptId},</if>
- <if test="delFlag != null">del_flag = #{delFlag},</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="remark != null">remark = #{remark},</if>
- </trim>
- where id = #{id}
- </update>
- <delete id="deleteTCommodityManageById" parameterType="Long">
- delete from t_commodity_manage where id = #{id}
- </delete>
- <delete id="deleteTCommodityManageByIds" parameterType="String">
- delete from t_commodity_manage where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
-
- <delete id="deleteTCommodityJourneyInformationByCommodityIds" parameterType="String">
- delete from t_commodity_journey_information where commodity_id in
- <foreach item="commodityId" collection="array" open="(" separator="," close=")">
- #{commodityId}
- </foreach>
- </delete>
- <delete id="deleteTCommodityJourneyInformationByCommodityId" parameterType="Long">
- delete from t_commodity_journey_information where commodity_id = #{commodityId}
- </delete>
- <delete id="deleteTCommoditySchedulByCommodityId" parameterType="Long">
- delete from t_commodity_schedul where commodity_id = #{commodityId}
- </delete>
- <insert id="batchTCommodityJourneyInformation">
- insert into t_commodity_journey_information( id, commodity_id, journey_time, detail, create_by, create_time, update_by, update_time, remark) values
- <foreach item="item" index="index" collection="list" separator=",">
- ( #{item.id}, #{item.commodityId}, #{item.journeyTime}, #{item.detail}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}, #{item.remark})
- </foreach>
- </insert>
- <insert id="batchTCommoditySchedul">
- insert into t_commodity_schedul( commodity_id, departure_date, dept_id, create_by, create_time, update_by, update_time, remark,seat_num) values
- <foreach item="item" index="index" collection="list" separator=",">
- ( #{item.commodityId}, #{item.departureDate}, #{item.deptId}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}, #{item.remark}, #{item.seatNum})
- </foreach>
- </insert>
- <select id="selectSameTypeCommodityTop5" resultMap="TCommodityManageResult">
- <include refid="selectTCommodityManageVo"/>
- where a.status = '0'
- <if test="id != null"> and a.id != #{id}</if>
- <if test="typeId != null"> and a.type_id = #{typeId}</if>
- <if test="deptId != null"> and a.dept_id = #{deptId}</if>
- order by a.sale_num ASC
- limit 5
- </select>
- <select id="selectSalesTop10" parameterType="tCommodityManage" resultMap="TCommodityManageResult">
- <include refid="selectTCommodityManageVo"/>
- where a.del_flag = '0'
- <if test="typeId != null "> and a.type_id = #{typeId}</if>
- <if test="typeSelected != null "> and a.type_selected = #{typeSelected}</if>
- <if test="commodityName != null and commodityName != ''"> and a.commodity_name like concat('%', #{commodityName}, '%')</if>
- <if test="departurePlace != null and departurePlace != ''"> and a.departure_place = #{departurePlace}</if>
- <if test="adultPrice != null "> and a.adult_price = #{adultPrice}</if>
- <if test="childPrice != null "> and a.child_price = #{childPrice}</if>
- <if test="stock != null "> and a.stock = #{stock}</if>
- <if test="childPriceExplain != null and childPriceExplain != ''"> and a.child_price_explain = #{childPriceExplain}</if>
- <if test="faceImg != null and faceImg != ''"> and a.face_img = #{faceImg}</if>
- <if test="commodityImg != null and commodityImg != ''"> and a.commodity_img = #{commodityImg}</if>
- <if test="isCoupon != null and isCoupon != ''"> and a.is_coupon = #{isCoupon}</if>
- <if test="periodStart != null and periodStart != ''"> and a.period_start = #{periodStart}</if>
- <if test="periodEnd != null and periodEnd != ''"> and a.period_end = #{periodEnd}</if>
- <if test="periodWeek != null and periodWeek != ''"> and a.period_week = #{periodWeek}</if>
- <if test="targetPeopleNum != null "> and a.target_people_num = #{targetPeopleNum}</if>
- <if test="advancePeriod != null "> and a.advance_period = #{advancePeriod}</if>
- <if test="attention != null and attention != ''"> and a.attention = #{attention}</if>
- <if test="specification != null and specification != ''"> and a.specification = #{specification}</if>
- <if test="saleNum != null "> and a.sale_num = #{saleNum}</if>
- <if test="isRecommend != null and isRecommend != ''"> and a.is_recommend = #{isRecommend}</if>
- <if test="isPreferred != null and isPreferred != ''"> and a.is_preferred = #{isPreferred}</if>
- <if test="status != null and status != ''"> and a.status = #{status}</if>
- <if test="deptId != null "> and a.dept_id = #{deptId}</if>
- <if test="params.beginDate != null and params.beginDate != ''"><!-- 开始时间检索 -->
- and date_format(a.create_time,'%y%m%d') >= date_format(#{params.beginDate},'%y%m%d')
- </if>
- <if test="params.endDate != null and params.endDate != ''"><!-- 结束时间检索 -->
- and date_format(a.create_time,'%y%m%d') <= date_format(#{params.endDate},'%y%m%d')
- </if>
- order by a.sale_num DESC
- limit 10
- </select>
- </mapper>
|