<?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.WarehouseExtMapper">
|
|
<!-- 管理页面查询 -->
|
<resultMap id="WarehouseExtListVO" type="doumeemes.dao.ext.vo.WarehouseExtListVO" autoMapping="true">
|
<id column="ID" jdbcType="INTEGER" property="id"/>
|
<association property="mmodel" javaType="doumeemes.dao.system.model.SystemUser">
|
<id column="MMODEL_ID" jdbcType="INTEGER" property="id"/>
|
<result column="MMODEL_DELETED" jdbcType="TINYINT" property="deleted"/>
|
<result column="MMODEL_CREATE_USER" jdbcType="INTEGER" property="createUser"/>
|
<result column="MMODEL_CREATE_TIME" jdbcType="TIMESTAMP" property="createTime"/>
|
<result column="MMODEL_UPDATE_USER" jdbcType="INTEGER" property="updateUser"/>
|
<result column="MMODEL_UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime"/>
|
<result column="MMODEL_FIXED" jdbcType="TINYINT" property="fixed"/>
|
<result column="MMODEL_PASSWORD" jdbcType="VARCHAR" property="password"/>
|
<result column="MMODEL_SALT" jdbcType="VARCHAR" property="salt"/>
|
<result column="MMODEL_AVATAR" jdbcType="VARCHAR" property="avatar"/>
|
<result column="MMODEL_MOBILE" jdbcType="VARCHAR" property="mobile"/>
|
<result column="MMODEL_EMAIL" jdbcType="VARCHAR" property="email"/>
|
<result column="MMODEL_SEX" jdbcType="VARCHAR" property="sex"/>
|
<result column="MMODEL_BIRTHDAY" jdbcType="DATE" property="birthday"/>
|
<result column="MMODEL_EMP_NO" jdbcType="VARCHAR" property="empNo"/>
|
<result column="MMODEL_REALNAME" jdbcType="VARCHAR" property="realname"/>
|
<result column="MMODEL_USERNAME" jdbcType="VARCHAR" property="username"/>
|
<result column="MMODEL_SYSTEMID" jdbcType="VARCHAR" property="systemid"/>
|
<result column="MMODEL_INVALID_TIME" jdbcType="TIMESTAMP" property="invalidTime"/>
|
<result column="MMODEL_TYPE" jdbcType="INTEGER" property="type"/>
|
</association>
|
<association property="tmodel" javaType="doumeemes.dao.system.model.SystemDictData">
|
<id column="TMODEL_ID" jdbcType="INTEGER" property="id"/>
|
<result column="TMODEL_DELETED" jdbcType="TINYINT" property="deleted"/>
|
<result column="TMODEL_CREATE_USER" jdbcType="INTEGER" property="createUser"/>
|
<result column="TMODEL_CREATE_TIME" jdbcType="TIMESTAMP" property="createTime"/>
|
<result column="TMODEL_UPDATE_USER" jdbcType="INTEGER" property="updateUser"/>
|
<result column="TMODEL_UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime"/>
|
<result column="TMODEL_DICT_ID" jdbcType="INTEGER" property="dictId"/>
|
<result column="TMODEL_CODE" jdbcType="LONGVARCHAR" property="code"/>
|
<result column="TMODEL_LABEL" jdbcType="VARCHAR" property="label"/>
|
<result column="TMODEL_SORT" jdbcType="INTEGER" property="sort"/>
|
<result column="TMODEL_DISABLED" jdbcType="INTEGER" property="disabled"/>
|
</association>
|
</resultMap>
|
<select id="selectList" parameterType="doumeemes.dao.ext.dto.QueryWarehouseExtDTO" resultMap="WarehouseExtListVO">
|
SELECT
|
`a`.`ID`,
|
`a`.`DELETED`,
|
`a`.`CREATE_USER`,
|
`a`.`CREATE_TIME`,
|
`a`.`UPDATE_USER`,
|
`a`.`UPDATE_TIME`,
|
`a`.`REMARK`,
|
`a`.`ROOT_DEPART_ID`,
|
`a`.`DEPART_ID`,
|
`a`.`PROCEDURE_ID`,
|
`a`.`QRCODE`,
|
`a`.`NAME`,
|
`a`.`USE_LOCATION`,
|
`a`.`STATUS`,
|
`a`.`ADDR`,
|
`a`.`MANAGER_ID`,
|
`a`.`TYPE`,
|
`a`.`CODE`,
|
a.IS_SALES,
|
a.ASCRIPTION,
|
a.SYSTEM_DIC_DATA_ID,
|
`mmodel`.`ID` AS MMODEL_ID,
|
`mmodel`.`DELETED` AS MMODEL_DELETED,
|
`mmodel`.`CREATE_USER` AS MMODEL_CREATE_USER,
|
`mmodel`.`CREATE_TIME` AS MMODEL_CREATE_TIME,
|
`mmodel`.`UPDATE_USER` AS MMODEL_UPDATE_USER,
|
`mmodel`.`UPDATE_TIME` AS MMODEL_UPDATE_TIME,
|
`mmodel`.`FIXED` AS MMODEL_FIXED,
|
`mmodel`.`PASSWORD` AS MMODEL_PASSWORD,
|
`mmodel`.`SALT` AS MMODEL_SALT,
|
`mmodel`.`AVATAR` AS MMODEL_AVATAR,
|
`mmodel`.`MOBILE` AS MMODEL_MOBILE,
|
`mmodel`.`EMAIL` AS MMODEL_EMAIL,
|
`mmodel`.`SEX` AS MMODEL_SEX,
|
`mmodel`.`BIRTHDAY` AS MMODEL_BIRTHDAY,
|
`mmodel`.`EMP_NO` AS MMODEL_EMP_NO,
|
`mmodel`.`REALNAME` AS MMODEL_REALNAME,
|
`mmodel`.`USERNAME` AS MMODEL_USERNAME,
|
`mmodel`.`SYSTEMID` AS MMODEL_SYSTEMID,
|
`mmodel`.`INVALID_TIME` AS MMODEL_INVALID_TIME,
|
`mmodel`.`TYPE` AS MMODEL_TYPE,
|
`dmodel`.`name` AS DMODEL_NAME,
|
`tmodel`.`ID` AS TMODEL_ID,
|
`tmodel`.`DELETED` AS TMODEL_DELETED,
|
`tmodel`.`CREATE_USER` AS TMODEL_CREATE_USER,
|
`tmodel`.`CREATE_TIME` AS TMODEL_CREATE_TIME,
|
`tmodel`.`UPDATE_USER` AS TMODEL_UPDATE_USER,
|
`tmodel`.`UPDATE_TIME` AS TMODEL_UPDATE_TIME,
|
`tmodel`.`DICT_ID` AS TMODEL_DICT_ID,
|
`tmodel`.`CODE` AS TMODEL_CODE,
|
`tmodel`.`LABEL` AS TMODEL_LABEL,
|
`tmodel`.`SORT` AS TMODEL_SORT,
|
`tmodel`.`DISABLED` AS TMODEL_DISABLED
|
FROM `warehouse` `a`
|
left JOIN `system_user` `mmodel` ON a.MANAGER_ID=mmodel.ID
|
left join `department` `dmodel` on a.DEPART_ID=dmodel.id
|
LEFT JOIN `system_dict_data` `tmodel` ON a.SYSTEM_DIC_DATA_ID=tmodel.ID
|
<where>
|
<if test="id != null">
|
AND `a`.`ID` = #{id}
|
</if>
|
<if test="deleted != null">
|
AND `a`.`DELETED` = #{deleted}
|
</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="departId != null">
|
AND `a`.`DEPART_ID` = #{departId}
|
</if>
|
<if test="procedureId != null">
|
AND `a`.`PROCEDURE_ID` = #{procedureId}
|
</if>
|
<if test="qrcode != null">
|
AND `a`.`QRCODE` = #{qrcode}
|
</if>
|
<if test="name != null and name != ''">
|
AND `a`.`NAME` like concat('%', #{name},'%')
|
</if>
|
<if test="useLocation != null">
|
AND `a`.`USE_LOCATION` = #{useLocation}
|
</if>
|
<if test="status != null">
|
AND `a`.`STATUS` = #{status}
|
</if>
|
<if test="addr != null and addr != ''">
|
AND `a`.`ADDR` = #{addr}
|
</if>
|
<if test="managerId != null">
|
AND `a`.`MANAGER_ID` = #{managerId}
|
</if>
|
<if test="type != null">
|
AND `a`.`TYPE` = #{type}
|
</if>
|
<if test="code != null and code != ''">
|
AND `a`.`CODE` = #{code}
|
</if>
|
<if test="ascription != null ">
|
AND `a`.`ASCRIPTION` = #{ascription}
|
</if>
|
<if test="systemDicDataId != null and systemDicDataId != ''">
|
AND locate( `a`.`SYSTEM_DIC_DATA_ID`,#{systemDicDataId})
|
</if>
|
|
<if test="mmodelId != null">
|
AND `mmodel`.`ID` = #{mmodelId}
|
</if>
|
<if test="mmodelDeleted != null">
|
AND `mmodel`.`DELETED` = #{mmodelDeleted}
|
</if>
|
<if test="mmodelCreateUser != null">
|
AND `mmodel`.`CREATE_USER` = #{mmodelCreateUser}
|
</if>
|
<if test="mmodelCreateTime != null">
|
AND `mmodel`.`CREATE_TIME` = #{mmodelCreateTime}
|
</if>
|
<if test="mmodelUpdateUser != null">
|
AND `mmodel`.`UPDATE_USER` = #{mmodelUpdateUser}
|
</if>
|
<if test="mmodelUpdateTime != null">
|
AND `mmodel`.`UPDATE_TIME` = #{mmodelUpdateTime}
|
</if>
|
<if test="mmodelFixed != null">
|
AND `mmodel`.`FIXED` = #{mmodelFixed}
|
</if>
|
<if test="mmodelPassword != null and mmodelPassword != ''">
|
AND `mmodel`.`PASSWORD` = #{mmodelPassword}
|
</if>
|
<if test="mmodelSalt != null and mmodelSalt != ''">
|
AND `mmodel`.`SALT` = #{mmodelSalt}
|
</if>
|
<if test="mmodelAvatar != null and mmodelAvatar != ''">
|
AND `mmodel`.`AVATAR` = #{mmodelAvatar}
|
</if>
|
<if test="mmodelMobile != null and mmodelMobile != ''">
|
AND `mmodel`.`MOBILE` = #{mmodelMobile}
|
</if>
|
<if test="mmodelEmail != null and mmodelEmail != ''">
|
AND `mmodel`.`EMAIL` = #{mmodelEmail}
|
</if>
|
<if test="mmodelSex != null and mmodelSex != ''">
|
AND `mmodel`.`SEX` = #{mmodelSex}
|
</if>
|
<if test="mmodelBirthday != null">
|
AND `mmodel`.`BIRTHDAY` = #{mmodelBirthday}
|
</if>
|
<if test="mmodelEmpNo != null and mmodelEmpNo != ''">
|
AND `mmodel`.`EMP_NO` = #{mmodelEmpNo}
|
</if>
|
<if test="mmodelRealname != null and mmodelRealname != ''">
|
AND `mmodel`.`REALNAME` = #{mmodelRealname}
|
</if>
|
<if test="mmodelUsername != null and mmodelUsername != ''">
|
AND `mmodel`.`USERNAME` = #{mmodelUsername}
|
</if>
|
<if test="mmodelSystemid != null and mmodelSystemid != ''">
|
AND `mmodel`.`SYSTEMID` = #{mmodelSystemid}
|
</if>
|
<if test="mmodelInvalidTime != null">
|
AND `mmodel`.`INVALID_TIME` = #{mmodelInvalidTime}
|
</if>
|
<if test="mmodelType != null">
|
AND `mmodel`.`TYPE` = #{mmodelType}
|
</if>
|
<if test="tmodelId != null">
|
AND `tmodel`.`ID` = #{tmodelId}
|
</if>
|
<if test="tmodelDeleted != null">
|
AND `tmodel`.`DELETED` = #{tmodelDeleted}
|
</if>
|
<if test="tmodelCreateUser != null">
|
AND `tmodel`.`CREATE_USER` = #{tmodelCreateUser}
|
</if>
|
<if test="tmodelCreateTime != null">
|
AND `tmodel`.`CREATE_TIME` = #{tmodelCreateTime}
|
</if>
|
<if test="tmodelUpdateUser != null">
|
AND `tmodel`.`UPDATE_USER` = #{tmodelUpdateUser}
|
</if>
|
<if test="tmodelUpdateTime != null">
|
AND `tmodel`.`UPDATE_TIME` = #{tmodelUpdateTime}
|
</if>
|
<if test="tmodelDictId != null">
|
AND `tmodel`.`DICT_ID` = #{tmodelDictId}
|
</if>
|
<if test="tmodelCode != null and tmodelCode != ''">
|
AND `tmodel`.`CODE` = #{tmodelCode}
|
</if>
|
<if test="tmodelLabel != null and tmodelLabel != ''">
|
AND `tmodel`.`LABEL` = #{tmodelLabel}
|
</if>
|
<if test="tmodelSort != null">
|
AND `tmodel`.`SORT` = #{tmodelSort}
|
</if>
|
<if test="tmodelDisabled != null">
|
AND `tmodel`.`DISABLED` = #{tmodelDisabled}
|
</if>
|
<if test="departIds != null and departIds.size()>0">
|
AND (`a`.`CREATE_USER` = #{createUser} or a.`MANAGER_ID` = #{createUser} or exists (select d.id from company_user d where d.user_id =a.`MANAGER_ID` 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 ( a.`MANAGER_ID` = #{createUser} or `a`.`CREATE_USER` = #{createUser})
|
</if>
|
|
|
</where>
|
|
order by convert(a.name using gbk) asc
|
</select>
|
</mapper>
|