| | |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.app.patrolplan.mapper.ArdAppPatrolplanMapper"> |
| | | |
| | | |
| | | <resultMap type="ArdAppPatrolplan" id="ArdAppPatrolplanResult"> |
| | | <result property="patroEndTime" column="patro_end_time" /> |
| | | <result property="userId" column="user_id" /> |
| | |
| | | <sql id="selectArdAppPatrolplanVo"> |
| | | select |
| | | ard_app_patrolplan.id, |
| | | sys_user.nick_name, |
| | | <!-- sys_user.nick_name,--> |
| | | ard_app_patrolplan.patro_end_time, |
| | | ard_app_patrolplan.user_id, |
| | | ard_app_patrolplan.cycle, |
| | |
| | | left join ard_app_patrolpoint as well on ard_app_patrolplan.id = well.patrolplan_id |
| | | left join ard_app_patroluser as users on ard_app_patrolplan.id = users.patrolplan_id |
| | | left join sys_user on ard_app_patrolplan.user_id = sys_user.user_id |
| | | <where> |
| | | <if test="userId != null and userId != ''"> and ard_app_patrolplan.user_id = #{userId}</if> |
| | | <where> |
| | | ard_app_patrolplan.user_id = #{userId} and del_name is null and del_time is null |
| | | <if test="cycle != null and cycle != ''"> and cycle = #{cycle}</if> |
| | | <if test="planName != null and planName != ''"> and plan_name like '%'||#{planName}||'%'</if> |
| | | <if test="patroBeginTime != null and patroBeginTime != ''"> and patro_begin_time >= #{patroBeginTime}</if> |
| | | <if test="patroEndTime != null and patroEndTime != ''"> and patro_end_time <= #{patroEndTime}</if> |
| | | <if test="createTimeBegin != null and createTimeBegin != ''"> and ard_app_patrolplan.create_time >= #{createTimeBegin} </if> |
| | | <if test="createTimeEnd != null and createTimeEnd != ''"> and ard_app_patrolplan.create_time <= #{createTimeEnd}</if> |
| | | <if test="wellId != null and wellId != ''"> |
| | | and well.alarmpoints_id = (select ard_alarmpoints_well.id from ard_alarmpoints_well where well_id = #{wellId}) |
| | | <!-- and well.alarmpoints_id in (select ard_alarmpoints_well.id from ard_alarmpoints_well where well_id = #{wellId})--> |
| | | and well.alarmpoints_id = #{wellId} |
| | | </if> |
| | | <if test="pUser != null and pUser != ''"> |
| | | and users.app_user_id = (select sys_user.user_id from sys_user where nick_name = #{pUser}) |
| | | <!-- and users.app_user_id in (select sys_user.user_id from sys_user where nick_name = #{pUser})--> |
| | | and users.app_user_id = #{pUser} |
| | | </if> |
| | | </where> |
| | | group by ard_app_patrolplan.id,sys_user.nick_name |
| | | group by ard_app_patrolplan.id |
| | | </select> |
| | | |
| | | |
| | | <select id="selectArdAppPatrolplanByPatroEndTime" parameterType="String" resultMap="ArdAppPatrolplanResult"> |
| | | <include refid="selectArdAppPatrolplanVo"/> |
| | | where patro_end_time = #{patroEndTime} |
| | | </select> |
| | | |
| | | |
| | | <insert id="insertArdAppPatrolplan" parameterType="ArdAppPatrolplan"> |
| | | insert into ard_app_patrolplan |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | |
| | | <delete id="deleteArdAppPatrolplanById" parameterType="String"> |
| | | delete from ard_app_patrolplan aap where aap.id = #{id}; |
| | | </delete> |
| | | </mapper> |
| | | |
| | | <select id="shouldRecord" parameterType="String" resultMap="ArdAppPatrolplanResult"> |
| | | select |
| | | ard_app_patrolplan.id, |
| | | well.alarmpoints_id wellId, |
| | | users.app_user_id pUser, |
| | | sys_user.nick_name |
| | | from |
| | | ard_app_patrolplan |
| | | left join ard_app_patrolpoint as well on ard_app_patrolplan.id = well.patrolplan_id |
| | | left join ard_app_patroluser as users on ard_app_patrolplan.id = users.patrolplan_id |
| | | left join sys_user on users.app_user_id = sys_user.user_id |
| | | where ard_app_patrolplan.id = #{id} and del_name is null and del_time is null |
| | | </select> |
| | | |
| | | <select id="executeList" parameterType="ArdAppPatrolplan" resultMap="ArdAppPatrolplanResult"> |
| | | <include refid="selectArdAppPatrolplanVo"/> |
| | | left join ard_app_patrolpoint as well on ard_app_patrolplan.id = well.patrolplan_id |
| | | left join ard_app_patroluser as users on ard_app_patrolplan.id = users.patrolplan_id |
| | | left join sys_user on ard_app_patrolplan.user_id = sys_user.user_id |
| | | <where> |
| | | users.app_user_id = #{userId} and del_name is null and del_time is null |
| | | <if test="cycle != null and cycle != ''"> and cycle = #{cycle}</if> |
| | | <if test="planName != null and planName != ''"> and plan_name like '%'||#{planName}||'%'</if> |
| | | <if test="patroBeginTime != null and patroBeginTime != ''"> and patro_begin_time >= #{patroBeginTime}</if> |
| | | <if test="patroEndTime != null and patroEndTime != ''"> and patro_end_time <= #{patroEndTime}</if> |
| | | <if test="wellId != null and wellId != ''"> |
| | | and well.alarmpoints_id = #{wellId} |
| | | </if> |
| | | <if test="pUser != null and pUser != ''"> |
| | | and users.app_user_id = #{pUser} |
| | | </if> |
| | | </where> |
| | | group by ard_app_patrolplan.id |
| | | </select> |
| | | |
| | | <select id="oncePlan" parameterType="recordMonthExParam" resultMap="ArdAppPatrolplanResult"> |
| | | select plan.* from ard_app_patrolplan plan |
| | | LEFT JOIN ard_app_patroluser users on users.patrolplan_id = plan."id" |
| | | where users.app_user_id = #{userId} and cycle = 'once' and patro_begin_time >= #{begin} and plan.del_name is null and plan.del_time is null ; |
| | | </select> |
| | | |
| | | <select id="dayPlan" parameterType="recordMonthExParam" resultMap="ArdAppPatrolplanResult"> |
| | | select plan.* from ard_app_patrolplan plan |
| | | LEFT JOIN ard_app_patroluser users on users.patrolplan_id = plan."id" |
| | | where users.app_user_id = #{userId} and cycle = 'day' and create_time < #{end} and del_name is null and del_time is null ; |
| | | </select> |
| | | |
| | | <select id="planUser" parameterType="String" resultMap="ArdAppPatrolplanResult"> |
| | | select s.nick_name, plan.plan_name from ard_app_patrolplan plan |
| | | LEFT JOIN ard_app_patroluser users on users.patrolplan_id = plan."id" |
| | | left join sys_user s on plan.user_id = s.user_id |
| | | where users.app_user_id = #{userId} and son is null |
| | | and plan.create_time >= #{beforeTime} and plan.create_time <= #{time} |
| | | and del_name is null and del_time is null order by plan.create_time desc; |
| | | </select> |
| | | </mapper> |