Newer
Older
huludao / src / main / resources / mapper / SysJurisdictionDao.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.SysJurisdictionDao" >

    <resultMap id="sysJur" type="com.newfiber.api.pc.model.entity.SysJurisdiction">
        <id column="serial" property="serial"/>
        <result property="jurisdictionNo" column="jurisdiction_no"/>
        <result property="jurisdictionName" column="jurisdiction_name"/>
        <result property="jurisdictionType" column="jurisdiction_type"/>
        <result property="jurisdictionTypeZn" column="jurisdiction_type_zn"/>
        <result property="jurisdictionState" column="jurisdiction_state"/>
        <result property="jurisdictionStateZn" column="jurisdiction_state_zn"/>
        <result property="orderSort" column="order_sort"/>
        <result property="createTime" column="create_time"/>
        <result property="updateTime" column="update_time"/>
        <result property="remark" column="remark"/>
    </resultMap>

  

  
  
  
               
  
   <sql id = "Jurisdiction_sql">
			FROM sys_jurisdiction
			<where>
			     1=1
				<if test="fuzzyQuery!=null">
					AND (jurisdiction_no like '%${fuzzyQuery}%' OR jurisdiction_name like '%${fuzzyQuery}%')
				</if>
			
			</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>
	
   
    <select id="GetJurisdictionCount" parameterType="com.newfiber.api.pc.model.entity.SysJurisdiction" resultType="int">
		SELECT COUNT(DISTINCT serial) total
		<include refid="Jurisdiction_sql"></include>
	</select>
	
	<select id="selectJurisdictionList" parameterType="com.newfiber.api.pc.model.entity.SysJurisdiction" resultMap="sysJur">
		select
	   *
	<include refid="Jurisdiction_sql"></include>
	    order by 
	<include refid="op"></include> 
	<include refid="oc"></include>   
	  
	     limit
	    #{pageNo},
	    #{pageSize}
	</select>
	
	
	<insert id="addJurisdiction" parameterType="com.newfiber.api.pc.model.entity.SysJurisdiction" >
	insert into sys_jurisdiction
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="serial != null" >
        serial,
      </if>
      <if test="jurisdictionNo != null" >
          jurisdiction_no,
      </if>
      <if test="jurisdictionName != null" >
          jurisdiction_name,
      </if>
      
      <if test="jurisdictionType != null" >
          jurisdiction_type,
      </if>
      <if test="jurisdictionTypeZn != null" >
          jurisdiction_type_zn,
      </if>
      <if test="jurisdictionState != null" >
          jurisdiction_state,
      </if>
      <if test="jurisdictionStateZn != null" >
          jurisdiction_state_zn,
      </if>
      <if test="remark != null" >
          remark,
      </if>
      <if test="orderSort != null" >
          order_sort,
      </if>
       <if test="createTime!=null">
           create_time,
      
      </if>
 
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
     <if test="serial != null" >
       #{serial,jdbcType=BIGINT},
      </if>
      <if test="jurisdictionNo != null" >
      #{jurisdictionNo,jdbcType=VARCHAR},
       
      </if>
      <if test="jurisdictionName != null" >
      #{jurisdictionName,jdbcType=VARCHAR},
       
      </if>
      
      <if test="jurisdictionType != null" >
       #{jurisdictionType,jdbcType=INTEGER},
        
      </if>
      
      <if test="jurisdictionTypeZn != null" >
      #{jurisdictionTypeZn,jdbcType=VARCHAR},
      </if>
      <if test="jurisdictionState != null" >
       #{jurisdictionState,jdbcType=INTEGER},
        
      </if>
      <if test="jurisdictionStateZn != null" >
        #{jurisdictionStateZn,jdbcType=VARCHAR},
      </if>
      <if test="remark != null" >
      #{remark,jdbcType=VARCHAR},
     </if>
       <if test="orderSort != null" >
       #{orderSort,jdbcType=INTEGER},
       
      </if>
      <if test="createTime!=null">
       #{createTime,jdbcType=TIMESTAMP},
      
      </if>
    
      
    
     
    </trim>

	</insert>
	
	
	
	
<update id="updateJurisdiction" parameterType="com.newfiber.api.pc.model.entity.SysJurisdiction"  >
    update sys_jurisdiction
    <set > 
      <if test="jurisdictionNo != null" >
          jurisdiction_no=#{jurisdictionNo,jdbcType=VARCHAR},
       
      </if>
      <if test="jurisdictionName != null" >
          jurisdiction_name = #{jurisdictionName,jdbcType=VARCHAR},
       
      </if>
      
      <if test="jurisdictionType != null" >
          jurisdiction_type =#{jurisdictionType,jdbcType=INTEGER},
        
      </if>
      
      <if test="jurisdictionTypeZn != null" >
          jurisdiction_type_zn =#{jurisdictionTypeZn,jdbcType=VARCHAR},
      </if>
      <if test="jurisdictionState != null" >
          jurisdiction_state =#{jurisdictionState,jdbcType=INTEGER},
        
      </if>
      <if test="jurisdictionStateZn != null" >
          jurisdiction_state_zn= #{jurisdictionStateZn,jdbcType=VARCHAR},
      </if>
      <if test="orderSort != null" >

          order_sort =#{orderSort,jdbcType=INTEGER},
       
      </if>
      <if test="remark != null" >
          remark = #{remark,jdbcType=VARCHAR},
      
      </if>
        <if test="updateTime!=null">
            update_time = #{updateTime,jdbcType=TIMESTAMP},
      
      </if>
      
    </set>
    where serial = #{serial,jdbcType=BIGINT}
  </update>
  
  <delete id="deleteJurisdiction" parameterType="java.lang.Long">
  
  delete  from sys_jurisdiction  where serial in
    <foreach collection="list" item="item" close=")" open="(" separator=",">
        #{item}
    </foreach>
  
  </delete>
	


  
  
<!--   <select id="GetRoleJurOnelist"  parameterType="String" resultType="com.newfiber.api.mobile.model.UserManager.Data_Role_Jurisdiction" >
  
  
  
  
    select DISTINCT   sys_role_jurisdiction.Jurisdiction_No from
    sys_user_org  left join sys_role_org on  sys_user_org_Nog_No=sys_role_org_Nog_No
    left  join   sys_role_jurisdiction on    sys_role_jurisdiction.Role_No=sys_role_org.Role_No
    where sys_user_org.User_No=#{User_No}
  </select>
   -->



  
</mapper>