<?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.landtool.lanbase.modules.org.dao.OrgGroupDao">
|
|
<!-- 可根据自己的需求,是否要使用 -->
|
<resultMap type="com.landtool.lanbase.modules.org.entity.OrgGroup" id="groupMap">
|
<result property="groupId" column="groupid"/>
|
<result property="groupName" column="groupname"/>
|
<result property="appId" column="appId"/>
|
<result property="description" column="description"/>
|
<result property="rCreateUser" column="rcreateuser"/>
|
<result property="rCreateDate" column="rcreatedate"/>
|
</resultMap>
|
|
<select id="queryObject" resultType="com.landtool.lanbase.modules.org.entity.OrgGroup">
|
select * from ORG_GROUP where groupid = #{value}
|
</select>
|
|
<select id="queryList" resultType="com.landtool.lanbase.modules.org.entity.OrgGroup">
|
select * from (
|
SELECT *
|
FROM(
|
SELECT ROW_NUMBER() OVER(ORDER BY B.groupid) AS rownumber,B.*
|
FROM (
|
|
select gro.*,ss.appfullname,
|
(select COUNT(*) from ORG_USERGROUP o where o.groupid = gro.groupid) as TOTALOFUSERS,
|
(select COUNT(*) from SYS_ROLEGROUP r where r.groupid = gro.groupid) as TOTALOFROLES
|
from ORG_GROUP gro
|
left join SYS_SYSTEMINFO ss on ss.appid = gro.appid
|
<where>
|
<if test="groupName != null and groupName != ''">
|
AND gro.groupName LIKE ('%' || #{groupName} || '%')
|
</if>
|
<if test="appId != null and appId != ''">
|
AND cast(ss.APPID as varchar) = #{appId}
|
</if>
|
</where>
|
|
) B
|
) A
|
WHERE rownumber > #{lowerOffset} AND <![CDATA[ rownumber <= ${upperOffset} ]]>
|
)a order by
|
<choose>
|
<when test="sidx != null and sidx != ''">
|
${sidx} ${order}
|
</when>
|
<otherwise>
|
groupid
|
</otherwise>
|
</choose>
|
</select>
|
|
<select id="queryTotal" resultType="int">
|
select count(*) from ORG_GROUP gro
|
LEFT JOIN (
|
SELECT ous.groupid ,COUNT(ous.userid) as TOTALOFUSERS
|
from ORG_USERGROUP ous GROUP BY ous.groupid
|
) b on gro.groupid = b.groupid
|
left join SYS_SYSTEMINFO ss on ss.appid = gro.appid
|
<where>
|
<if test="groupName != null and groupName != ''">
|
AND gro.groupName LIKE ('%' || #{groupName} || '%')
|
</if>
|
<if test="appId != null and appId != ''">
|
AND cast(ss.APPID as varchar) = #{appId}
|
</if>
|
</where>
|
</select>
|
|
<insert id="save" parameterType="com.landtool.lanbase.modules.org.entity.OrgGroup">
|
insert into ORG_GROUP
|
(
|
groupname,
|
appid,
|
description,
|
rcreateuser,
|
rcreatedate
|
)
|
values
|
(
|
#{groupName},
|
#{appId},
|
#{description,jdbcType=VARCHAR},
|
#{rCreateUser},
|
#{rCreateDate}
|
)
|
</insert>
|
|
<update id="update" parameterType="com.landtool.lanbase.modules.org.entity.OrgGroup">
|
update ORG_GROUP
|
<set>
|
<if test="groupName != null">groupname = #{groupName}, </if>
|
<if test="appId != null">appid = #{appId}, </if>
|
<if test="description != null">description = #{description}, </if>
|
<if test="rCreateUser != null">rcreateuser = #{rCreateUser}, </if>
|
<if test="rCreateDate != null">rcreatedate = #{rCreateDate}</if>
|
</set>
|
where groupid = #{groupId}
|
</update>
|
|
<delete id="delete">
|
delete from ORG_GROUP where groupid = #{value}
|
</delete>
|
|
<delete id="deleteBatch">
|
delete from ORG_GROUP where groupid in
|
<foreach item="groupId" collection="array" open="(" separator="," close=")">
|
#{groupId}
|
</foreach>
|
</delete>
|
|
<select id="queryListById" resultType="com.landtool.lanbase.modules.org.entity.OrgGroup">
|
select * from ORG_GROUP org
|
left join SYS_SYSTEMINFO syst on syst.appid = org.appid
|
where org.appid = 0 or syst.appid = #{appId}
|
</select>
|
|
<select id="queryGroupWithSEQ" resultType="int">
|
SELECT currval('ORG_GROUP_SEQ') FROM DUAL
|
</select>
|
</mapper>
|