| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271 |
- <?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.QpUsegasApplyMapper">
- <resultMap type="com.zd.airbottle.domain.vo.QpUsegasApplyVO" id="QpUsegasApplyResult">
- <result property="id" column="id"/>
- <result property="location" column="location"/>
- <result property="subjectId" column="subject_id"/>
- <result property="applyUser" column="apply_user"/>
- <result property="userId" column="user_id"/>
- <result property="deptId" column="dept_id"/>
- <result property="deptName" column="dept_name"/>
- <result property="phone" column="phone"/>
- <result property="startTime" column="start_time"/>
- <result property="endTime" column="end_time"/>
- <result property="gasUse" column="gas_use"/>
- <result property="applyCertificate" column="apply_certificate"/>
- <result property="safetyPrecautions" column="safety_precautions"/>
- <result property="useGasId" column="use_gas_id"/>
- <result property="useGasName" column="use_gas_name"/>
- <result property="leadAuditStaus" column="lead_audit_staus"/>
- <result property="leadAuditUserid" column="lead_audit_userid"/>
- <result property="leadAuditUsername" column="lead_audit_username"/>
- <result property="leadAuditTime" column="lead_audit_time"/>
- <result property="leadAuditCause" column="lead_audit_cause"/>
- <result property="centerAuditStatus" column="center_audit_status"/>
- <result property="centerAuditUserid" column="center_audit_userid"/>
- <result property="centerAuditUsername" column="center_audit_username"/>
- <result property="centerAuditTime" column="center_audit_time"/>
- <result property="centerAuditCause" column="center_audit_cause"/>
- <result property="createTime" column="create_time"/>
- </resultMap>
- <sql id="selectQpUsegasApplyVo">
- select id, location, subject_id, apply_user, user_id, dept_id, dept_name,
- phone, start_time, end_time, gas_use, apply_certificate, safety_precautions,
- use_gas_id,use_gas_name, lead_audit_staus, lead_audit_userid, lead_audit_username,
- lead_audit_time, lead_audit_cause, center_audit_status, center_audit_userid,
- center_audit_username, center_audit_time, center_audit_cause, create_time
- from qp_usegas_apply
- </sql>
- <sql id="selectQpUsegasApplyListVo">
- select t.id, t.location, t.subject_id, t.apply_user, t.user_id, t.dept_id,
- t.dept_name, t.phone, t.start_time, t.end_time, t.gas_use, t.apply_certificate,
- t.safety_precautions, t.use_gas_id,t.use_gas_name, t.lead_audit_staus,
- t.lead_audit_userid, t.lead_audit_username, t.lead_audit_time, t.lead_audit_cause,
- t.center_audit_status, t.center_audit_userid, t.center_audit_username, t.center_audit_time,
- t.center_audit_cause, t.create_time,
- (select fl.room_num from lab_build_floor_layout fl where fl.sub_id = t.subject_id) room,
- ( select admin_id from lab_subject su where su.id=t.subject_id ) admin_id
- from qp_usegas_apply as t
- LEFT JOIN sys_dept d on t.dept_id=d.dept_id
- LEFT JOIN sys_user u on t.user_id=u.user_id
- </sql>
- <select id="selectQpUsegasApplyList" parameterType="com.zd.airbottle.domain.vo.QpUsegasApplyVO" resultMap="QpUsegasApplyResult">
- <include refid="selectQpUsegasApplyListVo"/>
- where 1=1
- <if test="searchValue != null and searchValue != ''">
- and
- (t.apply_user like concat('%', #{searchValue}, '%') or
- t.phone like concat('%', #{searchValue}, '%') or
- t.location like concat('%', #{searchValue}, '%'))
- </if>
- <if test="location != null and location != ''"> and t.location = #{location}</if>
- <if test="subjectId != null "> and t.subject_id = #{subjectId}</if>
- <if test="applyUser != null and applyUser != ''"> and t.apply_user = #{applyUser}</if>
- <if test="userId != null "> and t.user_id = #{userId}</if>
- <if test="deptId != null "> and t.dept_id = #{deptId}</if>
- <if test="deptName != null and deptName != ''"> and t.dept_name like concat('%', #{deptName}, '%')</if>
- <if test="phone != null and phone != ''"> and t.phone = #{phone}</if>
- <if test="startTime != null and endTime != null">
- and (
- #{startTime} BETWEEN t.start_time and t.end_time
- or #{endTime} BETWEEN t.start_time and t.end_time
- or t.start_time BETWEEN #{startTime} and #{endTime}
- )
- </if>
- <!--<if test="startTime != null "> and t.start_time >= #{startTime}</if>
- <if test="endTime != null "> and t.end_time <= #{endTime}</if>-->
- <if test="gasUse != null and gasUse != ''"> and t.gas_use = #{gasUse}</if>
- <if test="applyCertificate != null and applyCertificate != ''"> and t.apply_certificate = #{applyCertificate}</if>
- <if test="safetyPrecautions != null and safetyPrecautions != ''"> and t.safety_precautions = #{safetyPrecautions}</if>
- <if test="useGasId != null "> and t.use_gas_id = #{useGasId}</if>
- <if test="useGasName != null and useGasName != ''"> and t.use_gas_name like concat('%', #{useGasName}, '%')</if>
- <if test="leadAuditStaus != null "> and t.lead_audit_staus = #{leadAuditStaus}</if>
- <if test="leadAuditUserid != null "> and t.lead_audit_userid = #{leadAuditUserid}</if>
- <if test="leadAuditUsername != null and leadAuditUsername != ''"> and lead_audit_username like concat('%', #{leadAuditUsername}, '%')</if>
- <if test="leadAuditTime != null "> and t.lead_audit_time = #{leadAuditTime}</if>
- <if test="leadAuditCause != null and leadAuditCause != ''"> and t.lead_audit_cause = #{leadAuditCause}</if>
- <if test="centerAuditStatus != null "> and t.center_audit_status = #{centerAuditStatus}</if>
- <if test="centerAuditUserid != null "> and t.center_audit_userid = #{centerAuditUserid}</if>
- <if test="centerAuditUsername != null and centerAuditUsername != ''"> and t.center_audit_username like concat('%', #{centerAuditUsername}, '%')</if>
- <if test="centerAuditTime != null "> and t.center_audit_time = #{centerAuditTime}</if>
- <if test="centerAuditCause != null and centerAuditCause != ''"> and t.center_audit_cause = #{centerAuditCause}</if>
- <if test="auditStatus !=null and auditStatus == 0 "> and (t.lead_audit_staus=0 or t.center_audit_status=0 ) and t.lead_audit_staus !=2</if> /**待审核**/
- <if test="auditStatus !=null and auditStatus == 1 "> and t.center_audit_status=1 </if> /**通过**/
- <if test="auditStatus !=null and auditStatus == 2 "> and (t.lead_audit_staus=2 or t.center_audit_status=2) </if> /**驳回**/
- <!-- 数据范围过滤 -->
- ${params.dataScope}
- order by
- <if test="remark != '100' "> t.create_time </if>
- <if test="remark == '100' "> t.lead_audit_time </if>
- desc
- </select>
- <select id="selectQpUsegasApplyById" resultMap="QpUsegasApplyResult">
- <include refid="selectQpUsegasApplyListVo"/>
- where t.id = #{id}
- </select>
- <insert id="insertQpUsegasApply" parameterType="com.zd.airbottle.domain.QpUsegasApply" useGeneratedKeys="true" keyProperty="id">
- insert into qp_usegas_apply
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="location != null">location,</if>
- <if test="subjectId != null">subject_id,</if>
- <if test="applyUser != null">apply_user,</if>
- <if test="userId != null">user_id,</if>
- <if test="deptId != null">dept_id,</if>
- <if test="deptName != null">dept_name,</if>
- <if test="phone != null">phone,</if>
- <if test="startTime != null">start_time,</if>
- <if test="endTime != null">end_time,</if>
- <if test="gasUse != null">gas_use,</if>
- <if test="applyCertificate != null">apply_certificate,</if>
- <if test="safetyPrecautions != null">safety_precautions,</if>
- <if test="useGasId != null">use_gas_id,</if>
- <if test="useGasName != null">use_gas_name,</if>
- <if test="leadAuditStaus != null">lead_audit_staus,</if>
- <if test="leadAuditUserid != null">lead_audit_userid,</if>
- <if test="leadAuditUsername != null">lead_audit_username,</if>
- <if test="leadAuditTime != null">lead_audit_time,</if>
- <if test="leadAuditCause != null">lead_audit_cause,</if>
- <if test="centerAuditStatus != null">center_audit_status,</if>
- <if test="centerAuditUserid != null">center_audit_userid,</if>
- <if test="centerAuditUsername != null">center_audit_username,</if>
- <if test="centerAuditTime != null">center_audit_time,</if>
- <if test="centerAuditCause != null">center_audit_cause,</if>
- <if test="createTime != null">create_time,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="location != null">#{location},</if>
- <if test="subjectId != null">#{subjectId},</if>
- <if test="applyUser != null">#{applyUser},</if>
- <if test="userId != null">#{userId},</if>
- <if test="deptId != null">#{deptId},</if>
- <if test="deptName != null">#{deptName},</if>
- <if test="phone != null">#{phone},</if>
- <if test="startTime != null">#{startTime},</if>
- <if test="endTime != null">#{endTime},</if>
- <if test="gasUse != null">#{gasUse},</if>
- <if test="applyCertificate != null">#{applyCertificate},</if>
- <if test="safetyPrecautions != null">#{safetyPrecautions},</if>
- <if test="useGasId != null">#{useGasId},</if>
- <if test="useGasName != null">#{useGasName},</if>
- <if test="leadAuditStaus != null">#{leadAuditStaus},</if>
- <if test="leadAuditUserid != null">#{leadAuditUserid},</if>
- <if test="leadAuditUsername != null">#{leadAuditUsername},</if>
- <if test="leadAuditTime != null">#{leadAuditTime},</if>
- <if test="leadAuditCause != null">#{leadAuditCause},</if>
- <if test="centerAuditStatus != null">#{centerAuditStatus},</if>
- <if test="centerAuditUserid != null">#{centerAuditUserid},</if>
- <if test="centerAuditUsername != null">#{centerAuditUsername},</if>
- <if test="centerAuditTime != null">#{centerAuditTime},</if>
- <if test="centerAuditCause != null">#{centerAuditCause},</if>
- <if test="createTime != null">#{createTime},</if>
- </trim>
- </insert>
- <update id="updateQpUsegasApply" parameterType="com.zd.airbottle.domain.QpUsegasApply">
- update qp_usegas_apply
- <trim prefix="SET" suffixOverrides=",">
- <if test="location != null">location = #{location},</if>
- <if test="subjectId != null">subject_id = #{subjectId},</if>
- <if test="applyUser != null">apply_user = #{applyUser},</if>
- <if test="userId != null">user_id = #{userId},</if>
- <if test="deptId != null">dept_id = #{deptId},</if>
- <if test="deptName != null">dept_name = #{deptName},</if>
- <if test="phone != null">phone = #{phone},</if>
- <if test="startTime != null">start_time = #{startTime},</if>
- <if test="endTime != null">end_time = #{endTime},</if>
- <if test="gasUse != null">gas_use = #{gasUse},</if>
- <if test="applyCertificate != null">apply_certificate = #{applyCertificate},</if>
- <if test="safetyPrecautions != null">safety_precautions = #{safetyPrecautions},</if>
- <if test="useGasId != null">use_gas_id = #{useGasId},</if>
- <if test="useGasName != null">use_gas_name = #{useGasName},</if>
- <if test="leadAuditStaus != null">lead_audit_staus = #{leadAuditStaus},</if>
- <if test="leadAuditUserid != null">lead_audit_userid = #{leadAuditUserid},</if>
- <if test="leadAuditUsername != null">lead_audit_username = #{leadAuditUsername},</if>
- <if test="leadAuditTime != null">lead_audit_time = #{leadAuditTime},</if>
- <if test="leadAuditCause != null">lead_audit_cause = #{leadAuditCause},</if>
- <if test="centerAuditStatus != null">center_audit_status = #{centerAuditStatus},</if>
- <if test="centerAuditUserid != null">center_audit_userid = #{centerAuditUserid},</if>
- <if test="centerAuditUsername != null">center_audit_username = #{centerAuditUsername},</if>
- <if test="centerAuditTime != null">center_audit_time = #{centerAuditTime},</if>
- <if test="centerAuditCause != null">center_audit_cause = #{centerAuditCause},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- </trim>
- where id = #{id}
- </update>
- <delete id="deleteQpUsegasApplyById" >
- delete from qp_usegas_apply where id = #{id}
- </delete>
- <delete id="deleteQpUsegasApplyByIds">
- delete from qp_usegas_apply where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- <!-- 用气重新申请-->
- <update id="updateQpUsegasApplyRepeat" parameterType="com.zd.airbottle.domain.QpUsegasApply">
- update qp_usegas_apply
- <trim prefix="SET" suffixOverrides=",">
- <if test="location != null">location = #{location},</if>
- <if test="subjectId != null">subject_id = #{subjectId},</if>
- <if test="applyUser != null">apply_user = #{applyUser},</if>
- <if test="userId != null">user_id = #{userId},</if>
- <if test="deptId != null">dept_id = #{deptId},</if>
- <if test="deptName != null">dept_name = #{deptName},</if>
- <if test="phone != null">phone = #{phone},</if>
- <if test="startTime != null">start_time = #{startTime},</if>
- <if test="endTime != null">end_time = #{endTime},</if>
- <if test="gasUse != null">gas_use = #{gasUse},</if>
- <if test="applyCertificate != null">apply_certificate = #{applyCertificate},</if>
- <if test="safetyPrecautions != null">safety_precautions = #{safetyPrecautions},</if>
- <if test="useGasId != null">use_gas_id = #{useGasId},</if>
- <if test="useGasName != null">use_gas_name = #{useGasName},</if>
- <if test="centerAuditTime != null">center_audit_time = #{centerAuditTime},</if>
- <if test="centerAuditCause != null">center_audit_cause = #{centerAuditCause},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- lead_audit_staus=0,lead_audit_userid=null,lead_audit_username=null,lead_audit_time=null,
- lead_audit_cause=null,center_audit_status=0,center_audit_userid=null,center_audit_username=null,
- center_audit_time=null,center_audit_cause=null
- </trim>
- where id = #{id}
- </update>
- <!-- 用气申请导出查询-->
- <select id="qpUsegasApplyExportExcel" parameterType="com.zd.airbottle.domain.QpUsegasApply"
- resultType="com.zd.airbottle.domain.vo.QpUsegasApplyExcelVo">
- select ua.apply_user,ua.phone,ua.use_gas_name,
- concat_ws(' - ',
- date_format(ua.start_time,'%Y-%m-%d'),
- date_format(ua.end_time,'%Y-%m-%d') ) usageTime,
- ua.location
- from qp_usegas_apply ua
- where ua.center_audit_status=1
- <if test="searchValue != null and searchValue!=''">
- and ( ua.apply_user like concat('%', #{searchValue}, '%') or
- ua.phone like concat('%', #{searchValue}, '%') or
- ua.location like concat('%', #{searchValue}, '%') )
- </if>
- <if test="startTime != null and startTime != ''"><!-- 开始时间检索 -->
- and date_format(ua.start_time,'%Y-%m-%d') >= date_format(#{startTime},'%Y-%m-%d')
- </if>
- <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
- and date_format(ua.end_time,'%Y-%m-%d') <= date_format(#{endTime},'%Y-%m-%d')
- </if>
- <if test="ids !=null ">
- and ua.id in
- <foreach item="id" collection="ids" open="(" separator="," close=")">
- #{id}
- </foreach>
- </if>
- </select>
- </mapper>
|