liujie
2023-05-22 9f2315d92cc93f8f431805a10ea9ce3f79fa7eb2
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
<?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.stylefeng.guns.modular.system.dao.TGroupMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.TGroup">
        <id column="id" property="id" />
        <result column="name" property="name" />
        <result column="sales_id" property="salesId" />
        <result column="department_id" property="departmentId" />
    </resultMap>
 
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, name, sales_id, department_id
    </sql>
    <select id="getList" resultType="com.stylefeng.guns.modular.system.model.TGroupVo">
       select t1.* ,t2.fullname as departmentName,t3.`name` as salesName  from t_group  t1 left JOIN sys_dept t2 on t1.department_id = t2.id
        left join  sys_user t3 on t1.sales_id = t3.id where t1.remove=0
        <if test="name !=null and name !=''">
            and t1.name like concat("%",#{name},"%")
        </if>
        <if test="departmentId !=null and departmentId !=''">
            and t1.department_id =#{departmentId}
        </if>
        <if test="sales !=null and sales !=''">
            and t1.sales_id =#{sales}
        </if>
    </select>
 
</mapper>