<?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.CategoryExtMapper">
|
|
<!-- 管理页面查询 -->
|
<resultMap id="CategoryExtListVO" type="doumeemes.dao.ext.vo.CategoryExtListVO" autoMapping="true">
|
<id column="ID" jdbcType="INTEGER" property="id"/>
|
<association property="pmodel" javaType="doumeemes.dao.business.model.Category">
|
<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_TYPE" jdbcType="VARCHAR" property="type"/>
|
<result column="PMODEL_CODE" jdbcType="TINYINT" property="code"/>
|
<result column="PMODEL_NAME" jdbcType="TINYINT" property="name"/>
|
<result column="PMODEL_PARENT_ID" jdbcType="INTEGER" property="parentId"/>
|
<result column="PMODEL_CATE_TYPE" jdbcType="CHAR" property="cateType"/>
|
</association>
|
</resultMap>
|
<select id="selectList" parameterType="doumeemes.dao.ext.dto.QueryCategoryExtDTO" resultMap="CategoryExtListVO">
|
SELECT
|
`a`.*,
|
`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`.`TYPE` AS PMODEL_TYPE,
|
`pmodel`.`CODE` AS PMODEL_CODE,
|
`pmodel`.`NAME` AS PMODEL_NAME,
|
`pmodel`.`PARENT_ID` AS PMODEL_PARENT_ID,
|
`pmodel`.`CATE_TYPE` AS PMODEL_CATE_TYPE,
|
d.company_id as companyId
|
FROM `category` `a`
|
LEFT JOIN `category` `pmodel` ON a.PARENT_ID=pmodel.ID
|
LEFT JOIN `department` `d` ON a.ROOT_DEPART_ID=d.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="type != null and type != ''">
|
AND `a`.`TYPE` = #{type}
|
</if>
|
<if test="code != null and code!=''">
|
AND `a`.`CODE` = #{code}
|
</if>
|
<if test="name != null and name!=''">
|
AND `a`.`NAME` like concat('%',#{name},'%')
|
</if>
|
<if test="parentId != null">
|
AND `a`.`PARENT_ID` = #{parentId}
|
</if>
|
<if test="cateType != null and cateType != ''">
|
AND `a`.`CATE_TYPE` = #{cateType}
|
</if>
|
<if test="pmodelId != null">
|
AND `pmodel`.`ID` = #{pmodelId}
|
</if>
|
<if test="pmodelDeleted != null">
|
AND `pmodel`.`DELETED` = #{pmodelDeleted}
|
</if>
|
<if test="pmodelCreateUser != null">
|
AND `pmodel`.`CREATE_USER` = #{pmodelCreateUser}
|
</if>
|
<if test="pmodelCreateTime != null">
|
AND `pmodel`.`CREATE_TIME` = #{pmodelCreateTime}
|
</if>
|
<if test="pmodelUpdateUser != null">
|
AND `pmodel`.`UPDATE_USER` = #{pmodelUpdateUser}
|
</if>
|
<if test="pmodelUpdateTime != null">
|
AND `pmodel`.`UPDATE_TIME` = #{pmodelUpdateTime}
|
</if>
|
<if test="pmodelRemark != null and pmodelRemark != ''">
|
AND `pmodel`.`REMARK` = #{pmodelRemark}
|
</if>
|
<if test="pmodelRootDepartId != null">
|
AND `pmodel`.`ROOT_DEPART_ID` = #{pmodelRootDepartId}
|
</if>
|
<if test="pmodelType != null and pmodelType != ''">
|
AND `pmodel`.`TYPE` = #{pmodelType}
|
</if>
|
<if test="pmodelCode != null">
|
AND `pmodel`.`CODE` = #{pmodelCode}
|
</if>
|
<if test="pmodelName != null">
|
AND `pmodel`.`NAME` = #{pmodelName}
|
</if>
|
<if test="pmodelParentId != null">
|
AND `pmodel`.`PARENT_ID` = #{pmodelParentId}
|
</if>
|
<if test="pmodelCateType != null and pmodelCateType != ''">
|
AND `pmodel`.`CATE_TYPE` = #{pmodelCateType}
|
</if>
|
</where>
|
order by a.id desc
|
</select>
|
</mapper>
|