| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201 |
- <?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.airbottle.mapper.QpBottleStorageOutMapper">
- <resultMap type="com.zd.airbottle.domain.vo.QpBottleStorageOutVO" id="QpBottleStorageOutResult">
- <result property="id" column="id"/>
- <result property="applyUserName" column="apply_user_name"/>
- <result property="applyUserid" column="apply_userid"/>
- <result property="phone" column="phone"/>
- <result property="createTime" column="create_time"/>
- <result property="storageId" column="storage_id"/>
- <result property="carId" column="car_id"/>
- <result property="carNumber" column="car_number"/>
- <result property="transportId" column="transport_id"/>
- <result property="transportName" column="transport_name"/>
- <result property="disposeUserid" column="dispose_userid"/>
- <result property="disposeUsername" column="dispose_username"/>
- <result property="disposeTime" column="dispose_time"/>
- <result property="completeTime" column="complete_time"/>
- <result property="completeUserid" column="complete_userid"/>
- <result property="completeUsername" column="complete_username"/>
- <result property="pressure" column="pressure"/>
- <result property="outStatus" column="out_status"/>
- </resultMap>
- <sql id="selectQpBottleStorageOutVo">
- select id, apply_user_name, apply_userid, phone, create_time, storage_id, car_id, car_number, transport_id, transport_name, dispose_userid, dispose_username, dispose_time, complete_time, complete_userid, complete_username, pressure ,out_status from qp_bottle_storage_out
- </sql>
- <sql id="selectQpBottleStorageOutListVo">
- select t.id, t.apply_user_name, t.apply_userid, t.phone, t.create_time,
- t.storage_id, t.car_id, t.car_number, t.transport_id, t.transport_name,
- t.dispose_userid, t.dispose_username, t.dispose_time, t.complete_time,
- t.complete_userid, t.complete_username, t.pressure,t.out_status,
- (select fl.room_num from lab_build_floor_layout fl where fl.sub_id=ta.location_id) room
- from qp_bottle_storage_out t
- LEFT JOIN qp_bottle_storage bs on t.storage_id=bs.id
- LEFT JOIN qp_task ta on bs.task_id=ta.id
- LEFT JOIN sys_dept d on ta.dept_id=d.dept_id
- LEFT JOIN sys_user u on ta.user_id=u.user_id
- </sql>
- <select id="selectQpBottleStorageOutList" parameterType="com.zd.airbottle.domain.vo.QpBottleStorageOutVO" resultMap="QpBottleStorageOutResult">
- <include refid="selectQpBottleStorageOutListVo"/>
- <where>
- <if test="searchValue != null and searchValue != ''">
- and ( t.apply_user_name like concat('%', #{searchValue}, '%')
- or t.phone like concat('%', #{searchValue}, '%')
- or ta.location like concat('%', #{searchValue}, '%')
- )
- </if>
- <if test="applyUserName != null and applyUserName != ''"> and t.apply_user_name like concat('%', #{applyUserName}, '%')</if>
- <if test="applyUserid != null "> and t.apply_userid = #{applyUserid}</if>
- <if test="phone != null and phone != ''"> and t.phone = #{phone}</if>
- <if test="storageId != null "> and t.storage_id = #{storageId}</if>
- <if test="carId != null "> and t.car_id = #{carId}</if>
- <if test="carNumber != null and carNumber != ''"> and t.car_number = #{carNumber}</if>
- <if test="transportId != null "> and t.transport_id = #{transportId}</if>
- <if test="transportName != null and transportName != ''"> and t.transport_name like concat('%', #{transportName}, '%')</if>
- <if test="disposeUserid != null "> and t.dispose_userid = #{disposeUserid}</if>
- <if test="disposeUsername != null and disposeUsername != ''"> and t.dispose_username like concat('%', #{disposeUsername}, '%')</if>
- <if test="disposeTime != null "> and t.dispose_time = #{disposeTime}</if>
- <if test="completeTime != null "> and t.complete_time = #{completeTime}</if>
- <if test="completeUserid != null "> and t.complete_userid = #{completeUserid}</if>
- <if test="completeUsername != null and completeUsername != ''"> and t.complete_username like concat('%', #{completeUsername}, '%')</if>
- <if test="pressure != null "> and t.pressure = #{pressure}</if>
- <if test="outStatus != null "> and t.out_status = #{outStatus}</if>
- <if test="startTime != null "> and date_format(t.create_time,'%Y-%m-%d') >= date_format(#{startTime},'%Y-%m-%d')</if>
- <if test="endTime != null "> and date_format(t.create_time,'%Y-%m-%d') <= date_format(#{endTime},'%Y-%m-%d')</if>
- <if test="ids != null ">
- and t.id in
- <foreach item="id" collection="ids" open="(" separator="," close=")">
- #{id}
- </foreach>
- </if>
- </where>
- <!-- 数据范围过滤 -->
- ${params.dataScope}
- order by t.create_time desc
- </select>
- <select id="selectQpBottleStorageOutById" resultMap="QpBottleStorageOutResult">
- <include refid="selectQpBottleStorageOutVo"/>
- where id = #{id}
- </select>
- <insert id="insertQpBottleStorageOut" parameterType="com.zd.airbottle.domain.QpBottleStorageOut" useGeneratedKeys="true" keyProperty="id">
- insert into qp_bottle_storage_out
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="applyUserName != null">apply_user_name,</if>
- <if test="applyUserid != null">apply_userid,</if>
- <if test="phone != null">phone,</if>
- <if test="createTime != null">create_time,</if>
- <if test="storageId != null">storage_id,</if>
- <if test="carId != null">car_id,</if>
- <if test="carNumber != null">car_number,</if>
- <if test="transportId != null">transport_id,</if>
- <if test="transportName != null">transport_name,</if>
- <if test="disposeUserid != null">dispose_userid,</if>
- <if test="disposeUsername != null">dispose_username,</if>
- <if test="disposeTime != null">dispose_time,</if>
- <if test="completeTime != null">complete_time,</if>
- <if test="completeUserid != null">complete_userid,</if>
- <if test="completeUsername != null">complete_username,</if>
- <if test="pressure != null">pressure,</if>
- <if test="outStatus != null">out_status,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="applyUserName != null">#{applyUserName},</if>
- <if test="applyUserid != null">#{applyUserid},</if>
- <if test="phone != null">#{phone},</if>
- <if test="createTime != null">#{createTime},</if>
- <if test="storageId != null">#{storageId},</if>
- <if test="carId != null">#{carId},</if>
- <if test="carNumber != null">#{carNumber},</if>
- <if test="transportId != null">#{transportId},</if>
- <if test="transportName != null">#{transportName},</if>
- <if test="disposeUserid != null">#{disposeUserid},</if>
- <if test="disposeUsername != null">#{disposeUsername},</if>
- <if test="disposeTime != null">#{disposeTime},</if>
- <if test="completeTime != null">#{completeTime},</if>
- <if test="completeUserid != null">#{completeUserid},</if>
- <if test="completeUsername != null">#{completeUsername},</if>
- <if test="pressure != null">#{pressure},</if>
- <if test="outStatus != null">#{outStatus},</if>
- </trim>
- </insert>
- <update id="updateQpBottleStorageOut" parameterType="com.zd.airbottle.domain.QpBottleStorageOut">
- update qp_bottle_storage_out
- <trim prefix="SET" suffixOverrides=",">
- <if test="applyUserName != null">apply_user_name = #{applyUserName},</if>
- <if test="applyUserid != null">apply_userid = #{applyUserid},</if>
- <if test="phone != null">phone = #{phone},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- <if test="storageId != null">storage_id = #{storageId},</if>
- <if test="carId != null">car_id = #{carId},</if>
- <if test="carNumber != null">car_number = #{carNumber},</if>
- <if test="transportId != null">transport_id = #{transportId},</if>
- <if test="transportName != null">transport_name = #{transportName},</if>
- <if test="disposeUserid != null">dispose_userid = #{disposeUserid},</if>
- <if test="disposeUsername != null">dispose_username = #{disposeUsername},</if>
- <if test="disposeTime != null">dispose_time = #{disposeTime},</if>
- <if test="completeTime != null">complete_time = #{completeTime},</if>
- <if test="completeUserid != null">complete_userid = #{completeUserid},</if>
- <if test="completeUsername != null">complete_username = #{completeUsername},</if>
- <if test="pressure != null">pressure = #{pressure},</if>
- <if test="outStatus != null">out_status = #{outStatus},</if>
- </trim>
- where id = #{id}
- </update>
- <delete id="deleteQpBottleStorageOutById">
- delete from qp_bottle_storage_out where id = #{id}
- </delete>
- <delete id="deleteQpBottleStorageOutByIds">
- delete from qp_bottle_storage_out where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- <!-- 回收单 实验室关联查询-->
- <select id="selectQpBottleStorageOutRelationSubject" parameterType="com.zd.airbottle.domain.vo.QpBottleStorageOutVO" resultMap="QpBottleStorageOutResult">
- select t2.id,t2.storage_id,t2.task_id, t2.create_time,taskDetailId,
- (select f.name
- from lab_build_floor f
- where f.type = 1
- and f.id = (
- select f.parent_id
- from lab_build_floor f
- where f.id =
- (select bfl.build_id
- from lab_build_floor_layout bfl
- where bfl.sub_id = t2.location_id))) campus,
- (select f.`name`
- from lab_build_floor f
- where f.type = 2
- and f.id =
- (select bfl.build_id
- from lab_build_floor_layout bfl
- where bfl.sub_id = t2.location_id)) building,
- (select bfl.room_num
- from lab_build_floor_layout bfl
- where bfl.sub_id = t2.location_id) room
- from (
- select *, (select ta.location_id from qp_task ta where ta.id=t.task_id ) location_id from (
- select * from (
- select DISTINCT bs.task_id,bs.task_detail_id taskDetailId,bso.* from qp_bottle_storage_out bso,qp_bottle_storage bs,qp_task ta,qp_task_detail td
- where bso.storage_id= bs.id and bs.task_id=ta.id and td.id = bs.task_detail_id
- <if test="createTime != null "> and date_format(bso.create_time,'%Y-%m-%d') = date_format( #{createTime},'%Y-%m-%d')</if>
- <if test="companyId != null "> and td.supplier_id=#{companyId}</if>
- <if test="remark ==0 "> and bso.out_status =0</if> /**未处理**/
- <if test="remark ==1 "> and bso.out_status !=0</if> /**已处理**/
- ) sto
- ) t
- ) t2
- </select>
- </mapper>
|