<?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.newfiber.api.pc.dao.WarnTeamBossMapper"> <resultMap id="WarnTeamBossExt" type="com.newfiber.api.pc.model.entity.WarnTeamBoss"> <result column="id" property="id"/> <result column="unit" property="unit"/> <result column="name" property="name"/> <result column="job" property="job"/> <result column="phone" property="phone"/> <result column="user_no" property="userNo"/> <result column="special_plane" property="specialPlane"/> <result column="duty" property="duty"/> <result column="is_appr_user" property="isApprUser"/> <result column="org_type" property="orgType"/> <result column="org_name" property="orgName"/> <collection property="warnTeamSups" ofType="com.newfiber.api.pc.model.entity.WarnTeamSup"> <result column="sup_id" property="supId"/> <result column="sup_name" property="supName"/> <result column="sup_job" property="supJob"/> <result column="sup_phone" property="supPhone"/> <result column="sup_plane" property="supPlane"/> <result column="boss_id" property="bossId"/> <result column="user_no" property="userNo"/> <result column="user_type" property="userType"/> <result column="org_type" property="orgType"/> <result column="org_name" property="orgName"/> </collection> </resultMap> <update id="changeApprUser"> update warn_team_boss set is_appr_user = CASE is_appr_user WHEN 0 THEN 1 ELSE 0 END WHERE id = #{bossId} </update> <select id="taskOrgType" resultType="com.newfiber.api.pc.model.entity.TaskOrgCount"> select org_type,org_name from warn_team_boss group by org_type order by org_type </select> <select id="isExist" resultType="com.newfiber.api.pc.model.entity.WarnTeamBoss"> SELECT wtb.user_no FROM `warn_team_boss` wtb where wtb.user_no = #{userNo} union SELECT wts.user_no from warn_team_sup wts where wts.user_no = #{userNo} </select> <select id="userSearchTree" resultMap="WarnTeamBossExt"> SELECT a.*,b.* FROM warn_team_boss a LEFT JOIN warn_team_sup b ON a.id = b.boss_id WHERE 1 =1 <if test="searchStr!= null and searchStr != ''"> and (a.unit like concat('%',#{searchStr},'%') OR a.`name`like concat('%',#{searchStr},'%') OR a.`phone` like concat('%',#{searchStr},'%') OR a.`job` like concat('%',#{searchStr},'%') OR b.`sup_name` like concat('%',#{searchStr},'%') OR b.`sup_job` like concat('%',#{searchStr},'%') OR b.`sup_phone` like concat('%',#{searchStr},'%') OR a.org_name like concat('%',#{searchStr},'%')) </if> </select> <select id="selectAllUser" resultType="com.newfiber.api.pc.model.vo.TaskTempUserVO"> select wtb.id as bossId, wts.sup_id as supId, wtb.org_name as orgName, wtb.unit as unit, wtb.name as bossName, wts.sup_name as subName, wtb.job as bossJob, wts.sup_job as subJob, wtb.phone as bossPhone, wts.sup_phone as supPhone, wtb.user_no as bossUserNo, wts.user_no as supUserNo, wtb.org_type as bossOrgType, wts.user_type as supUserType, wts.org_type as supOrgType from warn_team_boss wtb left join warn_team_sup wts on wtb.id = wts.boss_id </select> </mapper>