Newer
Older
huludao / src / main / resources / mapper / Data_Menu_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.SysMenuJurisdictionDao" >
    <resultMap id="menuMap" type="com.newfiber.api.pc.model.zhz.Menu">
        <id property="serial" column="Serial"/>
        <result property="menuNo" column="Menu_No"/>
        <result property="menuName" column="Menu_Name"/>
        <result property="menuValue" column="Menu_Value"/>
        <result property="menuGrade" column="Menu_Grade"/>
        <result property="menuGradeZn" column="Menu_Grade_ZN"/>
        <result property="parentMenuId" column="Parent_Menu_ID"/>
        <result property="menuState" column="Menu_State"/>
        <result property="menuStateZn" column="Menu_State_ZN"/>
        <result property="menuType" column="Menu_Type"/>
        <result property="menuTypeZn" column="Menu_Type_ZN"/>
        <result property="orderSort" column="OrderSort"/>
        <result property="createTime" column="Create_Time"/>
        <result property="updateTime" column="Update_Time"/>
        <result property="remark" column="Remark"/>
        <result property="jurNo" column="Jurisdiction_No"/>
    </resultMap>
     
               
<sql id = "Menu_Jurisdiction_sql"> 
           FROM sys_menu_jurisdiction  LEFT JOIN  sys_menus ON
           sys_menu_jurisdiction.menu_no=sys_menus.menu_no
			<where>
			     1=1
				<if test="fuzzyQuery!=null">
					AND (menu_no like '%${fuzzyQuery}%')
				</if>
				<if test="jurisdiction_no != null">
				   AND  (sys_menu_jurisdiction.jurisdiction_no like '%${jurisdictionNo}%')
				</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>
		          
   






<sql id = "Menus1_sqlOne">
			FROM sys_menus
			<where>
			     1=1
				<if test="Jurisdiction_No!=null">
					
					 AND sys_menus.menu_no not in (SELECT sys_menu_jurisdiction.menu_no from sys_menu_jurisdiction where sys_menu_jurisdiction.jurisdiction_no like '%${jurisdictionNo}%')
				
				
				</if>
				
			  </where>
		</sql>
   





<delete  id="deleteDataMenuJu" parameterType="com.newfiber.api.pc.model.entity.MenuJurisdiction" >
   delete from sys_menu_jurisdiction
   <where>
       <if test="menuNo != null">
           menu_no = #{menuNo,jdbcType=VARCHAR}
       </if>
       <if test="jurisdictionNo != null">
           AND jurisdiction_no=#{jurisdictionNo,jdbcType=VARCHAR}
       </if>
   </where>
</delete>



  <insert id="addMenu" parameterType="list" >
    insert into sys_menu_jurisdiction
        (menu_no,jurisdiction_no,create_time)
      values
      <foreach collection="list" item="item"  separator=",">
      (
                #{item.menuNo},
                #{item.jurisdictionNo},
                #{item.createTime}
          )
      </foreach>
  </insert>


    <select id="GetMenuJurLast" parameterType="string" resultType="com.newfiber.api.pc.model.entity.MenuJurisdiction">
        select DISTINCT menu_no from sys_menu_jurisdiction a
        where not exists
        (select b.menu_no from sys_menu_jurisdiction b ,sys_menus c where b.menu_no = c.menu_no and c.parent_menu_id = a.menu_no and b.jurisdiction_no = a.jurisdiction_no)
        AND  a.jurisdiction_no = #{jurisdictionNo ,jdbcType=VARCHAR}
    </select>
  
  
  <select id="selectMenusByJurs" resultMap="menuMap" parameterType="string">
        select
        DISTINCT sm.serial,sm.menu_no,sm.menu_name,sm.menu_value,sm.menu_grade,
        sm.menu_grade_zn,sm.parent_menu_id,sm.menu_state,sm.menu_state_zn ,sm.menu_type,sm.menu_type_zn,sm.order_sort,
        sm.create_time,sm.remark,sm.update_time
        FROM
        sys_menu_jurisdiction smj
        LEFT JOIN
        sys_menus sm
        on smj.menu_no = sm.menu_no
        where smj.jurisdiction_no in (${jurs})
  </select>


  
</mapper>