| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 |
- <?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.railway.business.safetool.mapper.SecScheduledMapper">
- <resultMap id="BaseResultMap" type="com.railway.business.safetool.domain.vo.SecScheduledDetailVo">
- <result column="toolName" property="toolName"/>
- <result column="unit" property="unit"/>
- <collection property="baseSafetyTools" ofType="com.railway.business.safetool.domain.vo.SecScheduledToolsVo">
- <result column="tool_id" property="toolId"/>
- <result column="tool_code" property="toolCode"/>
- <result column="id" property="id"/>
- </collection>
- </resultMap>
- <resultMap id="BaseResultMap2" type="com.railway.business.safetool.domain.vo.SecScheduledListVo2">
- <result column="id" property="id"/>
- <result column="dept_id" property="deptId"/>
- <result column="lab_id" property="labId"/>
- <result column="scheduled_time" property="scheduledTime"/>
- <result column="deptName" property="deptName"/>
- <result column="labName" property="labName"/>
- <result column="c" property="c"/>
- </resultMap>
- <sql id="Base_Column_List">
- id,
- dept_id,
- store_place,
- lab_id,
- scheduled_time,
- state,
- del_flag,
- create_by,
- create_time,
- update_by,
- update_time
- </sql>
- <insert id="insert" parameterType="com.railway.business.safetool.domain.SecScheduled">
- <selectKey keyProperty="id" order="AFTER" resultType="Long">
- select @@IDENTITY as id
- </selectKey>
- INSERT INTO sec_scheduled
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test ='null != deptId'>
- dept_id,
- </if>
- <if test ='null != labId'>
- lab_id,
- </if>
- <if test ='null != scheduledTime'>
- scheduled_time,
- </if>
- <if test ='null != state'>
- state,
- </if>
- <if test ='null != delFlag'>
- del_flag,
- </if>
- <if test ='null != createBy'>
- create_by,
- </if>
- <if test ='null != createTime'>
- create_time,
- </if>
- <if test ='null != updateBy'>
- update_by,
- </if>
- <if test ='null != updateTime'>
- update_time
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test ='null != deptId'>
- #{deptId},
- </if>
- <if test ='null != labId'>
- #{labId},
- </if>
- <if test ='null != scheduledTime'>
- #{scheduledTime},
- </if>
- <if test ='null != state'>
- #{state},
- </if>
- <if test ='null != delFlag'>
- #{delFlag},
- </if>
- <if test ='null != createBy'>
- #{createBy},
- </if>
- <if test ='null != createTime'>
- #{createTime},
- </if>
- <if test ='null != updateBy'>
- #{updateBy},
- </if>
- <if test ='null != updateTime'>
- #{updateTime}
- </if>
- </trim>
- </insert>
- <delete id="delete">
- UPDATE sec_scheduled
- set del_flag='1'
- WHERE id = #{id}
- </delete>
- <update id="update" parameterType="com.railway.business.safetool.domain.SecScheduled">
- UPDATE sec_scheduled
- <set>
- <if test ='null != deptId'>dept_id = #{deptId},</if>
- <if test ='null != labId'>lab_id = #{labId},</if>
- <if test ='null != scheduledTime'>scheduled_time = #{scheduledTime},</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>
- <select id="getInfo" resultMap="BaseResultMap">
- select d3.dict_label toolName ,t.unit,t.tool_id,t.tool_code,r.id
- FROM sec_scheduled s
- LEFT JOIN sec_scheduled_tool r
- ON r.scheduled_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 s.state = 0 and t.del_flag = '0' and t.state = '1'
- and s.id=#{id}
- </select>
- <select id="getList" resultMap="BaseResultMap2">
- select s.id,s.dept_id,s.lab_id,s.scheduled_time ,d1.dept_name deptName,d2.dept_name labName,concat(count(1),'件') c
- from
- sec_scheduled s
- left join sec_scheduled_tool r
- on r.scheduled_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
- where s.del_flag = '0' and s.state = 0 and t.del_flag = '0' and t.state = '1'
- and s.dept_id=#{deptId}
- <if test="labId!=null and labId!=''">
- and s.lab_id=#{labId}
- </if>
- <if test="orderby!=null and orderby!=''">
- order by scheduled_time ${orderby}
- </if>
- </select>
- </mapper>
|