<?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.SysSkinDetailDao">
|
<!-- 定义SysSkinDetail 的复杂关联map -->
|
<resultMap type="com.matrix.system.hive.bean.SysSkinDetail" id="SysSkinDetailMap">
|
<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="checkId" column="check_id" />
|
<result property="symptom" column="symptom" />
|
<result property="percentage" column="percentage" />
|
<result property="analysis" column="analysis" />
|
<result property="solution" column="solution" />
|
<result property="productIds" column="product_ids" />
|
<result property="img" column="img" />
|
<result property="t1" column="t1" />
|
<result property="t2" column="t2" />
|
<result property="t3" column="t3" />
|
<result property="t4" column="t4" />
|
</resultMap>
|
|
|
<!-- 定义SysSkinDetail 的简单map ,本map不添加其他的关联属性 -->
|
<resultMap type="com.matrix.system.hive.bean.SysSkinDetail" id="SysSkinDetailSimpleMap">
|
<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="checkId" column="check_id" />
|
<result property="symptom" column="symptom" />
|
<result property="percentage" column="percentage" />
|
<result property="analysis" column="analysis" />
|
<result property="solution" column="solution" />
|
<result property="productIds" column="product_ids" />
|
<result property="img" column="img" />
|
<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,
|
check_id,
|
symptom,
|
percentage,
|
analysis,
|
solution,
|
product_ids,
|
img,
|
t1,
|
t2,
|
t3,
|
t4
|
</sql>
|
|
<!-- 属性sql -->
|
<sql id="propertys">
|
#{item.createBy},
|
now(),
|
#{item.updateBy},
|
now(),
|
#{item.id},
|
#{item.checkId},
|
#{item.symptom},
|
#{item.percentage},
|
#{item.analysis},
|
#{item.solution},
|
#{item.productIds},
|
#{item.img},
|
#{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.checkId!=null and record.checkId!='') or (record.checkId!='' and record.checkId==0) ">
|
and check_id = #{record.checkId}
|
</if>
|
<if test="(record.symptom!=null and record.symptom!='') or (record.symptom!='' and record.symptom==0) ">
|
and symptom = #{record.symptom}
|
</if>
|
<if test="(record.percentage!=null and record.percentage!='') or (record.percentage!='' and record.percentage==0) ">
|
and percentage = #{record.percentage}
|
</if>
|
<if test="(record.analysis!=null and record.analysis!='') or (record.analysis!='' and record.analysis==0) ">
|
and analysis = #{record.analysis}
|
</if>
|
<if test="(record.solution!=null and record.solution!='') or (record.solution!='' and record.solution==0) ">
|
and solution = #{record.solution}
|
</if>
|
<if test="(record.productIds!=null and record.productIds!='') or (record.productIds!='' and record.productIds==0) ">
|
and product_ids = #{record.productIds}
|
</if>
|
<if test="(record.img!=null and record.img!='') or (record.img!='' and record.img==0) ">
|
and img = #{record.img}
|
</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.SysSkinDetail"
|
useGeneratedKeys="true" keyProperty="item.id">
|
INSERT INTO sys_skin_detail (
|
<include refid="columns"></include>
|
)
|
VALUES (
|
<include refid="propertys"></include>
|
)
|
</insert>
|
|
|
|
<!-- 批量插入 -->
|
<insert id="batchInsert" parameterType="java.util.List">
|
INSERT INTO sys_skin_detail (
|
<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_skin_detail
|
<set>
|
<if test="_parameter.containsKey('checkId')">
|
check_id = #{checkId},
|
</if>
|
<if test="_parameter.containsKey('symptom')">
|
symptom = #{symptom},
|
</if>
|
<if test="_parameter.containsKey('percentage')">
|
percentage = #{percentage},
|
</if>
|
<if test="_parameter.containsKey('analysis')">
|
analysis = #{analysis},
|
</if>
|
<if test="_parameter.containsKey('solution')">
|
solution = #{solution},
|
</if>
|
<if test="_parameter.containsKey('productIds')">
|
product_ids = #{productIds},
|
</if>
|
<if test="_parameter.containsKey('img')">
|
img = #{img},
|
</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_skin_detail
|
<set>
|
<if test="record.checkId != null ">
|
check_id = #{record.checkId},
|
</if>
|
<if test="record.symptom != null and record.symptom != '' ">
|
symptom = #{record.symptom},
|
</if>
|
<if test="record.percentage != null ">
|
percentage = #{record.percentage},
|
</if>
|
<if test="record.analysis != null and record.analysis != '' ">
|
analysis = #{record.analysis},
|
</if>
|
<if test="record.solution != null and record.solution != '' ">
|
solution = #{record.solution},
|
</if>
|
<if test="record.productIds != null and record.productIds != '' ">
|
product_ids = #{record.productIds},
|
</if>
|
<if test="record.img != null and record.img != '' ">
|
img = #{record.img},
|
</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_skin_detail 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_skin_detail
|
where id=#{id}
|
</delete>
|
|
<!-- 根据对象删除-->
|
<delete id="deleteByModel" parameterType="com.matrix.system.hive.bean.SysSkinDetail">
|
DELETE FROM sys_skin_detail
|
<where>
|
<include refid="where_sql" ></include>
|
</where>
|
</delete>
|
|
|
|
<!-- 分页查询 -->
|
<select id="selectInPage" resultMap="SysSkinDetailMap">
|
select
|
<include refid="columns" ></include>
|
from sys_skin_detail
|
<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_skin_detail
|
<where>
|
<include refid="where_sql"></include>
|
</where>
|
</select>
|
|
<!-- 根据id查询-->
|
<select id="selectById" resultMap="SysSkinDetailMap">
|
select
|
<include refid="columns" ></include>
|
from sys_skin_detail
|
where id=#{id}
|
</select>
|
|
|
<!-- 根据id 锁表查询-->
|
<select id="selectForUpdate" resultMap="SysSkinDetailMap">
|
select
|
<include refid="columns" ></include>
|
from sys_skin_detail
|
where id=#{id}
|
for update
|
</select>
|
|
|
|
<!-- 根据对象查询-->
|
<select id="selectByModel" resultMap="SysSkinDetailMap">
|
select
|
<include refid="columns" ></include>
|
from sys_skin_detail
|
<where>
|
<include refid="where_sql"></include>
|
</where>
|
</select>
|
<select id="selectByRecordId" resultMap="SysSkinDetailMap">
|
select * from sys_skin_detail where check_id=#{checkId} and t1=1
|
</select>
|
|
<delete id="deleteByCheckId">
|
delete from sys_skin_detail
|
where check_id=#{checkId}
|
</delete>
|
</mapper>
|