<?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.matrix.system.shopXcx.dao.ShopLogisticsInfoDao">
|
<!-- 定义ShopLogisticsInfo 的复杂关联map -->
|
<resultMap type="com.matrix.system.shopXcx.bean.ShopLogisticsInfo" id="ShopLogisticsInfoMap">
|
<id property="id" column="id" />
|
<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="logisticsTime" column="logistics_time" />
|
<result property="describe" column="describe" />
|
<result property="delieryId" column="deliery_id" />
|
<result property="state" column="status"/>
|
</resultMap>
|
|
|
<!-- 定义ShopLogisticsInfo 的简单map ,本map不添加其他的关联属性 -->
|
<resultMap type="com.matrix.system.shopXcx.bean.ShopLogisticsInfo" id="ShopLogisticsInfoSimpleMap">
|
<id property="id" column="id" />
|
<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="logisticsTime" column="logistics_time" />
|
<result property="describe" column="describe" />
|
<result property="delieryId" column="deliery_id" />
|
<result property="state" column="status"/>
|
</resultMap>
|
|
<!-- 字段sql -->
|
<sql id="columns">
|
create_by,
|
create_time,
|
update_by,
|
update_time,
|
id,
|
logistics_time,
|
`describe`,
|
deliery_id,
|
status
|
</sql>
|
|
<!-- 属性sql -->
|
<sql id="propertys">
|
#{item.createBy},
|
now(),
|
#{item.updateBy},
|
now(),
|
#{item.id},
|
#{item.logisticsTime},
|
#{item.describe},
|
#{item.delieryId},
|
#{item.state}
|
</sql>
|
|
<!-- where sql -->
|
<sql id="where_sql">
|
|
<if test="record!=null">
|
<if test="(record.id!=null and record.id!='') or (record.id!='' and record.id==0) ">
|
and id = #{record.id}
|
</if>
|
<if test="(record.logisticsTime!=null and record.logisticsTime!='') or (record.logisticsTime!='' and record.logisticsTime==0) ">
|
and logistics_time = #{record.logisticsTime}
|
</if>
|
<if test="(record.describe!=null and record.describe!='') or (record.describe!='' and record.describe==0) ">
|
and describe = #{record.describe}
|
</if>
|
<if test="(record.delieryId!=null and record.delieryId!='') or (record.delieryId!='' and record.delieryId==0) ">
|
and deliery_id = #{record.delieryId}
|
</if>
|
<if test="(record.state!=null and record.state!='') or (record.state!='' and record.state==0) ">
|
and status = #{record.state}
|
</if>
|
</if>
|
|
</sql>
|
|
<!-- 插入方法 -->
|
<insert id="insert" parameterType="com.matrix.system.shopXcx.bean.ShopLogisticsInfo"
|
useGeneratedKeys="true" keyProperty="item.id">
|
INSERT INTO shop_logistics_info (
|
<include refid="columns"></include>
|
)
|
VALUES (
|
<include refid="propertys"></include>
|
)
|
</insert>
|
|
|
|
<!-- 批量插入 -->
|
<insert id="batchInsert" parameterType="java.util.List">
|
INSERT INTO shop_logistics_info (
|
<include refid="columns"></include>
|
)
|
VALUES
|
<foreach collection="list" item="item" index="index" separator=",">(
|
<include refid="propertys"></include>
|
)</foreach>
|
</insert>
|
|
|
|
|
|
<!-- 根据Map更新 部分更新 -->
|
<update id="updateByMap" parameterType="java.util.HashMap" >
|
UPDATE shop_logistics_info
|
<set>
|
<if test="_parameter.containsKey('logisticsTime')">
|
logistics_time = #{logisticsTime},
|
</if>
|
<if test="_parameter.containsKey('describe')">
|
describe = #{describe},
|
</if>
|
<if test="_parameter.containsKey('delieryId')">
|
deliery_id = #{delieryId},
|
</if>
|
<if test="_parameter.containsKey('state')">
|
status = #{state},
|
</if>
|
</set>
|
WHERE id=#{id}
|
</update>
|
|
|
<!-- 根据对象更新 部分更新 -->
|
<update id="updateByModel" parameterType="Integer">
|
UPDATE shop_logistics_info
|
<set>
|
<if test="record.logisticsTime != null ">
|
logistics_time = #{record.logisticsTime},
|
</if>
|
<if test="record.describe != null and record.describe != '' ">
|
describe = #{record.describe},
|
</if>
|
<if test="record.delieryId != null ">
|
deliery_id = #{record.delieryId},
|
</if>
|
</set>
|
WHERE id=#{record.id}
|
</update>
|
|
<!-- 批量删除 -->
|
<delete id="deleteByIds" parameterType="java.util.List">
|
delete from shop_logistics_info where id in
|
<foreach collection="list" index="index" item="item" open="("
|
separator="," close=")">
|
#{item}
|
</foreach>
|
</delete>
|
|
<!-- 根据id删除-->
|
<delete id="deleteById" parameterType="Integer">
|
DELETE FROM shop_logistics_info
|
where id=#{id}
|
</delete>
|
|
<!-- 根据发货id删除-->
|
<delete id="deleteByDelieryId" parameterType="Integer">
|
DELETE FROM shop_logistics_info
|
where deliery_id=#{delieryId}
|
</delete>
|
|
<!-- 根据对象删除-->
|
<delete id="deleteByModel" parameterType="com.matrix.system.shopXcx.bean.ShopLogisticsInfo">
|
DELETE FROM shop_logistics_info
|
<where>
|
<include refid="where_sql" ></include>
|
</where>
|
</delete>
|
|
|
|
<!-- 分页查询 -->
|
<select id="selectInPage" resultMap="ShopLogisticsInfoMap">
|
select
|
<include refid="columns" ></include>
|
from shop_logistics_info
|
<where>
|
<include refid="where_sql"></include>
|
</where>
|
<if test="pageVo !=null"><!-- 判断pageVo对象是否为空 -->
|
<if test="pageVo.sort !=null and pageVo.order !=null">
|
order by
|
${pageVo.sort} ${pageVo.order}
|
</if>
|
<if test="pageVo.offset >=0 and pageVo.limit >0">
|
limit
|
#{pageVo.offset},#{pageVo.limit}
|
</if>
|
</if>
|
</select>
|
|
<!-- 查询总条数 -->
|
<select id="selectTotalRecord" parameterType="long" resultType="java.lang.Integer">
|
select count(*)
|
from shop_logistics_info
|
<where>
|
<include refid="where_sql"></include>
|
</where>
|
</select>
|
|
<!-- 根据id查询-->
|
<select id="selectById" resultMap="ShopLogisticsInfoMap">
|
select
|
<include refid="columns" ></include>
|
from shop_logistics_info
|
where id=#{id}
|
</select>
|
|
<!-- 根据发货Id查询物流信息-->
|
<select id="selectByDelieryId" resultMap="ShopLogisticsInfoMap">
|
select
|
<include refid="columns" ></include>
|
from shop_logistics_info
|
where deliery_id=#{delieryId}
|
order by logistics_time desc
|
</select>
|
|
<!-- 根据id 锁表查询-->
|
<select id="selectForUpdate" resultMap="ShopLogisticsInfoMap">
|
select
|
<include refid="columns" ></include>
|
from shop_logistics_info
|
where id=#{id}
|
for update
|
</select>
|
|
|
|
<!-- 根据对象查询-->
|
<select id="selectByModel" resultMap="ShopLogisticsInfoMap">
|
select
|
<include refid="columns" ></include>
|
from shop_logistics_info
|
<where>
|
<include refid="where_sql"></include>
|
</where>
|
</select>
|
</mapper>
|