123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302 |
- <?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.gree.mall.miniapp.commonmapper.CommonMapper">
- <select id="queryChargingStandrdList" resultType="com.gree.mall.miniapp.bean.chargingstandard.ChargingStandardBean">
- select
- a.* ,
- b.name as 'typeName',
- c.brand_name,
- (select name from goods_category where type=2 and category_id = a.one_category_id) as 'oneCategoryName',
- (select name from goods_category where type=2 and category_id = a.two_category_id) as 'twoCategoryName'
- from charging_standard a
- left join charging_standard_type b on a.charging_standard_type_id = b.id and b.status=1
- join brand c on c.id = a.brand_id
- where a.status=1 and c.status=1
- <if test="id != null and id !=''">
- and a.id = #{id}
- </if>
- <if test="type != null">
- and a.type = #{type}
- </if>
- <if test="brandId != null and brandId !=''">
- and a.brand_id = #{brandId}
- </if>
- <if test="chargingStandardTypeId != null and chargingStandardTypeId != ''">
- and a.charging_standard_type_id = #{chargingStandardTypeId}
- </if>
- <if test="twoCategoryId != null and twoCategoryId !=''">
- and a.two_category_id = #{twoCategoryId}
- </if>
- <if test="companyWechatId != null and companyWechatId !=''">
- and a.company_wechat_id = #{companyWechatId}
- </if>
- group by concat(a.brand_id,a.one_category_id,a.two_category_id,content1)
- order by a.create_time desc
- </select>
- <select id="queryChargingStandrdDetailList" resultType="com.gree.mall.miniapp.bean.chargingstandard.ChargingStandardBean">
- select
- a.* ,
- b.name as 'typeName',
- c.brand_name,
- (select name from goods_category where type=2 and category_id = a.one_category_id) as 'oneCategoryName',
- (select name from goods_category where type=2 and category_id = a.two_category_id) as 'twoCategoryName'
- from charging_standard a
- left join charging_standard_type b on a.charging_standard_type_id = b.id and b.status=1
- join brand c on c.id = a.brand_id
- where a.status=1 and c.status=1
- <if test="type != null">
- and a.type = #{type}
- </if>
- <if test="brandId != null and brandId !=''">
- and a.brand_id = #{brandId}
- </if>
- <if test="chargingStandardTypeId != null and chargingStandardTypeId != ''">
- and a.charging_standard_type_id = #{chargingStandardTypeId}
- </if>
- <if test="twoCategoryId != null and twoCategoryId !=''">
- and a.two_category_id = #{twoCategoryId}
- </if>
- <if test="content1 != null and content1 !=''">
- and a.content1 = #{content1}
- </if>
- order by a.create_time desc
- </select>
- <select id="websitList" resultType="com.gree.mall.miniapp.bean.websit.WebsitVO">
- SELECT
- a.*,
- ST_DISTANCE_SPHERE(
- POINT(#{lng}, #{lat}),
- POINT(lng, lat)
- ) AS distance
- FROM
- admin_websit a
- where a.type='C'
- <if test="isIncre != null">
- and a.is_incre = #{isIncre}
- </if>
- <if test="websitName != null and websitName != ''">
- AND a.name LIKE CONCAT('%', #{websitName},'%')
- </if>
- <if test="websitIds != null and websitIds.size > 0">
- AND a.websit_id IN
- <foreach item="item" index="index" collection="websitIds" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="websitIdsQuchu != null and websitIdsQuchu.size > 0">
- AND a.websit_id not IN
- <foreach item="item" index="index" collection="websitIdsQuchu" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- and a.company_wechat_id = #{companyWechatId}
- <if test="websitIdsQuchu != null and websitIdsQuchu.size > 0 and lng != '0'.toString() and lat != '0'.toString()">
- HAVING distance < #{rice}
- </if>
- ORDER BY distance
- </select>
- <select id="queryUserSettle" resultType="com.gree.mall.miniapp.bean.user.SettleMonthWagesWorkerBean">
- SELECT
- a.*,
- b.send_date
- FROM
- settle_month_wages_worker a LEFT JOIN settle_month_wages_detail b ON a.settle_month_wages_detail_id = b.id
- WHERE
- a.company_wechat_id = #{companyWechatId}
- AND a.worker_name = #{userId}
- ORDER BY b.send_date DESC
- </select>
- <select id="goodsLeaseCategoryList" resultType="com.gree.mall.miniapp.plus.entity.GoodsCategory">
- SELECT * FROM (
- SELECT
- a.*
- FROM
- goods_category a JOIN goods_lease b ON a.category_id = b.category_id
- WHERE
- a.company_wechat_id = #{companyWechatId}
- AND b.del = 0
- AND b.status = 1
- AND a.type = 2
- <if test="categoryName != null and categoryName != ''">
- AND a.name LIKE CONCAT('%', #{categoryName},'%')
- </if>
- GROUP BY a.category_id
- ) a
- ORDER BY a.sort_num, a.create_time DESC
- </select>
- <select id="leaseOrderList" resultType="com.gree.mall.miniapp.bean.order.LeaseOrderVO">
- SELECT
- a.*,
- b.category_name,
- b.category_url,
- b.goods_lease_name,
- b.repair_remark,
- b.qty,
- b.end_date,
- b.start_date,
- b.real_end_date
- FROM
- lease_order a LEFT JOIN lease_order_item b ON a.id = b.lease_order_id
- WHERE
- a.user_id = #{userId}
- <if test="keyword != null and keyword != ''">
- AND (a.id LIKE CONCAT('%', #{keyword}, '%') OR b.goods_lease_name LIKE CONCAT('%', #{keyword}, '%'))
- </if>
- <if test="payStatus != null">
- AND a.pay_status = #{payStatus}
- </if>
- <if test="status != null and status != '' and isEndDate == false">
- AND a.status = #{status}
- </if>
- <if test="status != null and status != '' and isEndDate == true">
- AND a.status IN ('OVER', 'RECOVER')
- </if>
- ORDER BY a.create_time DESC
- </select>
- <select id="partsApplyCount" resultType="com.gree.mall.miniapp.bean.material.MyDataCountBean">
- SELECT
- SUM(IF(a.status = 'ING', 1, 0)) AS partsIngCount,
- SUM(IF(a.status = 'END', 1, 0)) AS partsEndCount,
- SUM(IF(a.status = 'CANCEL', 1, 0)) AS partsCancelCount
- FROM
- websit_parts_apply a
- WHERE
- a.create_by_id = #{userId}
- </select>
- <select id="promotionActivity" resultType="com.gree.mall.miniapp.bean.activity.PromotionActivityBean">
- SELECT
- a.*,
- b.name,
- b.detail_imgs
- FROM
- promotion_activity a LEFT JOIN promotion_questionnaire b ON a.promotion_questionnaire_id = b.id
- <where>
- <if test="companyWechatId != null and companyWechatId != ''">
- AND a.company_wechat_id = #{companyWechatId}
- </if>
- <if test="userId != null and userId != ''">
- AND a.user_id = #{userId}
- </if>
- <if test="promotionQuestionnaireId != null and promotionQuestionnaireId != ''">
- AND a.promotion_questionnaire_id = #{promotionQuestionnaireId}
- </if>
- </where>
- ORDER BY a.create_time DESC
- </select>
- <select id="esGoodsList" resultType="com.gree.mall.miniapp.bean.es.ESGoodsBean">
- SELECT
- a.*
- FROM
- es_goods a
- WHERE
- a.del = 0
- <if test="companyWechatId != null and companyWechatId != ''">
- AND a.company_wechat_id = #{companyWechatId}
- </if>
- <if test="goodsName != null and goodsName != ''">
- AND (
- a.goods_name LIKE CONCAT('%', #{goodsName}, '%') OR
- a.brand LIKE CONCAT('%', #{goodsName}, '%') OR
- a.power LIKE CONCAT('%', #{goodsName}, '%') OR
- a.mark LIKE CONCAT('%', #{goodsName}, '%')
- )
- </if>
- <if test="categoryId != null and categoryId != ''">
- AND a.category_id = #{categoryId}
- </if>
- <if test="userId != null and userId != ''">
- AND a.user_id = #{userId}
- </if>
- <if test="brand != null and brand != ''">
- AND a.brand = #{brand}
- </if>
- <if test="power != null and power != ''">
- AND a.power = #{power}
- </if>
- <if test="mark != null and mark != ''">
- AND a.mark = #{mark}
- </if>
- <if test="statusList != null and statusList.size > 0">
- AND a.status IN
- <foreach item="item" index="index" collection="statusList" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <!-- <if test="sortType != null and sortType != '' and sortType == 'A'.toString">-->
- <!-- AND a.sort <![CDATA[ >= ]]> 0 AND a.status IN ('ON','SALE')-->
- <!-- </if>-->
- <!-- <if test="sortType != null and sortType != '' and sortType == 'B'.toString">-->
- <!-- AND a.status = 'ON'-->
- <!-- </if>-->
- ORDER BY
- <if test="sortType != null and sortType != '' and sortType != 'C'.toString">
- a.is_top DESC,
- a.top_time DESC,
- a.status,
- </if>
- <if test="sortType != null and sortType != '' and sortType == 'C'.toString">
- a.like_count DESC,
- </if>
- a.update_time DESC
- </select>
- <select id="esGoodsTopList" resultType="com.gree.mall.miniapp.bean.es.ESGoodsBean">
- SELECT
- a.*
- FROM
- es_goods a
- WHERE
- a.company_wechat_id = #{companyWechatId}
- AND a.is_top = 1
- AND a.del = 0
- ORDER BY a.top_time
- </select>
- <select id="guessList" resultType="java.lang.String">
- SELECT
- <choose>
- <when test="typeName != null and typeName != '' and typeName == 'brand'.toString">
- a.brand
- </when>
- <when test="typeName != null and typeName != '' and typeName == 'power'.toString">
- a.power
- </when>
- <otherwise>
- a.mark
- </otherwise>
- </choose>
- FROM
- es_goods a
- WHERE
- a.company_wechat_id = #{companyWechatId}
- AND a.del = 0
- GROUP BY
- <choose>
- <when test="typeName != null and typeName != '' and typeName == 'brand'.toString">
- a.brand
- </when>
- <when test="typeName != null and typeName != '' and typeName == 'power'.toString">
- a.power
- </when>
- <otherwise>
- a.mark
- </otherwise>
- </choose>
- </select>
- </mapper>
|