jiangping
2023-08-17 6365ab0a976afdd247742c9b3dca15deb3a7a7a1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<?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.CheckAttrExtMapper">
 
  <!-- 管理页面查询 -->
  <resultMap id="CheckAttrExtListVO" type="doumeemes.dao.ext.vo.CheckAttrExtListVO" autoMapping="true">
    <id column="ID" jdbcType="INTEGER" property="id"/>
    <association property="pmodel" javaType="doumeemes.dao.business.model.Procedures">
      <id column="PMODEL_ID" jdbcType="INTEGER" property="id"/>
      <result column="PMODEL_DELETED" jdbcType="TINYINT" property="deleted"/>
      <result column="PMODEL_CREATE_USER" jdbcType="INTEGER" property="createUser"/>
      <result column="PMODEL_CREATE_TIME" jdbcType="TIMESTAMP" property="createTime"/>
      <result column="PMODEL_UPDATE_USER" jdbcType="INTEGER" property="updateUser"/>
      <result column="PMODEL_UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime"/>
      <result column="PMODEL_REMARK" jdbcType="VARCHAR" property="remark"/>
      <result column="PMODEL_ROOT_DEPART_ID" jdbcType="INTEGER" property="rootDepartId"/>
      <result column="PMODEL_DEPART_ID" jdbcType="INTEGER" property="departId"/>
      <result column="PMODEL_CODE" jdbcType="VARCHAR" property="code"/>
      <result column="PMODEL_NAME" jdbcType="VARCHAR" property="name"/>
      <result column="PMODEL_SORTNUM" jdbcType="INTEGER" property="sortnum"/>
      <result column="PMODEL_ORG_ID" jdbcType="INTEGER" property="orgId"/>
      <result column="PMODEL_USER_ID" jdbcType="INTEGER" property="userId"/>
      <result column="PMODEL_PICKING_WAREHOUSE_ID" jdbcType="INTEGER" property="pickingWarehouseId"/>
      <result column="PMODEL_PRODUCE_WAREHOUSE_ID" jdbcType="INTEGER" property="produceWarehouseId"/>
      <result column="PMODEL_LEVEL" jdbcType="TINYINT" property="level"/>
    </association>
  </resultMap>
  <select id="selectList" parameterType="doumeemes.dao.ext.dto.QueryCheckAttrExtDTO" resultMap="CheckAttrExtListVO">
    SELECT
      `a`.`ID`,
      `a`.`DELETED`,
      `a`.`CREATE_USER`,
      `a`.`CREATE_TIME`,
      `a`.`UPDATE_USER`,
      `a`.`UPDATE_TIME`,
      `a`.`REMARK`,
      `a`.`ROOT_DEPART_ID`,
      `a`.`PROCEDURE_ID`,
      `a`.`TYPE`,
      `a`.`SORTNUM`,
      `a`.`STATUS`,
      `a`.`TIPS`,
      `a`.`NAME`,
    a.IS_REQUIRED,
    `pmodel`.`ID` AS PMODEL_ID,
    `pmodel`.`DELETED` AS PMODEL_DELETED,
    `pmodel`.`CREATE_USER` AS PMODEL_CREATE_USER,
    `pmodel`.`CREATE_TIME` AS PMODEL_CREATE_TIME,
    `pmodel`.`UPDATE_USER` AS PMODEL_UPDATE_USER,
    `pmodel`.`UPDATE_TIME` AS PMODEL_UPDATE_TIME,
    `pmodel`.`REMARK` AS PMODEL_REMARK,
    `pmodel`.`ROOT_DEPART_ID` AS PMODEL_ROOT_DEPART_ID,
    `pmodel`.`DEPART_ID` AS PMODEL_DEPART_ID,
    `pmodel`.`CODE` AS PMODEL_CODE,
    `pmodel`.`NAME` AS PMODEL_NAME,
    `pmodel`.`SORTNUM` AS PMODEL_SORTNUM,
    `pmodel`.`ORG_ID` AS PMODEL_ORG_ID,
    `pmodel`.`USER_ID` AS PMODEL_USER_ID,
    `pmodel`.`PICKING_WAREHOUSE_ID` AS PMODEL_PICKING_WAREHOUSE_ID,
    `pmodel`.`PRODUCE_WAREHOUSE_ID` AS PMODEL_PRODUCE_WAREHOUSE_ID,
    `pmodel`.`LEVEL` AS PMODEL_LEVEL
    FROM `check_attr` `a`
    LEFT JOIN `procedures` `pmodel` ON a.PROCEDURE_ID=pmodel.ID
    <where>
      <if test="id != null">
        AND `a`.`ID` = #{id}
      </if>
      <if test="deleted != null">
        AND `a`.`DELETED` = #{deleted}
      </if>
      <if test="createUser != null">
        AND `a`.`CREATE_USER` = #{createUser}
      </if>
      <if test="createTime != null">
        AND `a`.`CREATE_TIME` = #{createTime}
      </if>
      <if test="updateUser != null">
        AND `a`.`UPDATE_USER` = #{updateUser}
      </if>
      <if test="updateTime != null">
        AND `a`.`UPDATE_TIME` = #{updateTime}
      </if>
      <if test="remark != null and remark != ''">
        AND `a`.`REMARK` = #{remark}
      </if>
      <if test="rootDepartId != null">
        AND `a`.`ROOT_DEPART_ID` = #{rootDepartId}
      </if>
      <if test="procedureId != null">
        AND `a`.`PROCEDURE_ID` = #{procedureId}
      </if>
      <if test="type != null">
        AND `a`.`TYPE` = #{type}
      </if>
      <if test="sortnum != null">
        AND `a`.`SORTNUM` = #{sortnum}
      </if>
      <if test="status != null">
        AND `a`.`STATUS` = #{status}
      </if>
      <if test="tips != null and tips != ''">
        AND `a`.`TIPS` = #{tips}
      </if>
      <if test="name != null and name != ''">
        AND `a`.`NAME` like concat('%',#{name},'%')
      </if>
 
      <if test="pmodelDepartId != null and pmodelDepartId != ''">
        AND `pmodel`.`DEPART_ID`  = #{pmodelDepartId}
      </if>
      <if test="departIds != null and departIds.size()>0">
        AND `pmodel`.`ORG_ID`  in <foreach collection="departIds" item="item" separator="," open="(" close=")">#{item}</foreach>
      </if>
    </where>
    order by  `a`.`SORTNUM` asc
  </select>
</mapper>