133 lines
4.4 KiB
XML
133 lines
4.4 KiB
XML
<?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="tech.unissense.pms.business.examine.detail.mapper.ExamineDetailMapper">
|
|
|
|
<resultMap type="tech.unissense.pms.business.examine.detail.domain.ExamineDetail" id="ExamineDetailMap">
|
|
<result property="id" column="id" jdbcType="INTEGER"/>
|
|
<result property="examineId" column="examine_id" jdbcType="INTEGER"/>
|
|
<result property="score" column="score" jdbcType="INTEGER"/>
|
|
<result property="remark" column="remark" jdbcType="VARCHAR"/>
|
|
<result property="configId" column="config_id" jdbcType="INTEGER"/>
|
|
</resultMap>
|
|
|
|
<sql id="base_query">
|
|
select id,
|
|
examine_id,
|
|
score,
|
|
remark,
|
|
config_id
|
|
from pms_examine_detail
|
|
</sql>
|
|
<!--查询单个-->
|
|
<select id="queryById" resultMap="ExamineDetailMap">
|
|
<include refid="base_query"/>
|
|
where id = #{id}
|
|
</select>
|
|
|
|
<!--查询指定行数据-->
|
|
<select id="list" resultMap="ExamineDetailMap">
|
|
<include refid="base_query"/>
|
|
<where>
|
|
<if test="id != null">
|
|
and id = #{id}
|
|
</if>
|
|
<if test="examineId != null">
|
|
and examine_id = #{examineId}
|
|
</if>
|
|
<if test="score != null">
|
|
and score = #{score}
|
|
</if>
|
|
<if test="remark != null and remark != ''">
|
|
and remark = #{remark}
|
|
</if>
|
|
<if test="configId != null">
|
|
and config_id = #{configId}
|
|
</if>
|
|
<if test="examineIdList != null and examineIdList.size>0">
|
|
and examine_id in
|
|
<foreach collection="examineIdList" item="item" open="(" close=")" separator=",">
|
|
#{item}
|
|
</foreach>
|
|
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!--统计总行数-->
|
|
<select id="count" resultType="java.lang.Long">
|
|
select count(1)
|
|
from pms_examine_detail
|
|
<where>
|
|
<if test="id != null">
|
|
and id = #{id}
|
|
</if>
|
|
<if test="examineId != null">
|
|
and examine_id = #{examineId}
|
|
</if>
|
|
<if test="score != null">
|
|
and score = #{score}
|
|
</if>
|
|
<if test="remark != null and remark != ''">
|
|
and remark = #{remark}
|
|
</if>
|
|
<if test="configId != null">
|
|
and config_id = #{configId}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!--新增所有列-->
|
|
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
|
insert into pms_examine_detail(examine_id, score, remark, config_id)
|
|
values (#{examineId}, #{score}, #{remark}, #{configId})
|
|
</insert>
|
|
|
|
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
|
insert into pms_examine_detail(examine_id, score, remark, config_id)
|
|
values
|
|
<foreach collection="entities" item="entity" separator=",">
|
|
(#{entity.examineId}, #{entity.score}, #{entity.remark}, #{entity.configId})
|
|
</foreach>
|
|
</insert>
|
|
|
|
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
|
|
insert into pms_examine_detail(examine_id, score, remark, config_id)
|
|
values
|
|
<foreach collection="entities" item="entity" separator=",">
|
|
(#{entity.examineId}, #{entity.score}, #{entity.remark}, #{entity.configId})
|
|
</foreach>
|
|
on duplicate key update
|
|
score = values(score),
|
|
remark = values(remark)
|
|
</insert>
|
|
|
|
<!--通过主键修改数据-->
|
|
<update id="update">
|
|
update pms_examine_detail
|
|
<set>
|
|
<if test="examineId != null">
|
|
examine_id = #{examineId},
|
|
</if>
|
|
<if test="score != null">
|
|
score = #{score},
|
|
</if>
|
|
<if test="remark != null and remark != ''">
|
|
remark = #{remark},
|
|
</if>
|
|
<if test="configId != null">
|
|
config_id = #{configId},
|
|
</if>
|
|
</set>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<!--通过主键删除-->
|
|
<delete id="deleteById">
|
|
delete
|
|
from pms_examine_detail
|
|
where id = #{id}
|
|
</delete>
|
|
|
|
</mapper>
|
|
|