修改以前的垃圾代码
This commit is contained in:
@@ -1,239 +0,0 @@
|
||||
<?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.adc.da.log.dao.mysql.LogEODao">
|
||||
<!-- Result Map-->
|
||||
<resultMap id="BaseResultMap" type="com.adc.da.log.entity.LogEO">
|
||||
<id column="id" property="id"/>
|
||||
<result column="ip_address" property="ipAddress"/>
|
||||
<result column="browser" property="browser"/>
|
||||
<result column="start_time" property="startTime"/>
|
||||
<result column="end_time" property="endTime"/>
|
||||
<result column="usid" property="usid"/>
|
||||
<result column="operate_time" property="operateTime"/>
|
||||
<result column="method" property="method"/>
|
||||
<result column="description" property="description"/>
|
||||
<result column="class_name" property="className"/>
|
||||
<result column="account" property="account"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- TS_LOG table all fields -->
|
||||
<sql id="Base_Column_List">
|
||||
distinct ip_address, browser, start_time, end_time, usid, operate_time, method, description, class_name, account
|
||||
</sql>
|
||||
|
||||
<!-- 查询条件 -->
|
||||
<sql id="Base_Where_Clause">
|
||||
where 1=1
|
||||
<trim suffixOverrides=",">
|
||||
<if test="ipAddress != null">
|
||||
and ip_address ${ipAddressOperator} #{ipAddress}
|
||||
</if>
|
||||
<if test="browser != null">
|
||||
and browser ${browserOperator} #{browser}
|
||||
</if>
|
||||
<if test="startTime1 != null && startTime1 !=''">
|
||||
and start_time >= to_date(#{startTime1},'yyyy-mm-dd hh24:mi:ss')
|
||||
</if>
|
||||
<if test="startTime2 != null && startTime2 !=''">
|
||||
and start_time <= to_date(#{startTime2},'yyyy-mm-dd hh24:mi:ss')+1
|
||||
</if>
|
||||
<if test="usid != null">
|
||||
and usid ${usidOperator} #{usid}
|
||||
</if>
|
||||
<if test="operateTime != null">
|
||||
and operate_time ${operateTimeOperator} #{operateTime}
|
||||
</if>
|
||||
<if test="operateTime1 != null">
|
||||
and operate_time >= #{operateTime1}
|
||||
</if>
|
||||
<if test="operateTime2 != null">
|
||||
and operate_time <= #{operateTime2}
|
||||
</if>
|
||||
<if test="method != null">
|
||||
and method ${methodOperator} #{method}
|
||||
</if>
|
||||
<if test="description != null">
|
||||
and description ${descriptionOperator} #{description}
|
||||
</if>
|
||||
<if test="className != null">
|
||||
and class_name ${classNameOperator} #{className}
|
||||
</if>
|
||||
<if test="account != null">
|
||||
and account ${accountOperator} '%${account}%'
|
||||
</if>
|
||||
<if test="id != null">
|
||||
and id ${idOperator} #{id}
|
||||
</if>
|
||||
</trim>
|
||||
</sql>
|
||||
|
||||
<!-- 插入记录 -->
|
||||
<insert id="insert" parameterType="com.adc.da.log.entity.LogEO">
|
||||
<!-- <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
|
||||
SELECT SEQ_TS_LOG.NEXTVAL FROM DUAL
|
||||
</selectKey> -->
|
||||
insert into TS_LOG(<include refid="Base_Column_List"/>)
|
||||
values (#{ipAddress}, #{browser}, #{startTime}, #{endTime}, #{usid}, #{operateTime}, #{method}, #{description},
|
||||
#{className}, #{account},
|
||||
#{id})
|
||||
</insert>
|
||||
<insert id="save" parameterType="com.adc.da.log.entity.MiLogEO">
|
||||
insert into ts_mi_log
|
||||
(id
|
||||
,account
|
||||
,user_name
|
||||
,access_page
|
||||
,department
|
||||
,oparate_date)
|
||||
values(
|
||||
#{id}
|
||||
,#{account}
|
||||
,#{userName}
|
||||
,#{accessPage}
|
||||
,#{department}
|
||||
,#{operateDate})
|
||||
|
||||
|
||||
|
||||
</insert>
|
||||
|
||||
<!-- 动态插入记录 主键是序列 -->
|
||||
<update id="insertSelective" parameterType="com.adc.da.log.entity.LogEO">
|
||||
merge into TS_LOG a
|
||||
using (
|
||||
select
|
||||
#{ipAddress} as ipAddress,
|
||||
#{startTime} as startTime,
|
||||
#{endTime} as endTime,
|
||||
#{usid} as usid,
|
||||
#{method} as method,
|
||||
#{description} as description,
|
||||
#{className} as className,
|
||||
#{account} as account,
|
||||
#{id} as id
|
||||
from dual )b
|
||||
on (a.ip_address = b.ipAddress
|
||||
<!-- and a.start_time = b.startTime-->
|
||||
and
|
||||
(to_date(to_char(b.startTime,'yyyy-mm-dd hh24-mi-ss'), 'yyyy-mm-dd hh24-mi-ss')-to_date( to_char(a.START_TIME,'yyyy-mm-dd hh24-mi-ss'),'yyyy-mm-dd hh24-mi-ss') )*24*60*60
|
||||
<='2'
|
||||
and a.usid = b.usid
|
||||
and a.method = b.method
|
||||
and a.description = b.description
|
||||
and a.class_name = b.className
|
||||
and a.account = b.account)
|
||||
|
||||
when not matched then
|
||||
insert (ip_address,start_time,end_time,usid,method,description,class_name,account,id)
|
||||
values (b.ipAddress,b.startTime,b.endTime,b.usid,b.method,b.description,b.className,b.account,b.id)
|
||||
</update>
|
||||
|
||||
<!-- 根据pk,修改记录-->
|
||||
<update id="updateByPrimaryKey" parameterType="com.adc.da.log.entity.LogEO">
|
||||
update TS_LOG
|
||||
set ip_address = #{ipAddress},
|
||||
browser = #{browser},
|
||||
start_time = #{startTime},
|
||||
end_time = #{endTime},
|
||||
usid = #{usid},
|
||||
operate_time = #{operateTime},
|
||||
method = #{method},
|
||||
description = #{description},
|
||||
class_name = #{className},
|
||||
account = #{account}
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 修改记录,只修改只不为空的字段 -->
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.adc.da.log.entity.LogEO">
|
||||
update TS_LOG
|
||||
<set>
|
||||
<if test="ipAddress != null">
|
||||
ip_address = #{ipAddress},
|
||||
</if>
|
||||
<if test="browser != null">
|
||||
browser = #{browser},
|
||||
</if>
|
||||
<if test="startTime != null">
|
||||
start_time = #{startTime},
|
||||
</if>
|
||||
<if test="endTime != null">
|
||||
end_time = #{endTime},
|
||||
</if>
|
||||
<if test="usid != null">
|
||||
usid = #{usid},
|
||||
</if>
|
||||
<if test="operateTime != null">
|
||||
operate_time = #{operateTime},
|
||||
</if>
|
||||
<if test="method != null">
|
||||
method = #{method},
|
||||
</if>
|
||||
<if test="description != null">
|
||||
description = #{description},
|
||||
</if>
|
||||
<if test="className != null">
|
||||
class_name = #{className},
|
||||
</if>
|
||||
<if test="account != null">
|
||||
account = #{account},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 根据id查询 TS_LOG -->
|
||||
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from TS_LOG
|
||||
where id = #{value}
|
||||
|
||||
</select>
|
||||
|
||||
<!-- 删除记录 -->
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
|
||||
delete from TS_LOG
|
||||
where id = #{value}
|
||||
</delete>
|
||||
|
||||
<!-- TS_LOG 列表总数-->
|
||||
<select id="queryByCount" resultType="java.lang.Integer" parameterType="com.adc.da.base.page.BasePage">
|
||||
select count(1) from (
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from TS_LOG
|
||||
<include refid="Base_Where_Clause"/>
|
||||
)
|
||||
</select>
|
||||
|
||||
<!-- 查询TS_LOG列表 -->
|
||||
<select id="queryByPage" resultMap="BaseResultMap" parameterType="com.adc.da.base.page.BasePage">
|
||||
select
|
||||
*
|
||||
from
|
||||
(select tmp_tb.* , rownum rn from
|
||||
(select
|
||||
<include refid="Base_Column_List"/>
|
||||
from TS_LOG
|
||||
<include refid="Base_Where_Clause"/>
|
||||
order by start_time desc
|
||||
) tmp_tb where rownum <= ${pager.endIndex})
|
||||
where rn >= ${pager.startIndex}
|
||||
</select>
|
||||
<!--mysql date 2019-01-18-->
|
||||
<!--@author Lee Kwanho 李坤澔-->
|
||||
<!-- 查询TS_LOG列表 -->
|
||||
|
||||
|
||||
<select id="queryByList" resultMap="BaseResultMap" parameterType="com.adc.da.base.page.BasePage">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from TS_LOG
|
||||
<include refid="Base_Where_Clause"/>
|
||||
<if test="pager.orderCondition != null and pager.orderCondition != ''">
|
||||
${pager.orderCondition}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -1,315 +0,0 @@
|
||||
<?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.adc.da.sys.dao.mysql.MenuEODao">
|
||||
<!-- Result Map-->
|
||||
<resultMap id="BaseResultMap" type="com.adc.da.sys.entity.MenuEO">
|
||||
<id column="id" property="id"/>
|
||||
<result column="del_flag" property="delFlag"/>
|
||||
<result column="name" property="name"/>
|
||||
<result column="parent_id" property="parentId"/>
|
||||
<result column="parent_ids" property="parentIds"/>
|
||||
<result column="href" property="href"/>
|
||||
<result column="icon" property="icon"/>
|
||||
<result column="iconHref" property="iconHref"/>
|
||||
<result column="iconClick" property="iconClick"/>
|
||||
<result column="iconClickHref" property="iconClickHref"/>
|
||||
<result column="is_show" property="isShow"/>
|
||||
<result column="permission" property="permission"/>
|
||||
<result column="remarks" property="remarks"/>
|
||||
<result column="sort" property="sort"/>
|
||||
<result column="ext_info" property="extInfo" />
|
||||
</resultMap>
|
||||
|
||||
<!-- TS_MENU table all fields -->
|
||||
<sql id="Base_Column_List">
|
||||
id, del_flag, name, parent_id, parent_ids, href, icon,iconHref,iconClick,iconClickHref, is_show, permission, remarks, sort, ext_info,is_url
|
||||
</sql>
|
||||
|
||||
<!-- 用于按名称查询记录时的sql,添加前缀TS_MENU -->
|
||||
<!-- 2018-08-22 -->
|
||||
<sql id="Base_Column_List_V2">
|
||||
TS_MENU.id, TS_MENU.del_flag, TS_MENU.name, TS_MENU.parent_id, TS_MENU.parent_ids, TS_MENU.href, TS_MENU.icon, TS_MENU.is_show, TS_MENU.permission, TS_MENU.remarks, TS_MENU.sort, TS_MENU.ext_info
|
||||
</sql>
|
||||
<!-- 查询条件 -->
|
||||
<sql id="Base_Where_Clause">
|
||||
where 1=1
|
||||
<trim suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
and id ${idOperator} #{id}
|
||||
</if>
|
||||
<if test="delFlag != null">
|
||||
and del_flag ${delFlagOperator} #{delFlag}
|
||||
</if>
|
||||
<if test="name != null">
|
||||
and name ${nameOperator} #{name}
|
||||
</if>
|
||||
<if test="parentId != null">
|
||||
and parent_id ${parentIdOperator} #{parentId}
|
||||
</if>
|
||||
<if test="parentIds != null">
|
||||
and parent_ids ${parentIdsOperator} #{parentIds}
|
||||
</if>
|
||||
<if test="href != null">
|
||||
and href ${hrefOperator} #{href}
|
||||
</if>
|
||||
<if test="icon != null">
|
||||
and icon ${iconOperator} #{icon}
|
||||
</if>
|
||||
<if test="isShow != null">
|
||||
and is_show ${isShowOperator} #{isShow}
|
||||
</if>
|
||||
<if test="permission != null">
|
||||
and permission ${permissionOperator} #{permission}
|
||||
</if>
|
||||
<if test="remarks != null">
|
||||
and remarks ${remarksOperator} #{remarks}
|
||||
</if>
|
||||
<if test="sort != null">
|
||||
and sort ${sortOperator} #{sort}
|
||||
</if>
|
||||
</trim>
|
||||
</sql>
|
||||
|
||||
<!-- 插入记录 -->
|
||||
<insert id="insert" parameterType="com.adc.da.sys.entity.MenuEO">
|
||||
insert into TS_MENU(<include refid="Base_Column_List"/>)
|
||||
values (#{id}, #{delFlag}, #{name}, #{parentId}, #{parentIds}, #{href}, #{icon},
|
||||
#{iconHref},#{iconClick},#{iconClickHref},#{isShow}, #{permission}, #{remarks}, #{sort}, #{extInfo})
|
||||
</insert>
|
||||
|
||||
<!-- 动态插入记录 主键是序列 -->
|
||||
<insert id="insertSelective" parameterType="com.adc.da.sys.entity.MenuEO" >
|
||||
insert into TS_MENU
|
||||
<trim prefix="(" suffix=")" suffixOverrides="," >
|
||||
<if test="extInfo != null" >ext_info,</if>
|
||||
<if test="sort != null" >sort,</if>
|
||||
<if test="remarks != null" >remarks,</if>
|
||||
<if test="permission != null" >permission,</if>
|
||||
<if test="isShow != null" >is_show,</if>
|
||||
<if test="icon != null" >icon,</if>
|
||||
<if test="iconHref != null" >iconHref,</if>
|
||||
<if test="iconClick != null" >iconClick,</if>
|
||||
<if test="iconClickHref != null" >iconClickHref,</if>
|
||||
<if test="href != null" >href,</if>
|
||||
<if test="parentIds != null" >parent_ids,</if>
|
||||
<if test="parentId != null" >parent_id,</if>
|
||||
<if test="name != null" >name,</if>
|
||||
<if test="delFlag != null" >del_flag,</if>
|
||||
<if test="id != null" >id,</if>
|
||||
<if test="isUrl != null" >is_url,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides="," >
|
||||
<if test="extInfo != null" >#{extInfo},</if>
|
||||
<if test="sort != null" >#{sort},</if>
|
||||
<if test="remarks != null" >#{remarks},</if>
|
||||
<if test="permission != null" >#{permission},</if>
|
||||
<if test="isShow != null" >#{isShow},</if>
|
||||
<if test="icon != null" >#{icon},</if>
|
||||
<if test="iconHref != null" >#{iconHref},</if>
|
||||
<if test="iconClick != null" >#{iconClick},</if>
|
||||
<if test="iconClickHref != null" >#{iconClickHref},</if>
|
||||
<if test="href != null" >#{href},</if>
|
||||
<if test="parentIds != null" >#{parentIds},</if>
|
||||
<if test="parentId != null" >#{parentId},</if>
|
||||
<if test="name != null" >#{name},</if>
|
||||
<if test="delFlag != null" >#{delFlag},</if>
|
||||
<if test="id != null" >#{id},</if>
|
||||
<if test="isUrl != null" >#{isUrl},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
||||
<!-- 根据pk,修改记录-->
|
||||
<update id="updateByPrimaryKey" parameterType="com.adc.da.sys.entity.MenuEO">
|
||||
UPDATE TS_MENU
|
||||
SET del_flag = #{delFlag},
|
||||
NAME = #{name},
|
||||
parent_id = #{parentId},
|
||||
parent_ids = #{parentIds},
|
||||
href = #{href},
|
||||
icon = #{icon},
|
||||
iconHref = #{iconHref},
|
||||
iconClick = #{iconClick},
|
||||
iconClickHref = #{iconClickHref},
|
||||
is_show = #{isShow},
|
||||
PERMISSION = #{permission},
|
||||
remarks = #{remarks},
|
||||
SORT = #{sort}
|
||||
WHERE ID = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 修改记录,只修改只不为空的字段 -->
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.adc.da.sys.entity.MenuEO">
|
||||
update TS_MENU
|
||||
<set>
|
||||
<if test="extInfo != null" >
|
||||
ext_info = #{extInfo},
|
||||
</if>
|
||||
<if test="delFlag != null">
|
||||
del_flag = #{delFlag},
|
||||
</if>
|
||||
<if test="name != null">
|
||||
name = #{name},
|
||||
</if>
|
||||
<if test="parentId != null">
|
||||
parent_id = #{parentId},
|
||||
</if>
|
||||
<if test="parentIds != null">
|
||||
parent_ids = #{parentIds},
|
||||
</if>
|
||||
<if test="href != null">
|
||||
href = #{href},
|
||||
</if>
|
||||
<if test="icon != null">
|
||||
icon = #{icon},
|
||||
</if>
|
||||
<if test="iconHref != null">
|
||||
iconHref = #{iconHref},
|
||||
</if>
|
||||
<if test="iconClick != null">
|
||||
iconClick = #{iconClick},
|
||||
</if>
|
||||
<if test="iconClickHref != null">
|
||||
iconClickHref = #{iconClickHref},
|
||||
</if>
|
||||
<if test="isShow != null">
|
||||
is_show = #{isShow},
|
||||
</if>
|
||||
<if test="permission != null">
|
||||
permission = #{permission},
|
||||
</if>
|
||||
<if test="remarks != null">
|
||||
remarks = #{remarks},
|
||||
</if>
|
||||
<if test="sort != null">
|
||||
sort = #{sort},
|
||||
</if>
|
||||
<if test="isUrl != null">
|
||||
is_url = #{isUrl},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<!--删除菜单
|
||||
逻辑删除-->
|
||||
<update id="deleteMenuLogic">
|
||||
UPDATE TS_MENU set DEL_FLAG = ${@com.adc.da.util.constant.DeleteFlagEnum@DELETE.getValue()}
|
||||
WHERE id in
|
||||
<foreach collection="array" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<update id="deleteMenuByParentId" parameterType="string">
|
||||
UPDATE TS_MENU set DEL_FLAG = '1'
|
||||
WHERE PARENT_ID=#{pId}
|
||||
</update>
|
||||
|
||||
|
||||
<!-- 根据id查询 TS_MENU -->
|
||||
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from TS_MENU
|
||||
where id = #{value} and del_flag = ${@com.adc.da.util.constant.DeleteFlagEnum@NORMAL.getValue()}
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
<!--删除角色菜单信息-->
|
||||
<delete id="deleteRoleMenus">
|
||||
DELETE FROM TR_ROLE_MENU where MENU_ID in
|
||||
<foreach collection="array" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
or MENU_ID in (
|
||||
select ID from TS_MENU where
|
||||
<foreach collection="array" item="id" open="" separator="or" close="">
|
||||
PARENT_IDS like "%"#{id}"%"
|
||||
</foreach>
|
||||
)
|
||||
</delete>
|
||||
|
||||
<!-- TS_MENU 列表总数-->
|
||||
<select id="queryByCount" resultType="java.lang.Integer" parameterType="com.adc.da.base.page.BasePage">
|
||||
select count(1) from TS_MENU
|
||||
<include refid="Base_Where_Clause"/>
|
||||
</select>
|
||||
|
||||
<!-- 查询TS_MENU列表 -->
|
||||
<select id="queryByList" resultMap="BaseResultMap" parameterType="com.adc.da.base.page.BasePage">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from (select t.*,rownum rownu from TS_MENU t
|
||||
where rownum<=${pager.endIndex})tt
|
||||
where tt.rownu>=${pager.startIndex}
|
||||
</select>
|
||||
|
||||
<!--查询所有菜单记录-->
|
||||
<select id="findAll" resultMap="BaseResultMap" flushCache="true" useCache="false">
|
||||
SELECT
|
||||
<include refid="Base_Column_List"/>
|
||||
FROM TS_MENU
|
||||
WHERE del_flag ='0'
|
||||
</select>
|
||||
<!-- -->
|
||||
<select id="listMenuEOByUserId" resultMap="BaseResultMap">
|
||||
SELECT distinct
|
||||
<include refid="Base_Column_List"/>
|
||||
FROM TS_MENU M
|
||||
LEFT JOIN TR_ROLE_MENU RM ON RM.MENU_ID = M.ID
|
||||
LEFT JOIN TR_USER_ROLE UR ON UR.ROLE_ID = RM.ROLE_ID
|
||||
WHERE UR.USER_ID = #{userId}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getChildMenus" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List"/>
|
||||
FROM TS_MENU
|
||||
WHERE PARENT_IDS like "%"#{parentId}"%"
|
||||
</select>
|
||||
|
||||
<select id="isBelong" resultType="integer">
|
||||
SELECT count(1) from TR_ROLE_MENU where ROLE_ID = #{roleId} and MENU_ID = #{menuId}
|
||||
</select>
|
||||
|
||||
<select id="queryAllRoleMenu" resultType="integer">
|
||||
SELECT count(1) from TR_ROLE_MENU where ROLE_ID = #{roleId} and MENU_ID = #{menuId}
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<select id="listMenuEOByRoleID" resultType="com.adc.da.sys.entity.MenuEO">
|
||||
SELECT <include refid="Base_Column_List"/> FROM TS_MENU M LEFT JOIN TR_ROLE_MENU RM ON M.ID = RM.MENU_ID where RM.ROLE_ID = #{roleId}
|
||||
</select>
|
||||
|
||||
<select id="queryConflict" resultType="java.lang.Integer">
|
||||
select count(1) from TS_MENU
|
||||
where name = #{name} and parent_id = #{parentId} and id != #{id} and del_flag='0'
|
||||
|
||||
</select>
|
||||
|
||||
<select id="listMenuEOByMenuIds" resultMap="BaseResultMap">
|
||||
SELECT distinct
|
||||
<include refid="Base_Column_List"/>
|
||||
FROM TS_MENU M
|
||||
LEFT JOIN TR_ROLE_MENU RM ON RM.MENU_ID = M.ID
|
||||
LEFT JOIN TR_USER_ROLE UR ON UR.ROLE_ID = RM.ROLE_ID
|
||||
WHERE M.ID in
|
||||
<foreach item="id" collection="ids" open="(" separator=","
|
||||
close=")" index="index">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="listMenuEOByRoleId" resultMap="BaseResultMap">
|
||||
SELECT distinct
|
||||
<include refid="Base_Column_List"/>
|
||||
FROM TS_MENU M
|
||||
LEFT JOIN TR_ROLE_MENU RM ON RM.MENU_ID = M.ID
|
||||
WHERE RM.ROLE_ID = #{roleId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -1,321 +0,0 @@
|
||||
<?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.adc.da.sys.dao.mysql.RoleEODao">
|
||||
<!-- Result Map -->
|
||||
<resultMap id="BaseResultMap" type="com.adc.da.sys.entity.RoleEO">
|
||||
<id column="id" property="id" />
|
||||
<result column="data_scope" property="dataScope" />
|
||||
<result column="del_flag" property="delFlag" />
|
||||
<result column="is_default" property="isDefault" />
|
||||
<result column="name" property="name" />
|
||||
<result column="remarks" property="remarks" />
|
||||
<result column="ext_info" property="extInfo" />
|
||||
<result column="extInfo2" property="extInfo2"/>
|
||||
<result column="extInfo3" property="extInfo3"/>
|
||||
<result column="extInfo4" property="extInfo4"/>
|
||||
<result column="extInfo5" property="extInfo5"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="RoleMenuMap" extends="BaseResultMap" type="com.adc.da.sys.entity.RoleEO">
|
||||
<collection property="menuEOList" ofType="com.adc.da.sys.entity.MenuEO">
|
||||
<id column="m_id" property="id" />
|
||||
<result column="m_delFlag" property="delFlag" />
|
||||
<result column="m_name" property="name" />
|
||||
<result column="m_parentId" property="parentId" />
|
||||
<result column="m_parentIds" property="parentIds" />
|
||||
<result column="m_href" property="href" />
|
||||
<result column="m_icon" property="icon" />
|
||||
<result column="m_isShow" property="isShow" />
|
||||
<result column="m_permission" property="permission" />
|
||||
<result column="m_remarks" property="remarks" />
|
||||
<result column="m_sort" property="sort" />
|
||||
<result column="m_extInfo" property="extInfo" />
|
||||
</collection>
|
||||
</resultMap>
|
||||
|
||||
<!-- TS_ROLE table all fields -->
|
||||
<sql id="Base_Column_List">
|
||||
id, data_scope, del_flag, is_default, name, remarks, ext_info, extInfo2, extInfo3, extInfo4, extInfo5
|
||||
</sql>
|
||||
|
||||
<sql id="Role_Menu_List">
|
||||
r.*, m.id as m_id,
|
||||
m.del_flag as m_delFlag,
|
||||
m.name as m_name,
|
||||
m.parent_id as m_parentId,
|
||||
m.parent_ids as m_parentIds,
|
||||
m.href as m_href,
|
||||
m.icon as m_icon,
|
||||
m.is_show as m_isShow,
|
||||
m.permission as m_permission,
|
||||
m.remarks as m_remarks,
|
||||
m.sort as m_sort,
|
||||
m.ext_info as m_extInfo
|
||||
</sql>
|
||||
|
||||
<!-- 查询条件 -->
|
||||
<sql id="Base_Where_Clause">
|
||||
where 1=1
|
||||
<trim suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
and id ${idOperator} #{id}
|
||||
</if>
|
||||
<if test="dataScope != null">
|
||||
and data_scope ${dataScopeOperator} #{dataScope}
|
||||
</if>
|
||||
<if test="delFlag != null">
|
||||
and del_flag ${delFlagOperator} #{delFlag}
|
||||
</if>
|
||||
<if test="isDefault != null">
|
||||
and is_default ${isDefaultOperator} #{isDefault}
|
||||
</if>
|
||||
<if test="name != null">
|
||||
and name ${nameOperator} #{name}
|
||||
</if>
|
||||
<if test="remarks != null">
|
||||
and remarks ${remarksOperator} #{remarks}
|
||||
</if>
|
||||
</trim>
|
||||
</sql>
|
||||
|
||||
<update id="save" parameterType="com.adc.da.sys.entity.RoleEO">
|
||||
<selectKey resultType="java.lang.String" keyProperty="usid"
|
||||
order="BEFORE">
|
||||
select SEQ_TS_ROLE.nextval as idfrom dual
|
||||
</selectKey>
|
||||
update TS_ROLE
|
||||
set `del_flag`= 0
|
||||
where `id` = #{id}
|
||||
</update>
|
||||
|
||||
<select id="getRoleWithMenus" resultMap="RoleMenuMap" parameterType="java.lang.String">
|
||||
select <include refid="Role_Menu_List" />
|
||||
from TS_ROLE r
|
||||
left join TR_ROLE_MENU rm on r.id = rm.role_id
|
||||
left join TS_MENU m on rm.menu_id = m.id
|
||||
where r.id = #{id}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getRoleByCode" resultMap="BaseResultMap" parameterType="java.lang.String">
|
||||
select <include refid="Base_Column_List" />
|
||||
from TS_ROLE
|
||||
where ext_info = #{roleCode}
|
||||
</select>
|
||||
|
||||
<select id="getRoleListByUserId" resultMap="BaseResultMap"
|
||||
parameterType="java.lang.String">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from TS_ROLE r, TR_USER_ROLE ur
|
||||
where r.id = ur.ROLE_ID and ur.USER_ID = #{userId}
|
||||
</select>
|
||||
|
||||
<update id="deleteLogic" parameterType="java.lang.String">
|
||||
update TS_ROLE
|
||||
set del_Flag = 1
|
||||
where id = #{roleId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteRoleMenuByRoleId" parameterType="java.lang.String">
|
||||
delete from TR_ROLE_MENU
|
||||
where ROLE_ID = #{roleId}
|
||||
</delete>
|
||||
|
||||
<resultMap id="UserRoleMap" type="com.adc.da.sys.entity.UserRoleEO">
|
||||
<result column="user_id" property="userId" />
|
||||
<result column="role_id" property="roleId" />
|
||||
</resultMap>
|
||||
<select id="getUserRoleListByRoleId" resultMap="UserRoleMap" parameterType="java.lang.String">
|
||||
select * from TR_USER_ROLE
|
||||
where ROLE_ID = #{roleId}
|
||||
</select>
|
||||
|
||||
<select id="getUserInfoListByRoleId" resultType="com.adc.da.sys.vo.UserRoleVO" parameterType="java.lang.String">
|
||||
SELECT * FROM
|
||||
( SELECT * FROM TR_USER_ROLE WHERE ROLE_ID = #{roleId} ) tr
|
||||
LEFT JOIN ts_user tu ON tu.USID = tr.user_id WHERE DEL_FLAG=0
|
||||
</select>
|
||||
|
||||
<select id="getUserInfoPageByRoleId" resultType="com.adc.da.sys.vo.UserRoleVO" >
|
||||
SELECT * FROM
|
||||
( SELECT * FROM TR_USER_ROLE WHERE ROLE_ID = #{roleId} ) tr
|
||||
LEFT JOIN ts_user tu ON tu.USID = tr.user_id WHERE DEL_FLAG=0
|
||||
order by tu.update_time desc
|
||||
</select>
|
||||
|
||||
<select id="getUserCountByRoleId" resultType="java.lang.Long" parameterType="java.lang.String">
|
||||
SELECT count(*) FROM
|
||||
( SELECT * FROM TR_USER_ROLE WHERE ROLE_ID = #{roleId} ) tr
|
||||
LEFT JOIN ts_user tu ON tu.USID = tr.user_id WHERE DEL_FLAG=0
|
||||
</select>
|
||||
|
||||
|
||||
<select id="findAll" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from TS_ROLE
|
||||
where del_flag = 0
|
||||
</select>
|
||||
|
||||
<select id="getMenuIdListByRoleId" resultType="java.lang.String" parameterType="java.lang.String">
|
||||
select menu_id
|
||||
from TS_ROLE_MENU rm
|
||||
where rm.role_id = #{roleId}
|
||||
</select>
|
||||
|
||||
<insert id="saveRoleMenu">
|
||||
insert into TR_ROLE_MENU(ROLE_ID,MENU_ID) values (#{roleId}, #{menuId})
|
||||
</insert>
|
||||
|
||||
<update id="deleteRoleMenu">
|
||||
delete from TR_ROLE_MENU
|
||||
where role_id = #{roleId} and menu_id=#{menuId}
|
||||
</update>
|
||||
|
||||
<select id="isBelong" resultType="integer">
|
||||
select count(1)
|
||||
from TR_USER_ROLE
|
||||
where user_id = #{userId} and role_id =#{roleId}
|
||||
</select>
|
||||
|
||||
<!-- 动态插入记录 主键是序列 -->
|
||||
<insert id="insertSelective" parameterType="com.adc.da.sys.entity.RoleEO" >
|
||||
insert into TS_ROLE
|
||||
<trim prefix="(" suffix=")" suffixOverrides="," >
|
||||
<if test="isDefault != null" >is_default,</if>
|
||||
<if test="delFlag != null" >del_flag,</if>
|
||||
<if test="dataScope != null" >data_scope,</if>
|
||||
<if test="id != null" >id,</if>
|
||||
<if test="extInfo != null" >ext_info,</if>
|
||||
<if test="remarks != null" >remarks,</if>
|
||||
<if test="name != null" >name,</if>
|
||||
<if test="extInfo2 != null">extInfo2,</if>
|
||||
<if test="extInfo3 != null">extInfo3,</if>
|
||||
<if test="extInfo4 != null">extInfo4,</if>
|
||||
<if test="extInfo5 != null">extInfo5</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides="," >
|
||||
<if test="isDefault != null" >#{isDefault},</if>
|
||||
<if test="delFlag != null" >#{delFlag},</if>
|
||||
<if test="dataScope != null" >#{dataScope},</if>
|
||||
<if test="id != null" >#{id},</if>
|
||||
<if test="extInfo != null" >#{extInfo},</if>
|
||||
<if test="remarks != null" >#{remarks},</if>
|
||||
<if test="name != null" >#{name},</if>
|
||||
<if test="extInfo2 != null">#{extInfo2},</if>
|
||||
<if test="extInfo3 != null">#{extInfo3},</if>
|
||||
<if test="extInfo4 != null">#{extInfo4},</if>
|
||||
<if test="extInfo5 != null">#{extInfo5}</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<!-- 插入记录 -->
|
||||
<insert id="insert" parameterType="com.adc.da.sys.entity.RoleEO">
|
||||
insert into TS_ROLE(
|
||||
<include refid="Base_Column_List" />
|
||||
)
|
||||
values (#{id}, #{dataScope}, #{delFlag}, #{isDefault}, #{name}, #{remarks}, #{extInfo})
|
||||
</insert>
|
||||
|
||||
<!-- 根据pk,修改记录 -->
|
||||
<update id="updateByPrimaryKey" parameterType="com.adc.da.sys.entity.RoleEO">
|
||||
update TS_ROLE
|
||||
set data_scope = #{dataScope},
|
||||
del_flag = #{delFlag},
|
||||
is_default = #{isDefault},
|
||||
name = #{name},
|
||||
remarks = #{remarks},
|
||||
extInfo = #{extInfo}
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 修改记录,只修改只不为空的字段 -->
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.adc.da.sys.entity.RoleEO">
|
||||
update TS_ROLE set
|
||||
<trim suffixOverrides="," >
|
||||
<if test="dataScope != null">
|
||||
data_scope = #{dataScope},
|
||||
</if>
|
||||
<if test="delFlag != null">
|
||||
del_flag = #{delFlag},
|
||||
</if>
|
||||
<if test="isDefault != null">
|
||||
is_default = #{isDefault},
|
||||
</if>
|
||||
<if test="name != null">
|
||||
name = #{name},
|
||||
</if>
|
||||
<if test="remarks != null">
|
||||
remarks = #{remarks},
|
||||
</if>
|
||||
<if test="extInfo != null">
|
||||
EXT_INFO=#{extInfo},
|
||||
</if>
|
||||
<if test="extInfo2 != null">
|
||||
extInfo2 = #{extInfo2},
|
||||
</if>
|
||||
<if test="extInfo3 != null">
|
||||
extInfo3 = #{extInfo3},
|
||||
</if>
|
||||
<if test="extInfo4 != null">
|
||||
extInfo4 = #{extInfo4},
|
||||
</if>
|
||||
<if test="extInfo5 != null">
|
||||
extInfo5 = #{extInfo5},
|
||||
</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 根据id查询 TS_ROLE -->
|
||||
<select id="selectByPrimaryKey" resultMap="BaseResultMap"
|
||||
parameterType="java.lang.String">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from TS_ROLE
|
||||
where id = #{value}
|
||||
|
||||
</select>
|
||||
|
||||
<!-- 删除记录 -->
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
|
||||
delete from TS_ROLE
|
||||
where id = #{value}
|
||||
|
||||
</delete>
|
||||
|
||||
<!-- TS_ROLE 列表总数 -->
|
||||
<select id="queryByCount" resultType="java.lang.Integer"
|
||||
parameterType="com.adc.da.base.page.BasePage">
|
||||
select count(1) from TS_ROLE
|
||||
<include refid="Base_Where_Clause" />
|
||||
</select>
|
||||
|
||||
<!--mysql date 2019-01-18-->
|
||||
<!--@author Lee Kwanho 李坤澔-->
|
||||
<!-- 查询TS_ROLE列表 -->
|
||||
<select id="queryByPage" resultMap="BaseResultMap" parameterType="com.adc.da.base.page.BasePage" >
|
||||
select <include refid="Base_Column_List" /> from TS_ROLE
|
||||
<include refid="Base_Where_Clause"/>
|
||||
and TS_ROLE.del_flag != 1
|
||||
<if test="pager.orderCondition != null and pager.orderCondition != ''" >
|
||||
${pager.orderCondition}
|
||||
</if>
|
||||
limit ${pager.startIndex -1}, ${pager.pageSize}
|
||||
</select>
|
||||
|
||||
<select id="queryByList" resultMap="BaseResultMap" parameterType="com.adc.da.base.page.BasePage">
|
||||
select <include refid="Base_Column_List"/> from TS_ROLE
|
||||
<include refid="Base_Where_Clause"/>
|
||||
<if test="pager.orderCondition != null and pager.orderCondition != ''" >
|
||||
${pager.orderCondition}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getpidByMenuId" parameterType="string" resultType="string">
|
||||
select parent_id from ts_menu where id=#{id}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -1,43 +0,0 @@
|
||||
<?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.adc.da.sys.dao.mysql.RoleHomeEODao" >
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.adc.da.sys.entity.MenuEO">
|
||||
<id column="id" property="id"/>
|
||||
<result column="del_flag" property="delFlag"/>
|
||||
<result column="name" property="name"/>
|
||||
<result column="parent_id" property="parentId"/>
|
||||
<result column="parent_ids" property="parentIds"/>
|
||||
<result column="href" property="href"/>
|
||||
<result column="icon" property="icon"/>
|
||||
<result column="iconHref" property="iconHref"/>
|
||||
<result column="iconClick" property="iconClick"/>
|
||||
<result column="iconClickHref" property="iconClickHref"/>
|
||||
<result column="is_show" property="isShow"/>
|
||||
<result column="permission" property="permission"/>
|
||||
<result column="remarks" property="remarks"/>
|
||||
<result column="sort" property="sort"/>
|
||||
<result column="ext_info" property="extInfo" />
|
||||
<result column="is_url" property="isUrl" />
|
||||
</resultMap>
|
||||
|
||||
|
||||
<insert id="insertRoleHomeBatch" parameterType="list">
|
||||
insert into TR_ROLE_HOME values
|
||||
<foreach collection="rhList" item="rh" separator=",">
|
||||
(#{rh.roleId},#{rh.menuId})
|
||||
</foreach>
|
||||
|
||||
</insert>
|
||||
|
||||
|
||||
<!-- <select id="getHomeListByRoleId" parameterType="string" resultMap="BaseResultMap">-->
|
||||
<!-- select t4.id, t4.del_flag, t4.name,t4. parent_id, t4.parent_ids, t4.href, t4.icon,t4.iconHref,t4.iconClick,t4.iconClickHref-->
|
||||
<!-- , t4.is_show, t4.permission, t4.remarks, t4.sort, t4.ext_info,t4.is_url-->
|
||||
<!-- from tr_role_home t3-->
|
||||
<!-- inner join ts_menu t4 on t3.menuId=t4.ID-->
|
||||
<!-- <if test="roleId!='' and roleId!=null">-->
|
||||
<!-- where t3.roleId=#{roleId}-->
|
||||
<!-- </if>-->
|
||||
<!-- </select>-->
|
||||
</mapper>
|
||||
@@ -1,91 +0,0 @@
|
||||
<?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.adc.da.sys.dao.mysql.RoleMenuEODao" >
|
||||
<!-- Result Map-->
|
||||
<resultMap id="BaseResultMap" type="com.adc.da.sys.entity.RoleMenuEO" >
|
||||
<result column="role_id" property="roleId" />
|
||||
<result column="menu_id" property="menuId" />
|
||||
</resultMap>
|
||||
|
||||
<!-- TR_ROLE_MENU table all fields -->
|
||||
<sql id="Base_Column_List" >
|
||||
role_id, menu_id
|
||||
</sql>
|
||||
|
||||
<!-- 查询条件 -->
|
||||
<sql id="Base_Where_Clause">
|
||||
where 1=1
|
||||
<trim suffixOverrides="," >
|
||||
<if test="roleId != null" >
|
||||
and role_id ${roleIdOperator} #{roleId}
|
||||
</if>
|
||||
<if test="menuId != null" >
|
||||
and menu_id ${menuIdOperator} #{menuId}
|
||||
</if>
|
||||
</trim>
|
||||
</sql>
|
||||
|
||||
<!-- 插入记录 -->
|
||||
<insert id="insert" parameterType="com.adc.da.sys.entity.RoleMenuEO" >
|
||||
insert into TR_ROLE_MENU(<include refid="Base_Column_List" />)
|
||||
values (#{roleId, jdbcType=VARCHAR}, #{menuId, jdbcType=VARCHAR})
|
||||
</insert>
|
||||
|
||||
<!-- 动态插入记录 主键是序列 -->
|
||||
<insert id="insertSelective" parameterType="com.adc.da.sys.entity.RoleMenuEO" >
|
||||
insert into TR_ROLE_MENU
|
||||
<trim prefix="(" suffix=")" suffixOverrides="," >
|
||||
<if test="roleId != null" >role_id,</if>
|
||||
<if test="menuId != null" >menu_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides="," >
|
||||
<if test="roleId != null" >#{roleId, jdbcType=VARCHAR},</if>
|
||||
<if test="menuId != null" >#{menuId, jdbcType=VARCHAR},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<!-- TR_ROLE_MENU 列表总数-->
|
||||
<select id="queryByCount" resultType="java.lang.Integer" parameterType="com.adc.da.base.page.BasePage">
|
||||
select count(1) from TR_ROLE_MENU
|
||||
<include refid="Base_Where_Clause"/>
|
||||
</select>
|
||||
|
||||
<!-- 查询TR_ROLE_MENU列表 -->
|
||||
<select id="queryByPage" resultMap="BaseResultMap" parameterType="com.adc.da.base.page.BasePage">
|
||||
select <include refid="Base_Column_List" /> from
|
||||
(select tmp_tb.* , rownum rn from
|
||||
(select <include refid="Base_Column_List" /> from TR_ROLE_MENU
|
||||
<include refid="Base_Where_Clause"/>
|
||||
<if test="pager.orderCondition != null and pager.orderCondition != ''" >
|
||||
${pager.orderCondition}
|
||||
</if>
|
||||
) tmp_tb where rownum <= ${pager.endIndex})
|
||||
where rn >= ${pager.startIndex}
|
||||
</select>
|
||||
|
||||
<select id="queryByList" resultMap="BaseResultMap" parameterType="com.adc.da.base.page.BasePage">
|
||||
select <include refid="Base_Column_List"/> from TR_ROLE_MENU
|
||||
<include refid="Base_Where_Clause"/>
|
||||
<if test="pager.orderCondition != null and pager.orderCondition != ''" >
|
||||
${pager.orderCondition}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getRoleMenuList" resultMap="BaseResultMap">
|
||||
select role_id,menu_id from TR_ROLE_MENU where role_id=#{roleId}
|
||||
</select>
|
||||
|
||||
<select id="getRoleMenuInfoList" resultType="com.adc.da.sys.vo.ddm.DdmMenuVO">
|
||||
SELECT
|
||||
t1.role_id ,
|
||||
t1.menu_id modelId,
|
||||
t2.`NAME` modelName,
|
||||
t2.PARENT_ID parentModelId
|
||||
FROM
|
||||
TR_ROLE_MENU t1
|
||||
LEFT JOIN TS_MENU t2 ON t1.MENU_ID = t2.ID
|
||||
WHERE
|
||||
t1.role_id = #{roleId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -1,85 +0,0 @@
|
||||
<?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.adc.da.sys.dao.mysql.RoleOrgEODao" >
|
||||
<!-- Result Map-->
|
||||
<resultMap id="BaseResultMap" type="com.adc.da.sys.entity.RoleOrgEO" >
|
||||
<result column="role_id" property="roleId" />
|
||||
<result column="org_id" property="orgId" />
|
||||
</resultMap>
|
||||
|
||||
<!-- TR_ROLE_ORG table all fields -->
|
||||
<sql id="Base_Column_List" >
|
||||
role_id, org_id
|
||||
</sql>
|
||||
|
||||
<!-- 查询条件 -->
|
||||
<sql id="Base_Where_Clause">
|
||||
where 1=1
|
||||
<trim suffixOverrides="," >
|
||||
<if test="roleId != null" >
|
||||
and role_id ${roleIdOperator} #{roleId}
|
||||
</if>
|
||||
<if test="orgId != null" >
|
||||
and org_id ${orgIdOperator} #{orgId}
|
||||
</if>
|
||||
</trim>
|
||||
</sql>
|
||||
|
||||
<!-- 插入记录 -->
|
||||
<insert id="insert" parameterType="com.adc.da.sys.entity.RoleOrgEO" >
|
||||
insert into TR_ROLE_ORG(<include refid="Base_Column_List" />)
|
||||
values (#{roleId, jdbcType=VARCHAR}, #{orgId, jdbcType=VARCHAR})
|
||||
</insert>
|
||||
|
||||
<!-- 动态插入记录 主键是序列 -->
|
||||
<insert id="insertSelective" parameterType="com.adc.da.sys.entity.RoleOrgEO" >
|
||||
insert into TR_ROLE_ORG
|
||||
<trim prefix="(" suffix=")" suffixOverrides="," >
|
||||
<if test="roleId != null" >role_id,</if>
|
||||
<if test="orgId != null" >org_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides="," >
|
||||
<if test="roleId != null" >#{roleId, jdbcType=VARCHAR},</if>
|
||||
<if test="orgId != null" >#{orgId, jdbcType=VARCHAR},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<!-- TR_ROLE_ORG 列表总数-->
|
||||
<select id="queryByCount" resultType="java.lang.Integer" parameterType="com.adc.da.base.page.BasePage">
|
||||
select count(1) from TR_ROLE_ORG
|
||||
<include refid="Base_Where_Clause"/>
|
||||
</select>
|
||||
|
||||
<!-- 查询TR_ROLE_ORG列表 -->
|
||||
<select id="queryByPage" resultMap="BaseResultMap" parameterType="com.adc.da.base.page.BasePage">
|
||||
select <include refid="Base_Column_List" /> from
|
||||
(select tmp_tb.* , rownum rn from
|
||||
(select <include refid="Base_Column_List" /> from TR_ROLE_ORG
|
||||
<include refid="Base_Where_Clause"/>
|
||||
<if test="pager.orderCondition != null and pager.orderCondition != ''" >
|
||||
${pager.orderCondition}
|
||||
</if>
|
||||
) tmp_tb where rownum <= ${pager.endIndex})
|
||||
where rn >= ${pager.startIndex}
|
||||
</select>
|
||||
|
||||
<select id="queryByList" resultMap="BaseResultMap" parameterType="com.adc.da.base.page.BasePage">
|
||||
select <include refid="Base_Column_List"/> from TR_ROLE_ORG
|
||||
<include refid="Base_Where_Clause"/>
|
||||
<if test="pager.orderCondition != null and pager.orderCondition != ''" >
|
||||
${pager.orderCondition}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<delete id="deleteRoleOrgByRoleId" parameterType="java.lang.String">
|
||||
delete from TR_ROLE_ORG ro where ro.role_id = #{roleId}
|
||||
</delete>
|
||||
|
||||
<select id="queryOrgIdList" resultType="java.lang.String" parameterType="java.lang.String">
|
||||
select org_id from TR_ROLE_ORG where role_id in
|
||||
<foreach item="roleId" collection="array" open="(" separator="," close=")">
|
||||
#{roleId}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -1,164 +0,0 @@
|
||||
<?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.adc.da.sys.dao.mysql.UserEODao">
|
||||
|
||||
<select id="list" parameterType="string" resultType="map">
|
||||
select * from(select t1.USID,t1.ACCOUNT,t1.USNAME,t1.CELLPHONE_NUMBER,t1.EMAIL,t1.ISUSE,t1.DEPARTMENT,t3.NAME ROLENAME,t3.id ROLEID,
|
||||
date_format(t1.UPDATE_TIME,'%Y-%m-%d %H:%i:%S')CREATEDATE from TS_USER t1
|
||||
left join TR_USER_ROLE t2 on t1.USID=t2.USER_ID
|
||||
left JOIN TS_ROLE t3 on t2.ROLE_ID=t3.ID
|
||||
where t1.del_flag='0'
|
||||
<if test="account !='' and account !=null">
|
||||
and t1.ACCOUNT like "%"#{account}"%"
|
||||
</if>
|
||||
|
||||
<if test="roleName !='' and roleName !=null">
|
||||
and t3.NAME like "%"#{roleName}"%"
|
||||
</if>
|
||||
ORDER BY t1.UPDATE_TIME DESC)tt
|
||||
|
||||
</select>
|
||||
|
||||
<select id="getUserPage" resultType="com.adc.da.sys.vo.ddm.DdmUserVO">
|
||||
select t1.USID userId,t1.ACCOUNT userAccount,t1.USNAME userName,t1.CELLPHONE_NUMBER,t1.EMAIL,t1.ISUSE,t1.DEPARTMENT,
|
||||
date_format(t1.UPDATE_TIME,'%Y-%m-%d %H:%i:%S')CREATEDATE from TS_USER t1
|
||||
where t1.del_flag='0'
|
||||
<if test="userAccount !='' and userAccount !=null">
|
||||
and t1.ACCOUNT like "%"#{userAccount}"%"
|
||||
</if>
|
||||
|
||||
<if test="userName !='' and userName !=null">
|
||||
and t1.USNAME like "%"#{userName}"%"
|
||||
</if>
|
||||
ORDER BY t1.UPDATE_TIME DESC
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
<select id="getUserCount" resultType="java.lang.Long">
|
||||
select count(*) from TS_USER t1
|
||||
where t1.del_flag='0'
|
||||
<if test="userAccount !='' and userAccount !=null">
|
||||
and t1.ACCOUNT like "%"#{userAccount}"%"
|
||||
</if>
|
||||
|
||||
<if test="userName !='' and userName !=null">
|
||||
and t1.USNAME like "%"#{userName}"%"
|
||||
</if>
|
||||
|
||||
</select>
|
||||
|
||||
<!-- Result Map -->
|
||||
<resultMap id="BaseResultMap" type="com.adc.da.sys.entity.UserEO">
|
||||
<id column="usid" property="usid"/>
|
||||
<result column="account" property="account"/>
|
||||
<result column="del_flag" property="delFlag"/>
|
||||
<result column="password" property="password"/>
|
||||
<result column="CELLPHONE_NUMBER" property="cellPhoneNumber"/>
|
||||
<result column="EMAIL" property="email"/>
|
||||
<result column="CREATE_TIME" property="createTime"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="UserRoleMap" extends="BaseResultMap" type="com.adc.da.sys.entity.UserEO">
|
||||
<result column="department" property="department"></result>
|
||||
<result column="usname" property="usname"></result>
|
||||
<result column="isuse" property="isUse"></result>
|
||||
<collection property = "roleIdList" ofType="string">
|
||||
<id column="id" />
|
||||
</collection>
|
||||
<collection property="roleEOList" ofType="com.adc.da.sys.entity.RoleEO">
|
||||
<id column="id" property="id"/>
|
||||
<result column="data_scope" property="dataScope"/>
|
||||
<result column="r_delFlag" property="delFlag"/>
|
||||
<result column="is_default" property="isDefault"/>
|
||||
<result column="name" property="name"/>
|
||||
<result column="remarks" property="remarks"/>
|
||||
</collection>
|
||||
</resultMap>
|
||||
|
||||
<!---->
|
||||
<sql id="User_Role_List">
|
||||
u.*, r.id as id,
|
||||
r.data_scope as dataScope,
|
||||
r.del_flag as r_delFlag,
|
||||
r.is_default as isDefault,
|
||||
r.name as name,
|
||||
r.remarks as remarks
|
||||
</sql>
|
||||
|
||||
<!--获取用户角色信息-->
|
||||
<select id="getUserWithRoles" resultMap="UserRoleMap" parameterType="java.lang.String">
|
||||
select
|
||||
<include refid="User_Role_List"/>
|
||||
from TS_USER u
|
||||
left join TR_USER_ROLE ur on u.usid = ur.user_id
|
||||
left join TS_ROLE r on ur.role_id = r.id
|
||||
where u.usid = #{id}
|
||||
</select>
|
||||
|
||||
<!-- TS_USER table all fields -->
|
||||
<sql id="Base_Column_List">
|
||||
distinct(usid), account, del_flag, password,CELLPHONE_NUMBER,
|
||||
EMAIL,CREATE_TIME
|
||||
</sql>
|
||||
<!-- 根据account获取未逻辑删除的UserEO -->
|
||||
<select id="getUserEOByAccountNotDeleted" resultMap="BaseResultMap" parameterType="java.lang.String">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from TS_USER where account = #{account} and del_flag != 1 and isuse=1
|
||||
</select>
|
||||
|
||||
<insert id="insertUserBatch" parameterType="list">
|
||||
insert into TS_USER(USID,ACCOUNT,DEL_FLAG,PASSWORD,USNAME,CELLPHONE_NUMBER,EMAIL,CREATE_TIME,UPDATE_TIME,ISUSE,DEPARTMENT,ISSELF) values
|
||||
<foreach collection="userEOList" item="user" separator=",">
|
||||
(#{user.usid},#{user.account},#{user.delFlag},#{user.password},#{user.usname},#{user.cellPhoneNumber},#{user.email},#{user.createTime},#{user.updateTime},#{user.isUse},#{user.department},#{user.isSelf})
|
||||
</foreach>
|
||||
|
||||
</insert>
|
||||
|
||||
<select id="getDdmUserEOByAccountNotDeleted" resultMap="BaseResultMap" parameterType="java.lang.String">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from TS_USER where account = #{account} and del_flag != 1
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getUserByMail" resultMap="BaseResultMap" parameterType="java.lang.String">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from TS_USER
|
||||
WHERE EMAIL in
|
||||
<foreach collection="mailList" item="mail" open="(" separator="," close=")">
|
||||
#{mail}
|
||||
</foreach>
|
||||
|
||||
</select>
|
||||
|
||||
<select id="allList" resultType="java.util.Map">
|
||||
select * from(select t1.USID,t1.ACCOUNT,t1.USNAME,t1.CELLPHONE_NUMBER,t1.EMAIL,t1.ISUSE,t1.DEPARTMENT,t3.NAME ROLENAME,t3.id ROLEID,
|
||||
date_format(t1.UPDATE_TIME,'%Y-%m-%d %H:%i:%S')CREATEDATE from TS_USER t1
|
||||
left join TR_USER_ROLE t2 on t1.USID=t2.USER_ID
|
||||
left JOIN TS_ROLE t3 on t2.ROLE_ID=t3.ID
|
||||
where t1.del_flag='0'
|
||||
<if test="account !='' and account !=null">
|
||||
and t1.ACCOUNT like "%"#{account}"%"
|
||||
</if>
|
||||
|
||||
<if test="roleName !='' and roleName !=null">
|
||||
and t3.NAME like "%"#{roleName}"%"
|
||||
</if>
|
||||
ORDER BY t1.UPDATE_TIME DESC)tt
|
||||
|
||||
</select>
|
||||
<select id="getUserByAccount" resultType="com.adc.da.sys.entity.UserEO">
|
||||
select
|
||||
ACCOUNT,USNAME,DEPARTMENT
|
||||
from TS_USER
|
||||
WHERE ACCOUNT in
|
||||
<foreach collection="accountList" item="account" open="(" separator="," close=")">
|
||||
#{account}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -1,101 +0,0 @@
|
||||
<?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.adc.da.sys.dao.mysql.UserRoleEODao" >
|
||||
<!-- Result Map-->
|
||||
<resultMap id="BaseResultMap" type="com.adc.da.sys.entity.UserRoleEO" >
|
||||
<id column="user_id" property="userId" />
|
||||
<result column="role_id" property="roleId" />
|
||||
</resultMap>
|
||||
|
||||
<!-- TR_USER_ROLE table all fields -->
|
||||
<sql id="Base_Column_List" >
|
||||
user_id, role_id
|
||||
</sql>
|
||||
|
||||
<!-- 查询条件 -->
|
||||
<sql id="Base_Where_Clause">
|
||||
where 1=1
|
||||
<trim suffixOverrides="," >
|
||||
<if test="userId != null" >
|
||||
and `user_id` ${userIdOperator} #{userId}
|
||||
</if>
|
||||
<if test="roleId != null" >
|
||||
and `role_id` ${roleIdOperator} #{roleId}
|
||||
</if>
|
||||
</trim>
|
||||
</sql>
|
||||
|
||||
<!-- 插入记录 -->
|
||||
<insert id="insert" parameterType="com.adc.da.sys.entity.UserRoleEO" >
|
||||
insert into TR_USER_ROLE(<include refid="Base_Column_List" />)
|
||||
values (#{userId}, #{roleId})
|
||||
</insert>
|
||||
|
||||
<!-- 根据pk,修改记录-->
|
||||
<update id="updateByPrimaryKey" parameterType="com.adc.da.sys.entity.UserRoleEO" >
|
||||
update TR_USER_ROLE
|
||||
set `role_id` = #{roleId}
|
||||
where `user_id` = #{userId}
|
||||
</update>
|
||||
|
||||
<!-- 修改记录,只修改只不为空的字段 -->
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.adc.da.sys.entity.UserRoleEO" >
|
||||
update TR_USER_ROLE
|
||||
<set >
|
||||
<if test="roleId != null" >
|
||||
role_id = #{roleId},
|
||||
</if>
|
||||
</set>
|
||||
where user_id = #{userId}
|
||||
</update>
|
||||
|
||||
<!-- 根据id查询 TR_USER_ROLE -->
|
||||
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String">
|
||||
select <include refid="Base_Column_List" />
|
||||
from TR_USER_ROLE
|
||||
where user_id = #{value}
|
||||
|
||||
</select>
|
||||
|
||||
<!-- 删除记录 -->
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
|
||||
delete from TR_USER_ROLE
|
||||
where user_id = #{value}
|
||||
|
||||
</delete>
|
||||
|
||||
<!-- TR_USER_ROLE 列表总数-->
|
||||
<select id="queryByCount" resultType="java.lang.String" parameterType="com.adc.da.base.page.BasePage">
|
||||
select count(1) from TR_USER_ROLE
|
||||
<include refid="Base_Where_Clause"/>
|
||||
</select>
|
||||
|
||||
<!-- 查询TR_USER_ROLE列表 -->
|
||||
<select id="queryByList" resultMap="BaseResultMap" parameterType="com.adc.da.base.page.BasePage">
|
||||
select <include refid="Base_Column_List"/> from (select t.*,rownum rownu from TR_USER_ROLE t
|
||||
where rownum<=${pager.endIndex})tt
|
||||
where tt.rownu>=${pager.startIndex}
|
||||
</select>
|
||||
|
||||
<select id="queryByPage" resultMap="BaseResultMap" parameterType="com.adc.da.base.page.BasePage">
|
||||
select <include refid="Base_Column_List"/>
|
||||
from TR_USER_ROLE
|
||||
<include refid="Base_Where_Clause"/>
|
||||
<if test="pager.orderCondition != null and pager.orderCondition != ''" >
|
||||
${pager.orderCondition}
|
||||
</if>
|
||||
<if test="pager.mysqlQueryCondition != null and pager.mysqlQueryCondition != ''" >
|
||||
${pager.mysqlQueryCondition}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 插入记录 -->
|
||||
<insert id="insertBatch" parameterType="com.adc.da.sys.entity.UserRoleEO" >
|
||||
insert into TR_USER_ROLE(<include refid="Base_Column_List" />)values
|
||||
<foreach collection="userRoleEOList" item="ur" separator=",">
|
||||
(#{ur.userId}, #{ur.roleId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user