All Downloads are FREE. Search and download functionalities are using the official Maven repository.

mappings.modules.MenuDao.xml Maven / Gradle / Ivy

<?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.yqjr.modules.menu.dao.MenuDao">
  <resultMap id="BaseResultMap" type="com.yqjr.modules.menu.entity.Menu">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Jun 06 09:58:35 CST 2017.
    -->
    <result column="PARENT_ID" jdbcType="VARCHAR" property="parent.id" />
    <result column="PARENT_IDS" jdbcType="VARCHAR" property="parentIds" />
    <result column="NAME" jdbcType="VARCHAR" property="name" />
    <result column="SORT" jdbcType="DECIMAL" property="sort" />
    <result column="URL" jdbcType="VARCHAR" property="url" />
    <result column="ICON" jdbcType="VARCHAR" property="icon" />
    <result column="IS_SHOW" jdbcType="CHAR" property="isShow" />
    <result column="PERMISSION" jdbcType="VARCHAR" property="permission" />
    <result column="CREATEBY" jdbcType="DECIMAL" property="createBy.id" />
    <result column="CREATEDATE" jdbcType="TIMESTAMP" property="createDate" typeHandler="com.yqjr.framework.datatype.DateTypeHandler" />
    <result column="UPDATEBY" jdbcType="DECIMAL" property="updateBy.id" />
    <result column="UPDATEDATE" jdbcType="TIMESTAMP" property="updateDate" typeHandler="com.yqjr.framework.datatype.DateTypeHandler" />
    <result column="REMARKS" jdbcType="VARCHAR" property="remarks" />
    <result column="DELETESTATUS" jdbcType="DECIMAL" property="deleteStatus" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Jun 06 09:58:35 CST 2017.
    -->
    ID, PARENT_ID, PARENT_IDS, NAME, SORT, URL, ICON, IS_SHOW, PERMISSION, CREATEBY, 
    CREATEDATE, UPDATEBY, UPDATEDATE, REMARKS, DELETESTATUS
  </sql>
  <sql id="Base_Where_Condition">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Jun 06 09:58:35 CST 2017.
    -->
    <where>
      <if test="id != null">
        and ID = #{id,jdbcType=DECIMAL}
      </if>
      <if test="parentId != null">
        and PARENT_ID = #{parentId,jdbcType=VARCHAR}
      </if>
      <if test="parentIds != null">
        and PARENT_IDS = #{parentIds,jdbcType=VARCHAR}
      </if>
      <if test="name != null">
        and NAME = #{name,jdbcType=VARCHAR}
      </if>
      <if test="sort != null">
        and SORT = #{sort,jdbcType=DECIMAL}
      </if>
      <if test="url != null">
        and URL = #{url,jdbcType=VARCHAR}
      </if>
      <if test="icon != null">
        and ICON = #{icon,jdbcType=VARCHAR}
      </if>
      <if test="isShow != null">
        and IS_SHOW = #{isShow,jdbcType=CHAR}
      </if>
      <if test="permission != null">
        and PERMISSION = #{permission,jdbcType=VARCHAR}
      </if>
      <if test="createBy != null">
        and CREATEBY = #{createBy.id,jdbcType=DECIMAL}
      </if>
      <if test="createDate != null">
        and CREATEDATE = #{createDate,jdbcType=TIMESTAMP,typeHandler=com.yqjr.framework.datatype.DateTypeHandler}
      </if>
      <if test="updateBy != null">
        and UPDATEBY = #{updateBy.id,jdbcType=DECIMAL}
      </if>
      <if test="updateDate != null">
        and UPDATEDATE = #{updateDate,jdbcType=TIMESTAMP,typeHandler=com.yqjr.framework.datatype.DateTypeHandler}
      </if>
      <if test="remarks != null">
        and REMARKS = #{remarks,jdbcType=VARCHAR}
      </if>
      <if test="deleteStatus != null">
        and DELETESTATUS = #{deleteStatus,jdbcType=DECIMAL}
      </if>
    </where>
  </sql>
  <insert id="insert" parameterType="com.yqjr.modules.menu.entity.Menu">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Jun 06 09:58:35 CST 2017.
    -->
    insert into FMK_MENU
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        ID,
      </if>
      <if test="parentId != null">
        PARENT_ID,
      </if>
      <if test="parentIds != null">
        PARENT_IDS,
      </if>
      <if test="name != null">
        NAME,
      </if>
      <if test="sort != null">
        SORT,
      </if>
      <if test="url != null">
        URL,
      </if>
      <if test="icon != null">
        ICON,
      </if>
      <if test="isShow != null">
        IS_SHOW,
      </if>
      <if test="permission != null">
        PERMISSION,
      </if>
      <if test="createBy != null">
        CREATEBY,
      </if>
      <if test="createDate != null">
        CREATEDATE,
      </if>
      <if test="updateBy != null">
        UPDATEBY,
      </if>
      <if test="updateDate != null">
        UPDATEDATE,
      </if>
      <if test="remarks != null">
        REMARKS,
      </if>
      <if test="deleteStatus != null">
        DELETESTATUS,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=DECIMAL},
      </if>
      <if test="parentId != null">
        #{parentId,jdbcType=VARCHAR},
      </if>
      <if test="parentIds != null">
        #{parentIds,jdbcType=VARCHAR},
      </if>
      <if test="name != null">
        #{name,jdbcType=VARCHAR},
      </if>
      <if test="sort != null">
        #{sort,jdbcType=DECIMAL},
      </if>
      <if test="url != null">
        #{url,jdbcType=VARCHAR},
      </if>
      <if test="icon != null">
        #{icon,jdbcType=VARCHAR},
      </if>
      <if test="isShow != null">
        #{isShow,jdbcType=CHAR},
      </if>
      <if test="permission != null">
        #{permission,jdbcType=VARCHAR},
      </if>
      <if test="createBy != null">
        #{createBy.id,jdbcType=DECIMAL},
      </if>
      <if test="createDate != null">
        #{createDate,jdbcType=TIMESTAMP,typeHandler=com.yqjr.framework.datatype.DateTypeHandler},
      </if>
      <if test="updateBy != null">
        #{updateBy.id,jdbcType=DECIMAL},
      </if>
      <if test="updateDate != null">
        #{updateDate,jdbcType=TIMESTAMP,typeHandler=com.yqjr.framework.datatype.DateTypeHandler},
      </if>
      <if test="remarks != null">
        #{remarks,jdbcType=VARCHAR},
      </if>
      <if test="deleteStatus != null">
        #{deleteStatus,jdbcType=DECIMAL},
      </if>
    </trim>
  </insert>
  <update id="update" parameterType="com.yqjr.modules.menu.entity.Menu">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Jun 06 09:58:35 CST 2017.
    -->
    update FMK_MENU
    <set>
      <if test="parentId != null">
        PARENT_ID = #{parentId,jdbcType=VARCHAR},
      </if>
      <if test="parentIds != null">
        PARENT_IDS = #{parentIds,jdbcType=VARCHAR},
      </if>
      <if test="name != null">
        NAME = #{name,jdbcType=VARCHAR},
      </if>
      <if test="sort != null">
        SORT = #{sort,jdbcType=DECIMAL},
      </if>
      <if test="url != null">
        URL = #{url,jdbcType=VARCHAR},
      </if>
      <if test="icon != null">
        ICON = #{icon,jdbcType=VARCHAR},
      </if>
      <if test="isShow != null">
        IS_SHOW = #{isShow,jdbcType=CHAR},
      </if>
      <if test="permission != null">
        PERMISSION = #{permission,jdbcType=VARCHAR},
      </if>
      <if test="createBy != null">
        CREATEBY = #{createBy.id,jdbcType=DECIMAL},
      </if>
      <if test="createDate != null">
        CREATEDATE = #{createDate,jdbcType=TIMESTAMP,typeHandler=com.yqjr.framework.datatype.DateTypeHandler},
      </if>
      <if test="updateBy != null">
        UPDATEBY = #{updateBy.id,jdbcType=DECIMAL},
      </if>
      <if test="updateDate != null">
        UPDATEDATE = #{updateDate,jdbcType=TIMESTAMP,typeHandler=com.yqjr.framework.datatype.DateTypeHandler},
      </if>
      <if test="remarks != null">
        REMARKS = #{remarks,jdbcType=VARCHAR},
      </if>
      <if test="deleteStatus != null">
        DELETESTATUS = #{deleteStatus,jdbcType=DECIMAL},
      </if>
    </set>
    <where>
      id = #{id}
    </where>
  </update>
  <update id="delete" parameterType="com.yqjr.modules.menu.entity.Menu">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Jun 06 09:58:35 CST 2017.
    -->
    update FMK_MENU
    <set>
      deleteStatus = 0 ,
      <if test="updateBy != null">
        updateBy = #{updateBy.id},
      </if>
      <if test="updateDate != null">
        updateDate = #{updateDate,jdbcType=TIMESTAMP,typeHandler=com.yqjr.framework.datatype.DateTypeHandler}
      </if>
    </set>
    <where>
      id = #{id}
    </where>
  </update>
  <select id="id" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Jun 06 09:58:35 CST 2017.
    -->
    select
    <include refid="Base_Column_List" />
    from FMK_MENU
    <if test="_parameter != null">
      where id = #{id}
    </if>
  </select>
  <select id="get" parameterType="com.yqjr.modules.menu.entity.Menu" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Jun 06 09:58:35 CST 2017.
    -->
    select
    <include refid="Base_Column_List" />
    from FMK_MENU
    <if test="_parameter != null">
      <include refid="Base_Where_Condition" />
    </if>
  </select>
  <select id="findList" parameterType="com.yqjr.modules.menu.entity.Menu" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Jun 06 09:58:35 CST 2017.
    -->
    select
    <include refid="Base_Column_List" />
    from FMK_MENU
    <if test="_parameter != null">
      <include refid="Base_Where_Condition" />
    </if>
  </select>
  <select id="findByCondition" parameterType="com.yqjr.modules.menu.condition.MenuCondition" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Jun 06 09:58:35 CST 2017.
    -->
    select
    <include refid="Base_Column_List" />
    from FMK_MENU
    <if test="_parameter != null">
      <where>
        <if test="parentId != null">
           and PARENT_ID = #{parentId,jdbcType=VARCHAR}
        </if>
        <if test="parentIds != null">
           and PARENT_IDS = #{parentIds,jdbcType=VARCHAR}
        </if>
        <if test="name != null">
           and NAME = #{name,jdbcType=VARCHAR}
        </if>
        <if test="sort != null">
           and SORT = #{sort,jdbcType=DECIMAL}
        </if>
        <if test="url != null">
           and URL = #{url,jdbcType=VARCHAR}
        </if>
        <if test="icon != null">
           and ICON = #{icon,jdbcType=VARCHAR}
        </if>
        <if test="isShow != null">
           and IS_SHOW = #{isShow,jdbcType=CHAR}
        </if>
        <if test="permission != null">
           and PERMISSION = #{permission,jdbcType=VARCHAR}
        </if>
        <if test="deleteStatus != null">
           and DELETESTATUS = #{deleteStatus,jdbcType=DECIMAL}
        </if>
        <if test="startDate != null">
          <![CDATA[  and updateDate >= TO_DATE(#{startDate},'yyyy-mm-dd') ]]> 
        </if>
        <if test="endDate != null">
          <![CDATA[  and updateDate < TO_DATE(#{endDate},'yyyy-mm-dd')+1 ]]> 
        </if>
        <if test="userId &gt; 0">
          and createBy = #{userId}
        </if>
      </where>
    </if>
  </select>
  
  <select id="findByRole" resultMap="BaseResultMap">
	SELECT DISTINCT
		 <include refid="Base_Column_List" />
   	from FMK_MENU m
	<if test="id != null and id != ''">
		LEFT JOIN fmk_role_menu rm ON rm.menu_id = m.id 
	</if>
	WHERE m.DELETESTATUS = #{deleteStatus,jdbcType=DECIMAL} AND rm.role_id = #{id}
  </select>
  <select id="findByUser" resultMap="BaseResultMap">
	SELECT DISTINCT
		 m.ID, m.PARENT_ID, m.PARENT_IDS, m.NAME, m.SORT, m.URL, m.ICON, m.IS_SHOW, m.PERMISSION, m.CREATEBY, 
    	m.CREATEDATE, m.UPDATEBY, m.UPDATEDATE, m.REMARKS, m.DELETESTATUS
   	from FMK_MENU m,FMK_ROLE_USER ru,FMK_ROLE_MENU rm 
	WHERE m.id = rm.menu_id  and ru.role_id = rm.role_id and ru.user_id = #{id} <![CDATA[   and m.ID <> 1 ]]> and m.DELETESTATUS = 1 and m.is_show = 1 order by m.sort
  </select>
  <select id="findForTree" resultType="java.util.HashMap">
	SELECT t1.id,
	       t1.name,
	       t1.PARENT_ID,
	       t1.parent_ids,
	       (SELECT count(t2.id) count FROM FMK_MENU t2 WHERE t2.parent_id = t1.id and t2.deleteStatus = 1 ) counts
	FROM FMK_MENU t1 
	WHERE 
		t1.parent_id = #{parentId} and t1.deleteStatus = 1 
	ORDER BY t1.sort 
  </select>
  <select id="findByParentIdsLike" resultMap="BaseResultMap">
		SELECT
			a.id,
			a.parent_id AS "parent.id",
			a.parent_ids
		FROM FMK_MENU a
		WHERE a.parent_ids LIKE #{parentIds}
		ORDER BY a.sort
	</select>
  <update id="updateParentIds">
		UPDATE FMK_MENU SET 
			parent_id = #{parent.id}, 
			parent_ids = #{parentIds}
		WHERE id = #{id}
  </update>
</mapper>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy