193 lines
10 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="com.rzdata.web.mapper.ToolMapper">
<resultMap type="Tool" id="ToolResult">
<result property="toolId" column="tool_id" />
<result property="toolCode" column="tool_code" />
<result property="toolName" column="tool_name" />
<result property="toolType" column="tool_type" />
<result property="toolSource" column="tool_source" />
<result property="toolUse" column="tool_use" />
<result property="testSituation" column="test_situation" />
<result property="functionDesc" column="function_desc" />
<result property="applyCondition" column="apply_condition" />
<result property="operateExplain" column="operate_explain" />
<result property="toolPrincipals" column="tool_principals" />
<result property="toolPrincipalsName" column="tool_principals_name" />
<result property="toolRespDept" column="tool_resp_dept" />
<result property="toolRespDeptName" column="tool_resp_dept_name" />
<result property="status" column="status" />
<result property="remark" column="remark" />
<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="procInstId" column="proc_inst_id" />
<result property="recordStatus" column="record_status" />
</resultMap>
<resultMap id="deptResult" type="SysDept">
<id property="deptId" column="dept_id" />
<result property="parentId" column="parent_id" />
<result property="deptName" column="dept_name" />
<result property="ancestors" column="ancestors" />
<result property="orderNum" column="order_num" />
<result property="leader" column="leader" />
<result property="status" column="dept_status" />
</resultMap>
<sql id="selectToolVo">
select tool_id, tool_code, tool_name, tool_type, tool_source, tool_use, test_situation, function_desc, apply_condition, operate_explain, tool_principals, tool_principals_name, tool_resp_dept, status, remark, create_by, create_time, update_by, update_time,proc_inst_id,record_status,association from t_tool
</sql>
<select id="selectToolByToolId" parameterType="String" resultMap="ToolResult">
<include refid="selectToolVo"/>
where tool_id = #{toolId}
</select>
<select id="getInfoByBpmcId" parameterType="String" resultMap="ToolResult">
<include refid="selectToolVo"/>
where proc_inst_id = #{bpmcId}
</select>
<insert id="insertTool" parameterType="Tool">
insert into t_tool
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="toolId != null">tool_id,</if>
<if test="toolCode != null">tool_code,</if>
<if test="toolName != null">tool_name,</if>
<if test="toolType != null">tool_type,</if>
<if test="toolSource != null">tool_source,</if>
<if test="toolUse != null">tool_use,</if>
<if test="testSituation != null">test_situation,</if>
<if test="functionDesc != null">function_desc,</if>
<if test="applyCondition != null">apply_condition,</if>
<if test="operateExplain != null">operate_explain,</if>
<if test="toolPrincipals != null">tool_principals,</if>
<if test="toolPrincipalsName != null">tool_principals_name,</if>
<if test="toolRespDept != null">tool_resp_dept,</if>
<if test="status != null">status,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="procInstId != null">proc_inst_id,</if>
<if test="recordStatus != null">record_status,</if>
<if test="association != null">association,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="toolId != null">#{toolId},</if>
<if test="toolCode != null">#{toolCode},</if>
<if test="toolName != null">#{toolName},</if>
<if test="toolType != null">#{toolType},</if>
<if test="toolSource != null">#{toolSource},</if>
<if test="toolUse != null">#{toolUse},</if>
<if test="testSituation != null">#{testSituation},</if>
<if test="functionDesc != null">#{functionDesc},</if>
<if test="applyCondition != null">#{applyCondition},</if>
<if test="operateExplain != null">#{operateExplain},</if>
<if test="toolPrincipals != null">#{toolPrincipals},</if>
<if test="toolPrincipalsName != null">#{toolPrincipalsName},</if>
<if test="toolRespDept != null">#{toolRespDept},</if>
<if test="status != null">#{status},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="procInstId != null">#{procInstId},</if>
<if test="recordStatus != null">#{recordStatus},</if>
<if test="association != null">#{association},</if>
</trim>
</insert>
<update id="updateTool" parameterType="Tool">
update t_tool
<trim prefix="SET" suffixOverrides=",">
<if test="toolCode != null">tool_code = #{toolCode},</if>
<if test="toolName != null">tool_name = #{toolName},</if>
<if test="toolType != null">tool_type = #{toolType},</if>
<if test="toolSource != null">tool_source = #{toolSource},</if>
<if test="toolUse != null">tool_use = #{toolUse},</if>
<if test="testSituation != null">test_situation = #{testSituation},</if>
<if test="functionDesc != null">function_desc = #{functionDesc},</if>
<if test="applyCondition != null">apply_condition = #{applyCondition},</if>
<if test="operateExplain != null">operate_explain = #{operateExplain},</if>
<if test="toolPrincipals != null">tool_principals = #{toolPrincipals},</if>
<if test="toolPrincipalsName != null">tool_principals_name = #{toolPrincipalsName},</if>
<if test="toolRespDept != null">tool_resp_dept = #{toolRespDept},</if>
<if test="status != null">status = #{status},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="recordStatus != null">record_status = #{recordStatus},</if>
<if test="association != null">association = #{association},</if>
</trim>
where tool_id = #{toolId}
</update>
<select id="checkToolExist" parameterType="Tool" resultType="int">
select count(*) from t_tool t
<where>
t.tool_code = #{toolCode} and t.tool_resp_dept = #{toolRespDept}
and (t.record_status = 'doing' or t.record_status = 'done')
<if test="toolId!=null and toolId!=''">
and t.tool_id != #{toolId}
</if>
</where>
</select>
<select id="selectToolList" parameterType="Tool" resultMap="ToolResult">
select u.tool_id, u.tool_code, u.tool_name, u.tool_type, u.tool_source, u.tool_use, u.test_situation, u.function_desc, u.apply_condition, u.operate_explain,u.record_status,u.proc_inst_id,
u.tool_principals, u.tool_principals_name, u.tool_resp_dept, u.status, u.create_by, u.create_time, u.remark, d.dept_name as tool_resp_dept_name,u.association from t_tool u
left join sys_dept d on u.tool_resp_dept = d.dept_id
where 1=1
and u.record_status != 'cancel'
<if test="toolId != null and toolId != ''">
AND u.tool_id = #{toolId}
</if>
<if test="toolCode != null and toolCode != ''">
AND u.tool_code = #{toolCode}
</if>
<if test="toolName != null and toolName != ''">
AND u.tool_name like concat('%', #{toolName}, '%')
</if>
<if test="status != null and status != ''">
AND u.status = #{status}
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
AND date_format(u.create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
AND date_format(u.create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
</if>
<if test="toolRespDept != null and toolRespDept != ''">
AND u.tool_resp_dept = #{toolRespDept}
</if>
<if test="createBy != null and createBy != '' and permission != true">
AND (u.create_by = #{createBy} or u.record_status = 'done')
</if>
<if test="recordStatus != null and recordStatus != ''">
AND u.record_status = #{recordStatus}
</if>
order by create_time desc
</select>
<delete id="deleteToolByToolId" parameterType="String">
delete from t_tool where tool_id = #{toolId}
</delete>
<delete id="deleteToolByToolIds" parameterType="String">
delete from t_tool where tool_id in
<foreach item="toolId" collection="array" open="(" separator="," close=")">
#{toolId}
</foreach>
</delete>
</mapper>