1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- <?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="com.dayou.mapper.PostMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.dayou.entity.Post">
- <result column="id" property="id" />
- <result column="deleted" property="deleted" />
- <result column="created" property="created" />
- <result column="modified" property="modified" />
- <result column="name" property="name" />
- <result column="department_id" property="departmentId" />
- <result column="duty" property="duty" />
- <result column="parent_id" property="parentId" />
- </resultMap>
- <!-- 通用查询结果列 -->
- <sql id="Base_Column_List">
- id,
- deleted,
- created,
- modified,
- name, department_id, duty,parent_id
- </sql>
- <insert id="upsert" parameterType="com.dayou.entity.Post">
- insert IGNORE into post (id,name) values(#{post.id},#{post.name})
- </insert>
- <select id="getPage" parameterType="com.dayou.vo.PostVO" resultType="com.dayou.vo.PostVO">
- SELECT
- p.id,
- p.NAME,
- p.duty,
- p.deleted,
- p.modified,
- d.NAME AS departmentName,
- d.id as departmentId,
- p.created,
- p.parent_id,
- p1.name as leaderPost,
- d1.name as leaderDepartmentName,
- d1.id as leaderDepartmentId,
- p1.id as leaderPostId
- FROM
- post p
- LEFT JOIN department d ON p.department_id = d.id
- left join post p1 on p.parent_id = p1.id
- left join department d1 on p1.department_id = d1.id
- <where>
- p.deleted =0 and d.deleted = 0
- <if test="postVO!=null and postVO.departmentName != null and postVO.departmentName != '' ">
- and d.name like concat ('%', #{postVO.departmentName},'%')
- </if>
- <if test="postVO!=null and postVO.name != null and postVO.name!='' ">
- and p.name like concat ('%',#{postVO.name},'%')
- </if>
- </where>
- order by p.id DESC
- </select>
- <select id="xSimpleAll" resultType="com.dayou.common.PullDownModel">
- select p.id ,CONCAT(p.name,'-',d.name) as name from post p left join department d on p.department_id = d.id where p.deleted =0 and d.deleted=0
- </select>
- <select id="getDepartmentList" parameterType="java.util.Set" resultType="com.dayou.bo.SimpleParentModel">
- select distinct d.name ,d.id ,d.parent_id from post p left join department d on d.id = p.department_id
- where d.deleted = 0 and p.deleted = 0
- <if test="postIds!=null and postIds.size!=0">
- and p.id in
- <foreach collection="postIds" item="pId" open="(" close=")" separator=",">
- #{pId}
- </foreach>
- </if>
- </select>
- </mapper>
|