<?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.ComBatteryCommoditySpecsMapper">
|
|
<resultMap type="com.panzhihua.service_community.entity.ComBatteryCommoditySpecs" id="ComBatteryCommoditySpecsMap">
|
<result property="id" column="id" jdbcType="INTEGER"/>
|
<result property="storeId" column="store_id" jdbcType="INTEGER"/>
|
<result property="commodityId" column="commodity_id" jdbcType="INTEGER"/>
|
<result property="name" column="name" jdbcType="VARCHAR"/>
|
<result property="stock" column="stock" jdbcType="INTEGER"/>
|
<result property="price" column="price" jdbcType="VARCHAR"/>
|
<result property="images" column="images" jdbcType="VARCHAR"/>
|
<result property="isDel" column="is_del" jdbcType="INTEGER"/>
|
<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.ComBatteryCommoditySpecsVo">
|
SELECT
|
cbcs.id,
|
cbcs.store_id,
|
cbcs.commodity_id,
|
cbcs.`name`,
|
cbcs.stock,
|
cbcs.price,
|
cbcs.images,
|
cbcs.create_at,
|
cbcs.create_by,
|
cbcs.update_at,
|
cbcs.update_by,
|
cbc.`name` as commodityName,
|
cbc.`postage`
|
FROM
|
com_battery_commodity_specs as cbcs
|
left join com_battery_commodity as cbc on cbc.id = cbcs.commodity_id
|
where cbcs.id = #{id}
|
</select>
|
|
<!--查询指定行数据-->
|
<select id="queryAllByLimit" resultType="com.panzhihua.common.model.vos.common.ComBatteryCommoditySpecsVo">
|
select
|
cbcs.id, cbcs.store_id, cbcs.commodity_id, cbcs.`name`, cbcs.stock, cbcs.price, cbcs.images, cbcs.is_del, cbcs.create_at
|
, cbcs.create_by, cbcs.update_at, cbcs.update_by,cbc.`name` as commodityName
|
from com_battery_commodity_specs as cbcs
|
left join com_battery_commodity as cbc on cbc.id = cbcs.commodity_id
|
<where>
|
and cbcs.is_del = 2
|
<if test="dto.id != null">
|
and cbcs.id = #{dto.id}
|
</if>
|
<if test="dto.storeId != null">
|
and cbcs.store_id = #{dto.storeId}
|
</if>
|
<if test="dto.status != null">
|
and cbc.status = #{dto.status}
|
</if>
|
<if test="dto.commodityId != null">
|
and cbcs.commodity_id = #{dto.commodityId}
|
</if>
|
<if test="dto.keyWord != null and dto.keyWord != ''">
|
and (
|
cbcs.`name` like concat('%',#{dto.keyWord},'%') or
|
cbc.`name` like concat('%',#{dto.keyWord},'%') or
|
cbcs.commodity_id like concat('%',#{dto.keyWord},'%')
|
)
|
</if>
|
</where>
|
order by cbcs.create_at desc
|
</select>
|
|
<!--查询所有数据-->
|
<select id="queryAllByList" resultType="com.panzhihua.common.model.vos.common.ComBatteryCommoditySpecsVo">
|
select
|
id, store_id, commodity_id, name, stock, price, images, is_del, create_at, create_by, update_at, update_by
|
from com_battery_commodity_specs
|
<where>
|
and is_del = 2
|
<if test="dto.id != null">
|
and id = #{dto.id}
|
</if>
|
<if test="dto.storeId != null">
|
and store_id = #{dto.storeId}
|
</if>
|
<if test="dto.commodityId != null">
|
and commodity_id = #{dto.commodityId}
|
</if>
|
<if test="dto.keyWord != null and dto.keyWord != ''">
|
and `name` like concat('%',#{dto.keyWord},'%')
|
</if>
|
</where>
|
order by create_at desc
|
</select>
|
|
<select id="queryAllByCommodityId" resultType="com.panzhihua.common.model.vos.common.ComBatteryCommoditySpecsVo">
|
select
|
id, store_id, commodity_id, name, stock, price, images, is_del, create_at, create_by, update_at, update_by
|
from com_battery_commodity_specs
|
where commodity_id = #{commodityId}
|
</select>
|
|
</mapper>
|