<?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.hive.dao.SysSourceFlowDao">
|
<!-- 定义SysSourceFlow 的复杂关联map -->
|
<resultMap type="com.matrix.system.hive.bean.SysSourceFlow" id="SysSourceFlowMap">
|
<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="vipId" column="vip_id" />
|
<result property="source" column="source" />
|
<result property="staffId" column="staff_id" />
|
<result property="staffName" column="staff_name" />
|
<result property="remark" column="remark" />
|
<result property="orderId" column="order_id" />
|
<result property="t1" column="t1" />
|
<result property="t2" column="t2" />
|
<result property="t3" column="t3" />
|
<result property="t4" column="t4" />
|
</resultMap>
|
|
|
<!-- 定义SysSourceFlow 的简单map ,本map不添加其他的关联属性 -->
|
<resultMap type="com.matrix.system.hive.bean.SysSourceFlow" id="SysSourceFlowSimpleMap">
|
<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="vipId" column="vip_id" />
|
<result property="source" column="source" />
|
<result property="staffId" column="staff_id" />
|
<result property="staffName" column="staff_name" />
|
<result property="remark" column="remark" />
|
<result property="orderId" column="order_id" />
|
<result property="t1" column="t1" />
|
<result property="t2" column="t2" />
|
<result property="t3" column="t3" />
|
<result property="t4" column="t4" />
|
</resultMap>
|
|
<!-- 字段sql -->
|
<sql id="columns">
|
create_by,
|
create_time,
|
update_by,
|
update_time,
|
id,
|
vip_id,
|
source,
|
staff_id,
|
staff_name,
|
remark,
|
order_id,
|
t1,
|
t2,
|
t3,
|
t4
|
</sql>
|
|
<!-- 属性sql -->
|
<sql id="propertys">
|
#{item.createBy},
|
now(),
|
#{item.updateBy},
|
now(),
|
#{item.id},
|
#{item.vipId},
|
#{item.source},
|
#{item.staffId},
|
#{item.staffName},
|
#{item.remark},
|
#{item.orderId},
|
#{item.t1},
|
#{item.t2},
|
#{item.t3},
|
#{item.t4}
|
</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.vipId!=null and record.vipId!='') or (record.vipId!='' and record.vipId==0) ">
|
and vip_id = #{record.vipId}
|
</if>
|
<if test="(record.source!=null and record.source!='') or (record.source!='' and record.source==0) ">
|
and source = #{record.source}
|
</if>
|
<if test="(record.staffId!=null and record.staffId!='') or (record.staffId!='' and record.staffId==0) ">
|
and staff_id = #{record.staffId}
|
</if>
|
<if test="(record.staffName!=null and record.staffName!='') or (record.staffName!='' and record.staffName==0) ">
|
and staff_name = #{record.staffName}
|
</if>
|
<if test="(record.remark!=null and record.remark!='') or (record.remark!='' and record.remark==0) ">
|
and remark = #{record.remark}
|
</if>
|
<if test="(record.orderId!=null and record.orderId!='') or (record.orderId!='' and record.orderId==0) ">
|
and order_id = #{record.orderId}
|
</if>
|
<if test="(record.t1!=null and record.t1!='') or (record.t1!='' and record.t1==0) ">
|
and t1 = #{record.t1}
|
</if>
|
<if test="(record.t2!=null and record.t2!='') or (record.t2!='' and record.t2==0) ">
|
and t2 = #{record.t2}
|
</if>
|
<if test="(record.t3!=null and record.t3!='') or (record.t3!='' and record.t3==0) ">
|
and t3 = #{record.t3}
|
</if>
|
<if test="(record.t4!=null and record.t4!='') or (record.t4!='' and record.t4==0) ">
|
and t4 = #{record.t4}
|
</if>
|
</if>
|
|
</sql>
|
|
<!-- 插入方法 -->
|
<insert id="insert" parameterType="com.matrix.system.hive.bean.SysSourceFlow"
|
useGeneratedKeys="true" keyProperty="item.id">
|
INSERT INTO sys_source_flow (
|
<include refid="columns"></include>
|
)
|
VALUES (
|
<include refid="propertys"></include>
|
)
|
</insert>
|
|
|
|
<!-- 批量插入 -->
|
<insert id="batchInsert" parameterType="java.util.List">
|
INSERT INTO sys_source_flow (
|
<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 sys_source_flow
|
<set>
|
<if test="_parameter.containsKey('vipId')">
|
vip_id = #{vipId},
|
</if>
|
<if test="_parameter.containsKey('source')">
|
source = #{source},
|
</if>
|
<if test="_parameter.containsKey('staffId')">
|
staff_id = #{staffId},
|
</if>
|
<if test="_parameter.containsKey('staffName')">
|
staff_name = #{staffName},
|
</if>
|
<if test="_parameter.containsKey('remark')">
|
remark = #{remark},
|
</if>
|
<if test="_parameter.containsKey('orderId')">
|
order_id = #{orderId},
|
</if>
|
<if test="_parameter.containsKey('t1')">
|
t1 = #{t1},
|
</if>
|
<if test="_parameter.containsKey('t2')">
|
t2 = #{t2},
|
</if>
|
<if test="_parameter.containsKey('t3')">
|
t3 = #{t3},
|
</if>
|
<if test="_parameter.containsKey('t4')">
|
t4 = #{t4},
|
</if>
|
</set>
|
WHERE id=#{id}
|
</update>
|
|
|
<!-- 根据对象更新 部分更新 -->
|
<update id="updateByModel" parameterType="Integer">
|
UPDATE sys_source_flow
|
<set>
|
<if test="record.vipId != null ">
|
vip_id = #{record.vipId},
|
</if>
|
<if test="record.source != null ">
|
source = #{record.source},
|
</if>
|
<if test="record.staffId != null ">
|
staff_id = #{record.staffId},
|
</if>
|
<if test="record.staffName != null and record.staffName != '' ">
|
staff_name = #{record.staffName},
|
</if>
|
<if test="record.remark != null and record.remark != '' ">
|
remark = #{record.remark},
|
</if>
|
<if test="record.orderId != null ">
|
order_id = #{record.orderId},
|
</if>
|
<if test="record.t1 != null and record.t1 != '' ">
|
t1 = #{record.t1},
|
</if>
|
<if test="record.t2 != null and record.t2 != '' ">
|
t2 = #{record.t2},
|
</if>
|
<if test="record.t3 != null and record.t3 != '' ">
|
t3 = #{record.t3},
|
</if>
|
<if test="record.t4 != null and record.t4 != '' ">
|
t4 = #{record.t4},
|
</if>
|
</set>
|
WHERE id=#{record.id}
|
</update>
|
|
<!-- 批量删除 -->
|
<delete id="deleteByIds" parameterType="java.util.List">
|
delete from sys_source_flow where id in
|
<foreach collection="list" index="index" item="item" open="("
|
separator="," close=")">
|
#{item}
|
</foreach>
|
</delete>
|
|
<!-- 根据id删除-->
|
<delete id="deleteById" parameterType="Integer">
|
DELETE FROM sys_source_flow
|
where id=#{id}
|
</delete>
|
|
<!-- 根据对象删除-->
|
<delete id="deleteByModel" parameterType="com.matrix.system.hive.bean.SysSourceFlow">
|
DELETE FROM sys_source_flow
|
<where>
|
<include refid="where_sql" ></include>
|
</where>
|
</delete>
|
|
|
|
<!-- 分页查询 -->
|
<select id="selectInPage" resultMap="SysSourceFlowMap">
|
select
|
<include refid="columns" ></include>
|
from sys_source_flow
|
<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 sys_source_flow
|
<where>
|
<include refid="where_sql"></include>
|
</where>
|
</select>
|
|
<!-- 根据id查询-->
|
<select id="selectById" resultMap="SysSourceFlowMap">
|
select
|
<include refid="columns" ></include>
|
from sys_source_flow
|
where id=#{id}
|
</select>
|
|
|
<!-- 根据id 锁表查询-->
|
<select id="selectForUpdate" resultMap="SysSourceFlowMap">
|
select
|
<include refid="columns" ></include>
|
from sys_source_flow
|
where id=#{id}
|
for update
|
</select>
|
|
|
|
<!-- 根据对象查询-->
|
<select id="selectByModel" resultMap="SysSourceFlowMap">
|
select
|
<include refid="columns" ></include>
|
from sys_source_flow
|
<where>
|
<include refid="where_sql"></include>
|
</where>
|
</select>
|
</mapper>
|