mirror of
https://github.com/FatttSnake/Pinnacle-OA.git
synced 2026-04-06 07:21:24 +08:00
70 lines
2.7 KiB
XML
70 lines
2.7 KiB
XML
<?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.cfive.pinnacle.mapper.DepartmentMapper">
|
|
|
|
<select id="getAllDepartment" resultType="department">
|
|
select id, name, tel, address, deleted, version
|
|
from t_department where deleted = 0
|
|
<if test="searchInput != null and searchInput != ''">
|
|
<choose>
|
|
<when test="searchType == 0">
|
|
<if test="searchRegex == 1">
|
|
and (
|
|
name regexp #{searchInput}
|
|
or tel regexp #{searchInput}
|
|
or address regexp #{searchInput}
|
|
)
|
|
</if>
|
|
<if test="searchRegex != 1">
|
|
and (
|
|
instr(name, #{searchInput}) > 0
|
|
or instr(tel, #{searchInput}) > 0
|
|
or instr(address, #{searchInput}) > 0
|
|
)
|
|
</if>
|
|
</when>
|
|
<when test="searchType == 1">
|
|
<if test="searchRegex == 1">
|
|
and name regexp #{searchInput}
|
|
</if>
|
|
<if test="searchRegex != 1">
|
|
and instr(name, #{searchInput}) > 0
|
|
</if>
|
|
</when>
|
|
<when test="searchType == 2">
|
|
<if test="searchRegex == 1">
|
|
and tel regexp #{searchInput}
|
|
</if>
|
|
<if test="searchRegex != 1">
|
|
and instr(tel, #{searchInput}) > 0
|
|
</if>
|
|
</when>
|
|
<when test="searchType == 3">
|
|
<if test="searchRegex == 1">
|
|
and address regexp #{searchInput}
|
|
</if>
|
|
<if test="searchRegex != 1">
|
|
and instr(address, #{searchInput}) > 0
|
|
</if>
|
|
</when>
|
|
</choose>
|
|
</if>
|
|
</select>
|
|
|
|
<select id="getDepartAndUser" resultMap="department">
|
|
select d.id did, name, u.id uid, username
|
|
from t_department d,
|
|
t_user u
|
|
where d.id = u.department_id
|
|
and d.deleted = 0
|
|
and u.deleted = 0
|
|
</select>
|
|
<resultMap id="department" type="department" autoMapping="true">
|
|
<id column="did" property="id"/>
|
|
<collection property="userList" ofType="user" autoMapping="true">
|
|
<id column="uid" property="id"/>
|
|
<result column="uid" property="id"/>
|
|
</collection>
|
|
</resultMap>
|
|
</mapper>
|