[修改] target
This commit is contained in:
@@ -0,0 +1,315 @@
|
||||
<?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>
|
||||
@@ -0,0 +1,48 @@
|
||||
<?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.OrgEODao">
|
||||
|
||||
<!-- 查询条件 -->
|
||||
<sql id="Base_Where_Clause">
|
||||
<if test="pageVO.id != null and pageVO.id !=''">
|
||||
and id = #{pageVO.id}
|
||||
</if>
|
||||
<if test="pageVO.orgCode != null and pageVO.orgCode != ''">
|
||||
and ORG_CODE = #{pageVO.orgCode}
|
||||
</if>
|
||||
<if test="pageVO.orgName != null and pageVO.orgName != ''">
|
||||
and ORG_NAME LIKE CONCAT(CONCAT('%',#{pageVO.orgName}) ,'%')
|
||||
</if>
|
||||
<if test="pageVO.orgLevel != null">
|
||||
and ORG_LEVEL = #{pageVO.orgLevel}
|
||||
</if>
|
||||
<if test="pageVO.supOrgCode != null and pageVO.supOrgCode !=''">
|
||||
and SUP_ORG_CODE = #{pageVO.supOrgCode}
|
||||
</if>
|
||||
<if test="pageVO.orgShortName != null and pageVO.orgShortName != ''">
|
||||
and ORG_SHORT_NAME = #{pageVO.orgShortName}
|
||||
</if>
|
||||
<if test="pageVO.attribution != null and pageVO.attribution != ''">
|
||||
and ATTRIBUTION = #{pageVO.attribution}
|
||||
</if>
|
||||
<if test="pageVO.bmdm14 != null and pageVO.bmdm14 != ''">
|
||||
and BMDM_14 = #{pageVO.bmdm14}
|
||||
</if>
|
||||
<if test="pageVO.status != null">
|
||||
and STATUS = #{pageVO.status}
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="selectListByVO" resultType="com.adc.da.sys.entity.OrgEO">
|
||||
select * from TS_ORG
|
||||
<where>
|
||||
<include refid="Base_Where_Clause"/>
|
||||
</where>
|
||||
</select>
|
||||
<select id="selectPageByVO" resultType="com.adc.da.sys.entity.OrgEO">
|
||||
select * from TS_ORG
|
||||
<where>
|
||||
<include refid="Base_Where_Clause"/>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,327 @@
|
||||
<?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>
|
||||
<select id="selectByuserId" resultType="com.adc.da.sys.entity.RoleEO">
|
||||
SELECT * from ts_Role r
|
||||
LEFT JOIN tr_user_role ur on r.id = ur.role_id
|
||||
where r.del_flag = 0
|
||||
and ur.user_id =#{userId}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,43 @@
|
||||
<?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>
|
||||
@@ -0,0 +1,78 @@
|
||||
<?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>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,240 @@
|
||||
<?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,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="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"/>
|
||||
<!-- <result column="ORG_Name" property="orgName"/>-->
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="UserRoleMap" extends="BaseResultMap" type="com.adc.da.sys.entity.UserEO">
|
||||
<result column="usname" property="usname"></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>
|
||||
|
||||
<!-- 包含用户基本数据,角色数据,组织机构数据等-->
|
||||
<resultMap id="UserDetailMap" extends="BaseResultMap" type="com.adc.da.sys.vo.UserVO">
|
||||
<result column="usid" property="usid"></result>
|
||||
<result column="usname" property="usname"></result>
|
||||
<result column="account" property="account"></result>
|
||||
<collection property="roleEOList" ofType="com.adc.da.sys.entity.RoleEO" javaType="list">
|
||||
<id column="r_id" property="id"/>
|
||||
<result column="r_data_scope" property="dataScope"/>
|
||||
<result column="r_delFlag" property="delFlag"/>
|
||||
<result column="r_is_default" property="isDefault"/>
|
||||
<result column="r_name" property="name"/>
|
||||
</collection>
|
||||
<collection property="orgEOList" ofType="com.adc.da.sys.entity.OrgEO" javaType="list">
|
||||
<id column="o_id" property="id"/>
|
||||
<result column="o_org_code" property="orgCode"/>
|
||||
<result column="o_org_name" property="orgName"/>
|
||||
<result column="o_sup_org_code" property="supOrgCode"/>
|
||||
<result column="o_bmdm14" property="bmdm14"/>
|
||||
</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
|
||||
</select>
|
||||
|
||||
<insert id="insertUserBatch" parameterType="list">
|
||||
insert into TS_USER(USID,ACCOUNT,DEL_FLAG,PASSWORD,USNAME,CELLPHONE_NUMBER,EMAIL,CREATE_TIME,UPDATE_TIME,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.isSelf})
|
||||
</foreach>
|
||||
|
||||
</insert>
|
||||
|
||||
<select id="allList" resultType="java.util.Map">
|
||||
select * from(select t1.USID,t1.ACCOUNT,t1.USNAME,t1.CELLPHONE_NUMBER,t1.EMAIL,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="getUserByIdList" resultMap="UserDetailMap" parameterType="java.lang.String">
|
||||
select
|
||||
users.usid,
|
||||
users.usname,
|
||||
users.account,
|
||||
r.id as r_id,
|
||||
r.data_scope as r_data_scope,
|
||||
r.del_flag as r_delFlag,
|
||||
r.is_default as r_is_default,
|
||||
r.name as r_name,
|
||||
o.id as o_id,
|
||||
o.org_code as o_org_code,
|
||||
o.org_name as o_org_name,
|
||||
o.sup_org_code as o_sup_org_code,
|
||||
o.bmdm_14 as o_bmdm14
|
||||
from TS_USER users
|
||||
left join TR_USER_ROLE ur on users.usid = ur.user_id
|
||||
left join TS_ROLE r on ur.role_id = r.id
|
||||
left join TR_USER_ORG uo on users.usid = uo.user_id
|
||||
left join TS_ORG o on uo.org_id = o.id
|
||||
where users.del_flag != 1
|
||||
and users.usid in
|
||||
<foreach collection="userIdList" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
<select id="getUserEoById" resultType="com.adc.da.sys.entity.UserEO">
|
||||
select
|
||||
users.usid,
|
||||
users.usname,
|
||||
users.account,
|
||||
r.id as r_id,
|
||||
r.data_scope as r_data_scope,
|
||||
r.del_flag as r_delFlag,
|
||||
r.is_default as r_is_default,
|
||||
r.name as r_name,
|
||||
o.id as o_id,
|
||||
o.org_code as o_org_code,
|
||||
o.org_name as o_org_name,
|
||||
o.sup_org_code as o_sup_org_code,
|
||||
o.bmdm_14 as o_bmdm14
|
||||
from TS_USER users
|
||||
left join TR_USER_ROLE ur on users.usid = ur.user_id
|
||||
left join TS_ROLE r on ur.role_id = r.id
|
||||
left join TR_USER_ORG uo on users.usid = uo.user_id
|
||||
left join TS_ORG o on uo.org_id = o.id
|
||||
where users.del_flag != 1
|
||||
and users.usid=#{usid}
|
||||
</select>
|
||||
<select id="selectUserByIdNodel" resultType="com.adc.da.sys.entity.UserEO">
|
||||
select
|
||||
users.usid,
|
||||
users.usname,
|
||||
users.account,
|
||||
r.id as r_id,
|
||||
r.data_scope as r_data_scope,
|
||||
r.del_flag as r_delFlag,
|
||||
r.is_default as r_is_default,
|
||||
r.name as r_name,
|
||||
o.id as o_id,
|
||||
o.org_code as o_org_code,
|
||||
o.org_name as o_org_name,
|
||||
o.sup_org_code as o_sup_org_code,
|
||||
o.bmdm_14 as o_bmdm14
|
||||
from TS_USER users
|
||||
left join TR_USER_ROLE ur on users.usid = ur.user_id
|
||||
left join TS_ROLE r on ur.role_id = r.id
|
||||
left join TR_USER_ORG uo on users.usid = uo.user_id
|
||||
left join TS_ORG o on uo.org_id = o.id
|
||||
where users.usid=#{usid}
|
||||
</select>
|
||||
|
||||
<select id="getUserByIdListNodel" resultType="com.adc.da.sys.vo.UserVO">
|
||||
|
||||
select
|
||||
users.usid,
|
||||
users.usname,
|
||||
users.account,
|
||||
r.id as r_id,
|
||||
r.data_scope as r_data_scope,
|
||||
r.del_flag as r_delFlag,
|
||||
r.is_default as r_is_default,
|
||||
r.name as r_name,
|
||||
o.id as o_id,
|
||||
o.org_code as o_org_code,
|
||||
o.org_name as o_org_name,
|
||||
o.sup_org_code as o_sup_org_code,
|
||||
o.bmdm_14 as o_bmdm14
|
||||
from TS_USER users
|
||||
left join TR_USER_ROLE ur on users.usid = ur.user_id
|
||||
left join TS_ROLE r on ur.role_id = r.id
|
||||
left join TR_USER_ORG uo on users.usid = uo.user_id
|
||||
left join TS_ORG o on uo.org_id = o.id
|
||||
where users.usid in
|
||||
<foreach collection="userIdList" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,101 @@
|
||||
<?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.UserOrgEODao" >
|
||||
<!-- Result Map-->
|
||||
<resultMap id="BaseResultMap" type="com.adc.da.sys.entity.UserOrgEO" >
|
||||
<id column="user_id" property="userId" />
|
||||
<result column="org_id" property="orgId" />
|
||||
</resultMap>
|
||||
|
||||
<!-- TR_USER_ORG table all fields -->
|
||||
<sql id="Base_Column_List" >
|
||||
user_id, org_id
|
||||
</sql>
|
||||
|
||||
<!-- 查询条件 -->
|
||||
<sql id="Base_Where_Clause">
|
||||
where 1=1
|
||||
<trim suffixOverrides="," >
|
||||
<if test="userId != null" >
|
||||
and `user_id` ${userIdOperator} #{userId}
|
||||
</if>
|
||||
<if test="orgId != null" >
|
||||
and `org_id` ${orgIdOperator} #{orgId}
|
||||
</if>
|
||||
</trim>
|
||||
</sql>
|
||||
|
||||
<!-- 插入记录 -->
|
||||
<insert id="insert" parameterType="com.adc.da.sys.entity.UserOrgEO" >
|
||||
insert into TR_USER_ORG(<include refid="Base_Column_List" />)
|
||||
values (#{userId}, #{orgId})
|
||||
</insert>
|
||||
|
||||
<!-- 根据pk,修改记录-->
|
||||
<update id="updateByPrimaryKey" parameterType="com.adc.da.sys.entity.UserOrgEO" >
|
||||
update TR_USER_ORG
|
||||
set `org_id` = #{orgId}
|
||||
where `user_id` = #{userId}
|
||||
</update>
|
||||
|
||||
<!-- 修改记录,只修改只不为空的字段 -->
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.adc.da.sys.entity.UserOrgEO" >
|
||||
update TR_USER_ORG
|
||||
<set >
|
||||
<if test="orgId != null" >
|
||||
org_id = #{orgId},
|
||||
</if>
|
||||
</set>
|
||||
where user_id = #{userId}
|
||||
</update>
|
||||
|
||||
<!-- 根据id查询 TR_USER_ORG -->
|
||||
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String">
|
||||
select <include refid="Base_Column_List" />
|
||||
from TR_USER_ORG
|
||||
where user_id = #{value}
|
||||
|
||||
</select>
|
||||
|
||||
<!-- 删除记录 -->
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
|
||||
delete from TR_USER_ORG
|
||||
where user_id = #{value}
|
||||
|
||||
</delete>
|
||||
|
||||
<!-- TR_USER_ORG 列表总数-->
|
||||
<select id="queryByCount" resultType="java.lang.String" parameterType="com.adc.da.base.page.BasePage">
|
||||
select count(1) from TR_USER_ORG
|
||||
<include refid="Base_Where_Clause"/>
|
||||
</select>
|
||||
|
||||
<!-- 查询TR_USER_ORG列表 -->
|
||||
<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_ORG 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_ORG
|
||||
<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.UserOrgEO" >
|
||||
insert into TR_USER_ORG(<include refid="Base_Column_List" />)values
|
||||
<foreach collection="UserOrgEOList" item="ur" separator=",">
|
||||
(#{ur.userId}, #{ur.orgId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,101 @@
|
||||
<?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