|
|
@@ -1,114 +1,117 @@
|
|
|
<?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">
|
|
|
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="com.railway.business.safetool.mapper.SecExperimentMapper">
|
|
|
|
|
|
- <resultMap id="BaseResultMap" type="com.railway.business.safetool.domain.vo.SecExpDetailVo">
|
|
|
- <result column="toolName" property="toolName"/>
|
|
|
- <result column="unit" property="unit"/>
|
|
|
- <collection property="baseSafetyTools" ofType="com.railway.business.safetool.domain.vo.SecExpToolsVo">
|
|
|
- <result column="tool_id" property="toolId"/>
|
|
|
- <result column="tool_code" property="toolCode"/>
|
|
|
- <result column="id" property="id"/>
|
|
|
- <result column="isok" property="isok"/>
|
|
|
- </collection>
|
|
|
-
|
|
|
- </resultMap>
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- <resultMap id="listResultMap" type="com.railway.business.safetool.domain.vo.SecExpListVo">
|
|
|
- <result column="id" property="id"/>
|
|
|
- <result column="state" property="state"/>
|
|
|
- <result column="scheduled_time" property="scheduledTime"/>
|
|
|
- <result column="end_time" property="endTime"/>
|
|
|
- <result column="exp_date" property="expDate"/>
|
|
|
- <result column="dept_name" property="deptName"/>
|
|
|
- <result column="lab_name" property="labName"/>
|
|
|
- <result column="real_name" property="realName"/>
|
|
|
-
|
|
|
- </resultMap>
|
|
|
-
|
|
|
-
|
|
|
- <insert id="insertExp" keyProperty="id" parameterType="com.railway.business.safetool.domain.vo.SecExpAddParmVo">
|
|
|
- INSERT INTO sec_experiment (lab_id,lab_name,schedled_id,end_time,dept_id,dept_name,
|
|
|
- scheduled_time,state,del_flag,create_time,create_by)
|
|
|
- select lab_id,d2.dept_name lab_name,s.id schedled_id,
|
|
|
- ADDDATE(now(),3) end_time ,s.dept_id,d.dept_name,
|
|
|
- now() scheduled_time,
|
|
|
- '0' state ,'0' del_flag, now() create_time , #{createby} create_by
|
|
|
- from sec_scheduled s
|
|
|
- left join sys_dept d on s.dept_id = d.dept_id
|
|
|
- left join sys_dept d2 on lab_id = d2.dept_id
|
|
|
- where s.id = #{secid}
|
|
|
- </insert>
|
|
|
-
|
|
|
-
|
|
|
- <insert id="insertTool" >
|
|
|
- INSERT INTO sec_experiment_tool (tool_id,isok,exp_id,del_flag,create_time,create_by)
|
|
|
- select tool_id,'0' isok ,#{expid} exp_id ,'0' del_flag, now() create_time , #{createby} create_by
|
|
|
- from sec_scheduled_tool
|
|
|
- where scheduled_id = #{secid}
|
|
|
- </insert>
|
|
|
-
|
|
|
-
|
|
|
- <update id="update" parameterType="com.railway.business.safetool.domain.SecExperiment">
|
|
|
- UPDATE sec_experiment
|
|
|
- <set>
|
|
|
- <if test ='null != labId'>lab_id = #{labId},</if>
|
|
|
- <if test ='null != schedledId'>schedled_id = #{schedledId},</if>
|
|
|
- <if test ='null != endTime'>end_time = #{endTime},</if>
|
|
|
- <if test ='null != deptName'>dept_name = #{deptName},</if>
|
|
|
- <if test ='null != scheduledTime'>scheduled_time = #{scheduledTime},</if>
|
|
|
- <if test ='null != expDate'>exp_date = #{expDate},</if>
|
|
|
- <if test ='null != state'>state = #{state},</if>
|
|
|
- <if test ='null != delFlag'>del_flag = #{delFlag},</if>
|
|
|
- <if test ='null != createBy'>create_by = #{createBy},</if>
|
|
|
- <if test ='null != createTime'>create_time = #{createTime},</if>
|
|
|
- <if test ='null != updateBy'>update_by = #{updateBy},</if>
|
|
|
- <if test ='null != updateTime'>update_time = #{updateTime}</if>
|
|
|
- </set>
|
|
|
- WHERE id = #{id}
|
|
|
- </update>
|
|
|
- <update id="updateScheduled" >
|
|
|
- update sec_scheduled
|
|
|
- set state = #{state}
|
|
|
- where id = (
|
|
|
- select schedled_id from sec_experiment where id = #{id}
|
|
|
- )
|
|
|
- </update>
|
|
|
- <select id="getInfo" resultMap="BaseResultMap">
|
|
|
- select d3.dict_label toolName ,t.unit,t.tool_id,t.tool_code,r.id,r.isok
|
|
|
- FROM sec_experiment s
|
|
|
- LEFT JOIN sec_experiment_tool r
|
|
|
- ON r.exp_id = s.id
|
|
|
- INNER JOIN base_safety_tool t
|
|
|
- ON t.tool_id = r.tool_id
|
|
|
- left join sys_dept d1 on s.dept_id = d1.dept_id
|
|
|
- left join sys_dept d2 on s.lab_id = d2.dept_id
|
|
|
- left join sys_dict_data d3 on d3.dict_type = 'tool_type' and d3.dict_value = t.tool_type
|
|
|
- WHERE s.del_flag = '0' and t.del_flag = '0' and t.state = '1'
|
|
|
- and s.id=#{id}
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="getList" resultMap="listResultMap">
|
|
|
-
|
|
|
- select e.id,e.state,e.scheduled_time,e.end_time,e.exp_date,e.dept_name,e.lab_name,u.real_name from sec_experiment e
|
|
|
- left join sys_user u on e.create_by = u.user_name
|
|
|
- where e.lab_id =#{labId}
|
|
|
-
|
|
|
- <if test="deptId!=null and deptId!=''">
|
|
|
- and e.deptId =#{deptId}
|
|
|
- </if>
|
|
|
-
|
|
|
- <if test="scheduledTime!=null and scheduledTime!=''">
|
|
|
- and e.scheduled_time =#{scheduledTime}
|
|
|
- </if>
|
|
|
-
|
|
|
- <if test="orderby!=null and orderby!=''">
|
|
|
- order by end_time ${orderby}
|
|
|
- </if>
|
|
|
-
|
|
|
- </select>
|
|
|
+ <resultMap id="BaseResultMap" type="com.railway.business.safetool.domain.vo.SecExpDetailVo">
|
|
|
+ <result column="toolName" property="toolName"/>
|
|
|
+ <result column="unit" property="unit"/>
|
|
|
+ <collection property="baseSafetyTools"
|
|
|
+ ofType="com.railway.business.safetool.domain.vo.SecExpToolsVo">
|
|
|
+ <result column="tool_id" property="toolId"/>
|
|
|
+ <result column="tool_code" property="toolCode"/>
|
|
|
+ <result column="id" property="id"/>
|
|
|
+ <result column="isok" property="isok"/>
|
|
|
+ </collection>
|
|
|
+
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+
|
|
|
+ <resultMap id="listResultMap" type="com.railway.business.safetool.domain.vo.SecExpListVo">
|
|
|
+ <result column="id" property="id"/>
|
|
|
+ <result column="state" property="state"/>
|
|
|
+ <result column="scheduled_time" property="scheduledTime"/>
|
|
|
+ <result column="end_time" property="endTime"/>
|
|
|
+ <result column="exp_date" property="expDate"/>
|
|
|
+ <result column="dept_name" property="deptName"/>
|
|
|
+ <result column="lab_name" property="labName"/>
|
|
|
+ <result column="real_name" property="realName"/>
|
|
|
+
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+
|
|
|
+ <insert id="insertExp" keyProperty="id"
|
|
|
+ parameterType="com.railway.business.safetool.domain.vo.SecExpAddParmVo">
|
|
|
+ INSERT INTO sec_experiment (lab_id,lab_name,schedled_id,end_time,dept_id,dept_name,
|
|
|
+ scheduled_time,state,del_flag,create_time,create_by)
|
|
|
+ select lab_id,d2.dept_name lab_name,s.id schedled_id,
|
|
|
+ ADDDATE(now(),3) end_time ,s.dept_id,d.dept_name,
|
|
|
+ now() scheduled_time,
|
|
|
+ '0' state ,'0' del_flag, now() create_time , #{createby} create_by
|
|
|
+ from sec_scheduled s
|
|
|
+ left join sys_dept d on s.dept_id = d.dept_id
|
|
|
+ left join sys_dept d2 on lab_id = d2.dept_id
|
|
|
+ where s.id = #{secid}
|
|
|
+ </insert>
|
|
|
+
|
|
|
+
|
|
|
+ <insert id="insertTool">
|
|
|
+ INSERT INTO sec_experiment_tool (tool_id,isok,exp_id,del_flag,create_time,create_by)
|
|
|
+ select tool_id,'0' isok ,#{expid} exp_id ,'0' del_flag, now() create_time , #{createby}
|
|
|
+ create_by
|
|
|
+ from sec_scheduled_tool
|
|
|
+ where scheduled_id = #{secid}
|
|
|
+ </insert>
|
|
|
+
|
|
|
+
|
|
|
+ <update id="update" parameterType="com.railway.business.safetool.domain.SecExperiment">
|
|
|
+ UPDATE sec_experiment
|
|
|
+ <set>
|
|
|
+ <if test='null != labId'>lab_id = #{labId},</if>
|
|
|
+ <if test='null != schedledId'>schedled_id = #{schedledId},</if>
|
|
|
+ <if test='null != endTime'>end_time = #{endTime},</if>
|
|
|
+ <if test='null != deptName'>dept_name = #{deptName},</if>
|
|
|
+ <if test='null != scheduledTime'>scheduled_time = #{scheduledTime},</if>
|
|
|
+ <if test='null != expDate'>exp_date = #{expDate},</if>
|
|
|
+ <if test='null != state'>state = #{state},</if>
|
|
|
+ <if test='null != delFlag'>del_flag = #{delFlag},</if>
|
|
|
+ <if test='null != createBy'>create_by = #{createBy},</if>
|
|
|
+ <if test='null != createTime'>create_time = #{createTime},</if>
|
|
|
+ <if test='null != updateBy'>update_by = #{updateBy},</if>
|
|
|
+ <if test='null != updateTime'>update_time = #{updateTime}</if>
|
|
|
+ </set>
|
|
|
+ WHERE id = #{id}
|
|
|
+ </update>
|
|
|
+ <update id="updateScheduled">
|
|
|
+ update sec_scheduled
|
|
|
+ set state = #{state}
|
|
|
+ where id = (
|
|
|
+ select schedled_id from sec_experiment where id = #{id}
|
|
|
+ )
|
|
|
+ </update>
|
|
|
+ <select id="getInfo" resultMap="BaseResultMap">
|
|
|
+ select d3.dict_label toolName ,t.unit,t.tool_id,t.tool_code,r.id,r.isok
|
|
|
+ FROM sec_experiment s
|
|
|
+ LEFT JOIN sec_experiment_tool r
|
|
|
+ ON r.exp_id = s.id
|
|
|
+ INNER JOIN base_safety_tool t
|
|
|
+ ON t.tool_id = r.tool_id
|
|
|
+ left join sys_dept d1 on s.dept_id = d1.dept_id
|
|
|
+ left join sys_dept d2 on s.lab_id = d2.dept_id
|
|
|
+ left join sys_dict_data d3 on d3.dict_type = 'tool_type' and d3.dict_value = t.tool_type
|
|
|
+ WHERE s.del_flag = '0' and t.del_flag = '0' and t.state = '1'
|
|
|
+ and s.id=#{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getList" resultMap="listResultMap">
|
|
|
+
|
|
|
+ select e.id,e.state,e.scheduled_time,e.end_time,e.exp_date,e.dept_name,e.lab_name,u.real_name
|
|
|
+ from sec_experiment e
|
|
|
+ left join sys_user u on e.create_by = u.user_name
|
|
|
+ where e.lab_id =#{labId}
|
|
|
+
|
|
|
+ <if test="deptId!=null and deptId!=''">
|
|
|
+ and e.deptId =#{deptId}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="scheduledTime!=null and scheduledTime!=''">
|
|
|
+ and e.scheduled_time =#{scheduledTime}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="orderby!=null and orderby!=''">
|
|
|
+ order by end_time ${orderby}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ </select>
|
|
|
|
|
|
</mapper>
|