| <?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="doumeemes.dao.ext.WorkorderCheckAttrExtMapper"> | 
|   | 
|   <!-- 管理页面查询 --> | 
|   <resultMap id="WorkorderCheckAttrExtListVO" type="doumeemes.dao.ext.vo.WorkorderCheckAttrExtListVO" autoMapping="true"> | 
|     <id column="ID" jdbcType="INTEGER" property="id"/> | 
|   </resultMap> | 
|   <select id="selectList" parameterType="doumeemes.dao.ext.dto.QueryWorkorderCheckAttrExtDTO" resultMap="WorkorderCheckAttrExtListVO"> | 
|     SELECT | 
|       `workorderCheckAttr`.*,b.realname as userName,c.name as attrName | 
|     FROM `workorder_check_attr` `workorderCheckAttr` | 
|     left join `system_user` b on `workorderCheckAttr`.CREATE_USER = b.id | 
|     left join `check_attr` c on `workorderCheckAttr`.ATTR_ID = c.id | 
|     <where> | 
|       <if test="id != null"> | 
|         AND `workorderCheckAttr`.`ID` = #{id} | 
|       </if> | 
|       <if test="deleted != null"> | 
|         AND `workorderCheckAttr`.`DELETED` = #{deleted} | 
|       </if> | 
|       <if test="createUser != null"> | 
|         AND `workorderCheckAttr`.`CREATE_USER` = #{createUser} | 
|       </if> | 
|       <if test="createTime != null"> | 
|         AND `workorderCheckAttr`.`CREATE_TIME` = #{createTime} | 
|       </if> | 
|       <if test="updateUser != null"> | 
|         AND `workorderCheckAttr`.`UPDATE_USER` = #{updateUser} | 
|       </if> | 
|       <if test="updateTime != null"> | 
|         AND `workorderCheckAttr`.`UPDATE_TIME` = #{updateTime} | 
|       </if> | 
|       <if test="remark != null and remark != ''"> | 
|         AND `workorderCheckAttr`.`REMARK` = #{remark} | 
|       </if> | 
|       <if test="rootDepartId != null"> | 
|         AND `workorderCheckAttr`.`ROOT_DEPART_ID` = #{rootDepartId} | 
|       </if> | 
|       <if test="departId != null"> | 
|         AND `workorderCheckAttr`.`DEPART_ID` = #{departId} | 
|       </if> | 
|       <if test="planId != null"> | 
|         AND `workorderCheckAttr`.`PLAN_ID` = #{planId} | 
|       </if> | 
|       <if test="workorderId != null"> | 
|         AND `workorderCheckAttr`.`WORKORDER_ID` = #{workorderId} | 
|       </if> | 
|       <if test="attrId != null"> | 
|         AND `workorderCheckAttr`.`ATTR_ID` = #{attrId} | 
|       </if> | 
|       <if test="val != null and val != ''"> | 
|         AND `workorderCheckAttr`.`VAL` = #{val} | 
|       </if> | 
|     </where> | 
|   </select> | 
|   | 
|   | 
|   | 
|   <select id="findallList" parameterType="doumeemes.dao.ext.dto.QueryWorkorderCheckAttrExtDTO" resultMap="WorkorderCheckAttrExtListVO"> | 
|     SELECT | 
|     `workorderCheckAttr`.*,b.realname as userName,c.name as attrName,w.code as workordercode,w.STATUS as workorderstatus,p.name as procedureName | 
|     FROM `workorder_check_attr` `workorderCheckAttr` | 
|     left join `system_user` b on `workorderCheckAttr`.CREATE_USER = b.id | 
|     left join `check_attr` c on `workorderCheckAttr`.ATTR_ID = c.id | 
|     left join workorder w on w.id=workorderCheckAttr.WORKORDER_ID | 
|     LEFT JOIN `procedures` `p` ON c.`PROCEDURE_ID`=p.ID | 
|     <where> | 
|       <if test="id != null"> | 
|         AND `workorderCheckAttr`.`ID` = #{id} | 
|       </if> | 
|       <if test="deleted != null"> | 
|         AND `workorderCheckAttr`.`DELETED` = #{deleted} | 
|       </if> | 
|       <if test="createTime != null"> | 
|         AND `workorderCheckAttr`.`CREATE_TIME` = #{createTime} | 
|       </if> | 
|       <if test="updateUser != null"> | 
|         AND `workorderCheckAttr`.`UPDATE_USER` = #{updateUser} | 
|       </if> | 
|       <if test="updateTime != null"> | 
|         AND `workorderCheckAttr`.`UPDATE_TIME` = #{updateTime} | 
|       </if> | 
|       <if test="remark != null and remark != ''"> | 
|         AND `workorderCheckAttr`.`REMARK` = #{remark} | 
|       </if> | 
|       <if test="rootDepartId != null"> | 
|         AND `workorderCheckAttr`.`ROOT_DEPART_ID` = #{rootDepartId} | 
|       </if> | 
|       <if test="departId != null"> | 
|         AND `workorderCheckAttr`.`DEPART_ID` = #{departId} | 
|       </if> | 
|       <if test="planId != null"> | 
|         AND `workorderCheckAttr`.`PLAN_ID` = #{planId} | 
|       </if> | 
|       <if test="workorderId != null"> | 
|         AND `workorderCheckAttr`.`WORKORDER_ID` = #{workorderId} | 
|       </if> | 
|       <if test="attrId != null"> | 
|         AND `workorderCheckAttr`.`ATTR_ID` = #{attrId} | 
|       </if> | 
|       <if test="val != null and val != ''"> | 
|         AND `workorderCheckAttr`.`VAL` = #{val} | 
|       </if> | 
|       <if test="workordercode != null and workordercode != ''"> | 
|         AND `w`.`code` = #{workordercode} | 
|       </if> | 
|   | 
|       <if test="procedureid != null and procedureid != ''"> | 
|         AND `p`.`id` = #{procedureid} | 
|       </if> | 
|   | 
|       <if test="orgId != null and orgId != ''"> | 
|         AND `p`.`ORG_ID` = #{orgId} | 
|       </if> | 
|   | 
|       <if test="startdate != null and startdate != '' "> | 
|         AND `workorderCheckAttr`.`CREATE_TIME`  >= #{startdate} | 
|       </if> | 
|       <if test="enddate != null and enddate != '' "> | 
|         AND #{enddate} >= `workorderCheckAttr`.`CREATE_TIME` | 
|       </if> | 
|       <if test="departIds != null and departIds.size()>0"> | 
|         AND (  `workorderCheckAttr`.`CREATE_USER` = #{createUser}  or | 
|         exists (select d.id from company_user d where  d.user_id= workorderCheckAttr.CREATE_USER  and d.department_id | 
|         in <foreach collection="departIds" item="item" separator="," open="(" close=")">#{item}</foreach>) | 
|         ) | 
|       </if> | 
|       <if test="departIds != null and departIds.size()==0"> | 
|         AND  `workorderCheckAttr`.`CREATE_USER` = #{createUser} | 
|       </if> | 
|   | 
|     </where> | 
| order by `workorderCheckAttr`.`CREATE_TIME` desc | 
|   </select> | 
| </mapper> |