<?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.panzhihua.service_community.dao.ComBatteryCommodityActivityMapper">
|
|
<resultMap type="com.panzhihua.service_community.entity.ComBatteryCommodityActivity"
|
id="ComBatteryCommodityActivityMap">
|
<result property="id" column="id" jdbcType="INTEGER"/>
|
<result property="name" column="name" jdbcType="VARCHAR"/>
|
<result property="type" column="type" jdbcType="INTEGER"/>
|
<result property="commodityId" column="commodity_id" jdbcType="INTEGER"/>
|
<result property="specsId" column="specs_id" jdbcType="INTEGER"/>
|
<result property="storeId" column="store_id" jdbcType="INTEGER"/>
|
<result property="status" column="status" jdbcType="INTEGER"/>
|
<result property="isDel" column="is_del" jdbcType="INTEGER"/>
|
<result property="price" column="price" jdbcType="VARCHAR"/>
|
<result property="endTime" column="end_time" jdbcType="TIMESTAMP"/>
|
<result property="collageNum" column="collage_num" jdbcType="INTEGER"/>
|
<result property="collagePeopleNum" column="collage_people_num" jdbcType="INTEGER"/>
|
<result property="images" column="images" jdbcType="VARCHAR"/>
|
<result property="commodityNum" column="commodity_num" jdbcType="INTEGER"/>
|
<result property="rule" column="rule" jdbcType="VARCHAR"/>
|
<result property="createAt" column="create_at" jdbcType="TIMESTAMP"/>
|
<result property="createBy" column="create_by" jdbcType="INTEGER"/>
|
<result property="updateAt" column="update_at" jdbcType="TIMESTAMP"/>
|
<result property="updateBy" column="update_by" jdbcType="INTEGER"/>
|
</resultMap>
|
|
<!--查询单个-->
|
<select id="queryById" resultType="com.panzhihua.common.model.vos.common.ComBatteryCommodityActivityVo">
|
SELECT
|
cbca.id,
|
cbca.`name`,
|
cbca.type,
|
cbca.commodity_id,
|
cbca.store_id,
|
cbca.`status`,
|
cbca.price,
|
cbca.end_time,
|
cbca.collage_num,
|
cbca.collage_people_num,
|
cbca.images,
|
cbca.commodity_num,
|
cbca.rule,
|
cbca.create_at,
|
cbca.create_by,
|
cbca.update_at,
|
cbca.update_by,
|
cbca.specs_id,
|
cbca.commodity_sale_num,
|
cbcs.`name` as specsName,
|
cbc.`name` as commodityName,
|
cbc.`code` as commodityCode,
|
cbs.`name` as storeName
|
FROM
|
com_battery_commodity_activity AS cbca
|
left join com_battery_commodity as cbc on cbc.id = cbca.commodity_id
|
left join com_battery_store as cbs on cbs.id = cbca.store_id
|
left join com_battery_commodity_specs as cbcs on cbcs.id = cbca.specs_id
|
where cbca.id = #{id}
|
</select>
|
|
<!--查询指定行数据-->
|
<select id="queryAllByLimit" resultType="com.panzhihua.common.model.vos.common.ComBatteryCommodityActivityVo">
|
SELECT
|
cbca.id,
|
cbca.`name`,
|
cbca.type,
|
cbca.commodity_id,
|
cbca.store_id,
|
cbca.`status`,
|
cbca.price,
|
cbca.end_time,
|
cbca.collage_num,
|
cbca.collage_people_num,
|
cbca.images,
|
cbca.commodity_num,
|
cbca.rule,
|
cbca.create_at,
|
cbca.create_by,
|
cbca.update_at,
|
cbca.update_by,
|
cbca.specs_id,
|
cbca.commodity_sale_num,
|
cbcs.`name` as specsName,
|
cbc.`name` as commodityName,
|
cbc.`code` as commodityCode,
|
cbs.`name` as storeName
|
FROM
|
com_battery_commodity_activity AS cbca
|
left join com_battery_commodity as cbc on cbc.id = cbca.commodity_id
|
left join com_battery_store as cbs on cbs.id = cbca.store_id
|
left join com_battery_commodity_specs as cbcs on cbcs.id = cbca.specs_id
|
<if test="dto.userId != null">
|
left join com_battery_commodity_order as cbco on cbco.activity_id = cbca.id
|
</if>
|
<where>
|
and cbca.is_del = 2
|
<if test="dto.id != null">
|
and cbca.id = #{dto.id}
|
</if>
|
<if test="dto.type != null">
|
and cbca.type = #{dto.type}
|
</if>
|
<if test="dto.userId != null">
|
and cbco.user_id = #{dto.userId} and cbco.pay_status = 2 and cbco.is_del = 2
|
</if>
|
<if test="dto.commodityId != null">
|
and cbca.commodity_id = #{dto.commodityId}
|
</if>
|
<if test="dto.storeId != null">
|
and cbca.store_id = #{dto.storeId}
|
</if>
|
<if test="dto.status != null">
|
and cbca.status = #{dto.status}
|
</if>
|
<if test="dto.isApplets != null and dto.isApplets == 1">
|
and cbca.status in (1,3)
|
</if>
|
<if test="dto.keyWord != null and dto.keyWord != ''">
|
and (
|
cbca.`name` like concat ('%',#{statisticsAdminDTO.keyWord},'%') or
|
cbc.`name` like concat ('%',#{statisticsAdminDTO.keyWord},'%') or
|
cbc.`code` like concat ('%',#{statisticsAdminDTO.keyWord},'%')
|
)
|
</if>
|
</where>
|
order by cbca.create_at desc
|
</select>
|
|
<!--查询所有数据-->
|
<select id="queryAllByList" resultType="com.panzhihua.common.model.vos.common.ComBatteryCommodityActivityVo">
|
SELECT
|
cbca.id,
|
cbca.`name`,
|
cbca.type,
|
cbca.commodity_id,
|
cbca.store_id,
|
cbca.`status`,
|
cbca.price,
|
cbca.end_time,
|
cbca.collage_num,
|
cbca.collage_people_num,
|
cbca.images,
|
cbca.commodity_num,
|
cbca.rule,
|
cbca.create_at,
|
cbca.create_by,
|
cbca.update_at,
|
cbca.update_by,
|
cbca.specs_id,
|
cbca.commodity_sale_num,
|
cbcs.`name` as specsName,
|
cbc.`name` as commodityName,
|
cbc.`code` as commodityCode,
|
cbs.`name` as storeName
|
FROM
|
com_battery_commodity_activity AS cbca
|
left join com_battery_commodity as cbc on cbc.id = cbca.commodity_id
|
left join com_battery_store as cbs on cbs.id = cbca.store_id
|
left join com_battery_commodity_specs as cbcs on cbcs.id = cbca.specs_id
|
<if test="dto.userId != null">
|
left join com_battery_commodity_order as cbco on cbco.activity_id = cbca.id
|
</if>
|
<where>
|
and cbca.is_del = 2
|
<if test="dto.id != null">
|
and cbca.id = #{dto.id}
|
</if>
|
<if test="dto.userId != null">
|
and cbco.user_id = #{dto.userId} and cbco.pay_status = 2 and cbco.is_del = 2
|
</if>
|
<if test="dto.type != null">
|
and cbca.type = #{dto.type}
|
</if>
|
<if test="dto.commodityId != null">
|
and cbca.commodity_id = #{dto.commodityId}
|
</if>
|
<if test="dto.storeId != null">
|
and cbca.store_id = #{dto.storeId}
|
</if>
|
<if test="dto.status != null">
|
and cbca.status = #{dto.status}
|
</if>
|
<if test="dto.isApplets != null and dto.isApplets == 1">
|
and cbca.status in (1,3)
|
</if>
|
<if test="dto.keyWord != null and dto.keyWord != ''">
|
and (
|
cbca.`name` like concat ('%',#{statisticsAdminDTO.keyWord},'%') or
|
cbc.`name` like concat ('%',#{statisticsAdminDTO.keyWord},'%') or
|
cbc.`code` like concat ('%',#{statisticsAdminDTO.keyWord},'%')
|
)
|
</if>
|
</where>
|
order by cbca.create_at desc
|
</select>
|
|
</mapper>
|