Browse Source

添加节点类型、标签等

master
陈裕财 4 years ago
parent
commit
ae662db702
  1. 88
      xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmMenuMapper.xml

88
xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmMenuMapper.xml

@ -5,16 +5,88 @@
<!--开始 自定sql函数区域 请在此区域添加自定义函数,其它区域尽量不要动,因为代码随时重新生成 -->
<sql id="whereForMap">
<if test=" menuIds != null"> and (res.menu_id) in
<foreach collection="menuIds" item="item" index="index" open="(" separator="," close=")" >
( #{item})
</foreach>
</if>
<if test="key != null and key !='' "> </if>
</sql>
<sql id="whereForMap">
<if test=" menuIds != null"> and (res.menu_id) in
<foreach collection="menuIds" item="item" index="index" open="(" separator="," close=")" >
( #{item})
</foreach>
</if>
<if test=" pidPathsList != null"> and
<foreach collection="pidPathsList" item="item" index="index" open="(" separator=" or " close=")" >
#{item} like concat(res.pid_paths,'%')
</foreach>
</if>
<if test=" tagIdList != null"> and
<foreach collection="tagIdList" item="item" index="index" open="(" separator=" or " close=")" >
find_in_set(#{item},res.tag_ids)
</foreach>
</if>
<if test=' iterationFilterType!=null and iterationFilterType!=""'>
and <if test='iterationFilterType=="not-join"'> not </if>
exists ( select 1 from xm_iteration_menu im where im.menu_id=res.menu_id)
</if>
<if test=' taskFilterType!=null and taskFilterType!="" '>
and <if test='taskFilterType=="not-join"'> not </if>
exists ( select 1 from xm_task t where t.menu_id=res.menu_id)
</if>
<if test="key != null and key !='' "> and res.menu_name like #{key} </if>
<if test="isTop!=null and isTop!=''"> and (res.pmenu_id is null or res.pmenu_id = '')</if>
</sql>
<select id="selectExistIterationMenus" parameterType="HashMap" resultType="com.xm.core.entity.XmMenu">
select * from xm_menu res
where exists (select 1 from xm_iteration_menu im where im.menu_id in
<foreach collection="menuIds" item="item" index="index" open="(" separator="," close=")" >
#{item}
</foreach>
and im.menu_id = res.menu_id )
</select>
<select id="queryTaskUsersByMenuId" parameterType="HashMap" resultType="HashMap">
select distinct te.userid,te.username,t.executor_userid, t.executor_username from xm_task_execuser te inner join xm_task t on t.id=te.task_id
where t.menu_id=#{menuId} and te.status !='8' and te.status !='7'
</select>
<select id="selectListMapByWhereWithState" parameterType="HashMap" resultType="HashMap">
select res.*,s.* from xm_menu res left join xm_menu_state s on res.menu_id=s.menu_id
<where>
<include refid="whereForMap"/>
<include refid="where"/>
</where>
order by res.seq_no asc
</select>
<select id="selectListMapByWhereWithPlan" parameterType="HashMap" resultType="HashMap">
select res.*,plan.* from xm_menu res left join xm_menu_plan plan on res.menu_id=plan.menu_id and plan.project_id=#{projectId}
<where>
<include refid="whereForMap"/>
<include refid="where"/>
</where>
order by res.seq_no asc
</select>
<update id="updateMenuChildrenCntByMenuId" parameterType="String">
UPDATE xm_menu t
LEFT JOIN ( SELECT count( 1 ) AS children_cnt, tt.pmenu_id AS menu_id FROM xm_menu tt WHERE tt.pmenu_id = #{menuId} ) t2 ON t2.menu_id = t.menu_id
SET t.children_cnt = ifnull( t2.children_cnt, 0 )
WHERE
t.menu_id = #{menuId}
</update>
<update id="updateChildrenCntByIds" parameterType="List">
UPDATE xm_menu t
LEFT JOIN ( SELECT count( 1 ) AS children_cnt, tt.pmenu_id AS menu_id FROM xm_menu tt WHERE
(tt.pmenu_id) in
<foreach collection="list" item="item" index="index" open="(" separator="," close=")" >
( #{item})
</foreach>
group by tt.pmenu_id ) t2 ON t2.menu_id = t.menu_id
SET t.children_cnt = ifnull( t2.children_cnt, 0 )
WHERE (t.menu_id) in
<foreach collection="list" item="item" index="index" open="(" separator="," close=")" >
( #{item})
</foreach>
</update>
<!--结束 自定义sql函数区域-->

Loading…
Cancel
Save