<?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.battery.business.mapper.TTestTypeMapper">
|
|
<resultMap type="TTestType" id="TTestTypeResult">
|
<id property="testTypeId" column="test_type_id" />
|
<result property="testTypeName" column="test_type_name" />
|
<result property="status" column="status" />
|
<result property="delFlag" column="del_flag" />
|
<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="remark" column="remark" />
|
</resultMap>
|
|
<sql id="selectTestTypeVo">
|
select test_type_id, test_type_name, status, del_flag, create_by, create_time,
|
update_by, update_time, remark
|
from t_test_type
|
</sql>
|
|
<select id="selectTestTypeById" parameterType="Long" resultMap="TTestTypeResult">
|
<include refid="selectTestTypeVo" />
|
where test_type_id = #{testTypeId}
|
and del_flag = '0'
|
</select>
|
|
<select id="selectTestTypeList" parameterType="TTestType" resultMap="TTestTypeResult">
|
<include refid="selectTestTypeVo" />
|
<where>
|
del_flag = '0'
|
<if test="testTypeId != null">
|
and test_type_id = #{testTypeId}
|
</if>
|
<if test="testTypeName != null and testTypeName != ''">
|
and test_type_name like concat('%', #{testTypeName}, '%')
|
</if>
|
<if test="beginCreateTime != null and beginCreateTime != ''">
|
and create_time >= #{beginCreateTime}
|
</if>
|
<if test="endCreateTime != null and endCreateTime != ''">
|
and create_time <= #{endCreateTime}
|
</if>
|
<if test="status != null and status != ''">
|
and status = #{status}
|
</if>
|
</where>
|
order by create_time desc, test_type_id desc
|
</select>
|
|
<select id="selectTestTypeByName" parameterType="String" resultMap="TTestTypeResult">
|
<include refid="selectTestTypeVo" />
|
where test_type_name = #{testTypeName}
|
and del_flag = '0'
|
limit 1
|
</select>
|
|
<insert id="insertTestType" parameterType="TTestType" useGeneratedKeys="true" keyProperty="testTypeId">
|
insert into t_test_type
|
(test_type_name, status, del_flag, create_by, create_time, remark)
|
values
|
(#{testTypeName}, #{status}, #{delFlag}, #{createBy}, #{createTime}, #{remark})
|
</insert>
|
|
<update id="updateTestType" parameterType="TTestType">
|
update t_test_type
|
set test_type_name = #{testTypeName},
|
remark = #{remark},
|
update_by = #{updateBy},
|
update_time = #{updateTime}
|
where test_type_id = #{testTypeId}
|
and del_flag = '0'
|
</update>
|
|
<update id="updateTestTypeStatus" parameterType="TTestType">
|
update t_test_type
|
set status = #{status},
|
update_by = #{updateBy},
|
update_time = #{updateTime}
|
where test_type_id = #{testTypeId}
|
and del_flag = '0'
|
</update>
|
|
<select id="countTestReferencesByTestTypeId" parameterType="Long" resultType="int">
|
select count(1)
|
from t_test
|
where test_type_id = #{testTypeId}
|
and del_flag = '0'
|
</select>
|
|
<update id="deleteTestTypeById">
|
update t_test_type
|
set del_flag = cast(test_type_id as char),
|
update_by = #{updateBy},
|
update_time = sysdate()
|
where test_type_id = #{testTypeId}
|
and del_flag = '0'
|
</update>
|
</mapper>
|