| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- <?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.zd.chemical.mapper.ActHxpapplyDetailMapper">
- <resultMap type="com.zd.chemical.domain.ActHxpapplyDetail" id="ActHxpapplyDetailResult">
- <result property="id" column="id"/>
- <result property="hxpapplyId" column="hxpapply_id"/>
- <result property="chemicalId" column="chemical_id"/>
- <result property="chemicalName" column="chemical_name"/>
- <result property="cabinetId" column="cabinet_id"/>
- <result property="applyNum" column="apply_num"/>
- <result property="tickStatus" column="tick_status"/>
- </resultMap>
- <sql id="selectActHxpapplyDetailVo">
- select id, hxpapply_id, chemical_id, chemical_name, cabinet_id, apply_num,tick_status from act_hxpapply_detail
- </sql>
- <sql id="selectActHxpapplyDetailListVo">
- select t.id, t.hxpapply_id, t.chemical_id, t.chemical_name, t.cabinet_id, t.apply_num, t.tick_status from act_hxpapply_detail as t
- </sql>
- <select id="selectActHxpapplyDetailList" parameterType="com.zd.chemical.domain.ActHxpapplyDetail" resultMap="ActHxpapplyDetailResult">
- <include refid="selectActHxpapplyDetailVo"/>
- <where>
- <if test="hxpapplyId != null "> and hxpapply_id = #{hxpapplyId}</if>
- <if test="chemicalId != null "> and chemical_id = #{chemicalId}</if>
- <if test="chemicalName != null and chemicalName != ''"> and chemical_name like concat('%', #{chemicalName}, '%')</if>
- <if test="cabinetId != null "> and cabinet_id = #{cabinetId}</if>
- <if test="applyNum != null "> and apply_num = #{applyNum}</if>
- </where>
- </select>
- <select id="selectApplyDetailList" parameterType="com.zd.chemical.domain.ActHxpapplyDetail" resultType="com.zd.chemical.domain.vo.ActHxpapplyDetailVo">
- SELECT hd.id, hd.chemical_id chemicalId, hd.chemical_name chemicalName,
- hd.`cabinet_id` cabinetId,ct.cabinet_name cabinetName,
- CONCAT((SELECT st.name FROM lab_subject st WHERE st.id = hy.sub_id),'-',(SELECT dt.dept_name FROM sys_dept
- dt,lab_subject st WHERE dt.dept_id = st.build_id AND st.id = hy.sub_id),
- '-',(SELECT bg.name FROM lab_building bg,lab_subject st WHERE bg.id = st.floor_id AND st.id = hy.sub_id),
- ifnull(CONCAT('-',(SELECT slt.room_num room FROM lab_build_floor_layout slt,lab_subject st WHERE slt.sub_id = st.id AND st.id = ct.`sub_id`)),'')) posi,
- CONCAT(0,cl.`chemical_unit`) collegeInventory,
- CONCAT(0,cl.`chemical_unit`) subInventory,
- CONCAT(0,cl.`chemical_unit`) cabinetStorage,
- hd.remaining_storage remainingStorage,
- hd.apply_num applyNum,cl.`chemical_unit` applyUnit,
- hd.tick_status tickStatus,
- (SELECT GROUP_CONCAT(ur.nick_name) FROM sys_user ur WHERE FIND_IN_SET(ur.user_id, s.`safe_user_id`)) AS safeUserNames
- FROM act_hxpapply_detail hd
- LEFT JOIN act_hxpapply hy on hy.id = hd.hxpapply_id
- LEFT JOIN hxp_cabinet ct ON hd.`cabinet_id` = ct.`id`
- LEFT JOIN hxp_chemical cl ON hd.`chemical_id` = cl.`id`
- LEFT JOIN lab_subject s ON hy.`sub_id` = s.`id`
- <where>
- <if test="tickStatus == 1 "> and hd.tick_status in(0,1)</if>
- <if test="hxpapplyId != null "> and hd.hxpapply_id = #{hxpapplyId}</if>
- <if test="chemicalId != null "> and hd.chemical_id = #{chemicalId}</if>
- <if test="chemicalName != null and chemicalName != ''"> and hd.chemical_name like concat('%', #{chemicalName}, '%')</if>
- <if test="cabinetId != null "> and hd.cabinet_id = #{cabinetId}</if>
- <if test="applyNum != null "> and hd.apply_num = #{applyNum}</if>
- </where>
- </select>
- <select id="getListByIds" resultMap="ActHxpapplyDetailResult">
- <include refid="selectActHxpapplyDetailVo"/>
- <where>
- id in
- <foreach item="id" collection="list" open="(" separator="," close=")">
- #{id}
- </foreach>
- </where>
- </select>
- <select id="selectActHxpapplyDetailById" resultMap="ActHxpapplyDetailResult">
- <include refid="selectActHxpapplyDetailVo"/>
- where id = #{id}
- </select>
- <insert id="insertActHxpapplyDetail" parameterType="com.zd.chemical.domain.ActHxpapplyDetail" useGeneratedKeys="true" keyProperty="id">
- insert into act_hxpapply_detail
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="hxpapplyId != null">hxpapply_id,</if>
- <if test="chemicalId != null">chemical_id,</if>
- <if test="chemicalName != null">chemical_name,</if>
- <if test="cabinetId != null">cabinet_id,</if>
- <if test="applyNum != null">apply_num,</if>
- <if test="remainingStorage != null">remaining_storage,</if>
- <if test="tickStatus != null">tick_status,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="hxpapplyId != null">#{hxpapplyId},</if>
- <if test="chemicalId != null">#{chemicalId},</if>
- <if test="chemicalName != null">#{chemicalName},</if>
- <if test="cabinetId != null">#{cabinetId},</if>
- <if test="applyNum != null">#{applyNum},</if>
- <if test="remainingStorage != null">#{remainingStorage},</if>
- <if test="tickStatus != null">#{tickStatus},</if>
- </trim>
- </insert>
- <update id="updateActHxpapplyDetail" parameterType="com.zd.chemical.domain.ActHxpapplyDetail">
- update act_hxpapply_detail
- <trim prefix="SET" suffixOverrides=",">
- <if test="hxpapplyId != null">hxpapply_id = #{hxpapplyId},</if>
- <if test="chemicalId != null">chemical_id = #{chemicalId},</if>
- <if test="chemicalName != null">chemical_name = #{chemicalName},</if>
- <if test="cabinetId != null">cabinet_id = #{cabinetId},</if>
- <if test="applyNum != null">apply_num = #{applyNum},</if>
- <if test="remainingStorage != null">remaining_storage = #{remainingStorage},</if>
- <if test="tickStatus != null">tick_status = #{tickStatus},</if>
- </trim>
- where id = #{id}
- </update>
- <update id="updateActHxpapplyDetailByPass" parameterType="com.zd.chemical.domain.ActHxpapplyDetail">
- update act_hxpapply_detail
- set tick_status=1
- where hxpapply_id = #{hxpapplyId}
- </update>
- <delete id="deleteActHxpapplyDetailById">
- delete from act_hxpapply_detail where id = #{id}
- </delete>
- <delete id="deleteActHxpapplyDetailByApplyId">
- delete from act_hxpapply_detail where hxpapply_id = #{id}
- </delete>
- <delete id="deleteActHxpapplyDetailByIds">
- delete from act_hxpapply_detail where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- </mapper>
|