Newer
Older
huludao / src / main / resources / mapper / Data_User_JurisdictionDao.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.newfiber.api.pc.dao.Data_User_JurisdictionDao" >
  
  <sql id = "UserJur_sql">
			FROM sys_user_info left join sys_user_jurisdiction on sys_user_info.User_No=sys_user_jurisdiction.User_No
			<where>
				<if test="fuzzyQuery!=null">
				   (sys_user_info.User_No like '%${fuzzyQuery}%' OR sys_user_info.userName like '%${fuzzyQuery}%')
				</if>
				<if test="Jurisdiction_No!=null">
				    AND  sys_user_jurisdiction.Jurisdiction_No like '%${Jurisdiction_No}%'
				    
				</if>
			       AND  sys_user_jurisdiction.Type='0'
			</where>
		</sql>
   

   

	
	   	<sql id="op">
	
	<choose>
        <when test="sort!=null and sort != ''">
          
           ${sort}
        </when>
        <otherwise>
           Serial
        </otherwise>
    </choose>
	
	</sql>
	<sql id="oc">
	  <choose>
        <when test="order !=null and order  != ''">
           ${order}
        </when>
        <otherwise>
           DESC
        </otherwise>
    </choose>
	
	</sql>


 <sql id = "UserJur_sqlOne">
			FROM sys_user_info
			<where>
				<if test="Jurisdiction_No!=null">
					 sys_user_info.User_No not in
					(SELECT sys_user_jurisdiction.User_NO from sys_user_jurisdiction where sys_user_jurisdiction.Jurisdiction_No like '%${Jurisdiction_No}%'  and  sys_user_jurisdiction.Type='0' )
				</if>
			
			</where>
		</sql>

  
  
  
  
  
  
  
  
  
  
  
  <insert id="insertUserJurisdiction" parameterType="list" >
    insert into sys_user_jurisdiction
        (       user_no,
                jurisdiction_no,
                `type`,
                create_time
        ) values
    <foreach collection="list" item="item" separator=",">
        <trim prefix="(" suffix=")" suffixOverrides="," >

          <if test="item.userNo != null" >
            #{item.userNo,jdbcType=VARCHAR},
          </if>

          <if test="item.jurisdictionNo != null" >
            #{item.jurisdictionNo,jdbcType=VARCHAR},
          </if>
          <if test="item.type!=null">
            #{item.type,jdbcType=BIGINT},
          </if>
          <if test="item.createTime!=null">
            #{item.createTime,jdbcType=TIMESTAMP},
          </if>

        </trim>
    </foreach>
  </insert>
	  
  
  

  <delete id="deleteUserRoleJur" parameterType="list" >
    delete from sys_user_jurisdiction
    where `type` in
    <foreach collection="list" item="item" open="(" separator="," close=")">
        #{item}
    </foreach>
  </delete>
  
  <delete id="deleteUserOrgJur" parameterType="list" >
    delete from sys_user_jurisdiction
    where jurisdiction_no in
          <foreach collection="list" item="item" separator="," open="(" close=")">
              #{item.jurisdictionNo,jdbcType=VARCHAR}
          </foreach>

     and `type` in
      <foreach collection="list" item="item" separator="," open="(" close=")">
          #{item.type,jdbcType=VARCHAR}
      </foreach>
  </delete>
  <select id="GetUserJurisdiction" parameterType="string" resultType="com.newfiber.api.pc.model.entity.Data_Role_Jurisdiction">
SELECT DISTINCT  sr.user_no,SJ.jurisdiction_no    FROM sys_user_role  sr LEFT JOIN   sys_role_jurisdiction SJ on sr.role_no=SJ.role_no

where sr.role_no=#{roleNo,jdbcType=VARCHAR} and
 SJ.jurisdiction_no  is not null and sr.user_no is not null
  </select>


  
 <!--  <select id="GetUserJurOne" parameterType="String" resultType="com.newfiber.api.mobile.model.UserManager.Data_User_Jurisdiction"  >
    select  DISTINCT Jurisdiction_No  from sys_user_jurisdiction where User_No=#{User_No,jdbcType=VARCHAR}
  
  </select>
   -->
  
  
</mapper>