You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ocr/jyjz-system/jyjz-system-admin/src/main/resources/mapper/admin/DepartmentMapper.xml

271 lines
15 KiB

<?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="cn.jyjz.xiaoyao.admin.dataDao.DepartmentMybatisDao">
<resultMap id="BaseResultMap" type="cn.jyjz.xiaoyao.admin.dataobject.Department">
<id column="ID" property="id" jdbcType="BIGINT"/>
<result column="DEPTNO" property="deptno" jdbcType="VARCHAR"/>
<result column="DEPARTSHOTNAME" property="departshotname" jdbcType="VARCHAR"/>
<result column="DEPARTNAME" property="departname" jdbcType="VARCHAR"/>
<result column="PARENTID" property="parentid" jdbcType="BIGINT"/>
<result column="DEPARTROOT" property="departroot" jdbcType="BIGINT"/>
<result column="DLEVEL" property="dlevel" jdbcType="INTEGER"/>
<result column="DEPARTDESC" property="departdesc" jdbcType="VARCHAR"/>
<result column="ENABLED" property="enabled" jdbcType="INTEGER"/>
<result column="SORTING" property="sorting" jdbcType="INTEGER"/>
<result column="DEPARTADDRESS" property="departaddress" jdbcType="VARCHAR"/>
<result column="LOGO" property="logo" jdbcType="VARCHAR"/>
<result column="SOURCEPATH" property="sourcepath" jdbcType="VARCHAR"/>
<result column="COPYRIGHT" property="copyright" jdbcType="VARCHAR"/>
<result column="RECORDNUMBER" property="recordnumber" jdbcType="VARCHAR"/>
<result column="INDEXTEMPLET" property="indextemplet" jdbcType="VARCHAR"/>
<result column="KEYWORDS" property="keywords" jdbcType="VARCHAR"/>
<result column="DESCRIPTION" property="description" jdbcType="VARCHAR"/>
<result column="LONGIDUTE" property="longidute" jdbcType="DECIMAL"/>
<result column="LATITUDE" property="latitude" jdbcType="DECIMAL"/>
<result column="CREATEUSER" property="createuser" jdbcType="VARCHAR"/>
<result column="CREATEDATE" property="createdate" jdbcType="BIGINT"/>
<result column="UPDATEUSER" property="updateuser" jdbcType="VARCHAR"/>
<result column="UPDATETIME" property="updatetime" jdbcType="BIGINT"/>
<result column="SERVICENAME" property="servicename" jdbcType="VARCHAR"/>
<result column="BUILTFORM" property="builtform" jdbcType="INTEGER"/>
<result column="FORMURL" property="formurl" jdbcType="VARCHAR"/>
<result column="FORMDETAIL" property="formdetail" jdbcType="VARCHAR"/>
<result column="FORMTYPE" property="formtype" jdbcType="VARCHAR"/>
<result column="PROCESSDEFINITIONID" property="processdefinitionid" jdbcType="VARCHAR"/>
<result column="TYPEDEPT" property="typedept" jdbcType="INTEGER"/>
<result column="CATEGORY" property="category" jdbcType="VARCHAR"/>
<collection property="listchilddept" select="selectChildDeptEnabled" javaType="java.util.ArrayList" column="{id=id}"/>
</resultMap>
<resultMap id="BaseResultMap_only" type="cn.jyjz.xiaoyao.admin.dataobject.Department">
<id column="ID" property="id" jdbcType="BIGINT"/>
<result column="DEPTNO" property="deptno" jdbcType="VARCHAR"/>
<result column="DEPARTSHOTNAME" property="departshotname" jdbcType="VARCHAR"/>
<result column="DEPARTNAME" property="departname" jdbcType="VARCHAR"/>
<result column="PARENTID" property="parentid" jdbcType="BIGINT"/>
<result column="DEPARTROOT" property="departroot" jdbcType="BIGINT"/>
<result column="DLEVEL" property="dlevel" jdbcType="INTEGER"/>
<result column="DEPARTDESC" property="departdesc" jdbcType="VARCHAR"/>
<result column="ENABLED" property="enabled" jdbcType="INTEGER"/>
<result column="SORTING" property="sorting" jdbcType="INTEGER"/>
<result column="DEPARTADDRESS" property="departaddress" jdbcType="VARCHAR"/>
<result column="LOGO" property="logo" jdbcType="VARCHAR"/>
<result column="SOURCEPATH" property="sourcepath" jdbcType="VARCHAR"/>
<result column="COPYRIGHT" property="copyright" jdbcType="VARCHAR"/>
<result column="RECORDNUMBER" property="recordnumber" jdbcType="VARCHAR"/>
<result column="INDEXTEMPLET" property="indextemplet" jdbcType="VARCHAR"/>
<result column="KEYWORDS" property="keywords" jdbcType="VARCHAR"/>
<result column="DESCRIPTION" property="description" jdbcType="VARCHAR"/>
<result column="LONGIDUTE" property="longidute" jdbcType="DECIMAL"/>
<result column="LATITUDE" property="latitude" jdbcType="DECIMAL"/>
<result column="CREATEUSER" property="createuser" jdbcType="VARCHAR"/>
<result column="CREATEDATE" property="createdate" jdbcType="BIGINT"/>
<result column="UPDATEUSER" property="updateuser" jdbcType="VARCHAR"/>
<result column="UPDATETIME" property="updatetime" jdbcType="BIGINT"/>
<result column="SERVICENAME" property="servicename" jdbcType="VARCHAR"/>
<result column="BUILTFORM" property="builtform" jdbcType="INTEGER"/>
<result column="FORMURL" property="formurl" jdbcType="VARCHAR"/>
<result column="FORMDETAIL" property="formdetail" jdbcType="VARCHAR"/>
<result column="FORMTYPE" property="formtype" jdbcType="VARCHAR"/>
<result column="PROCESSDEFINITIONID" property="processdefinitionid" jdbcType="VARCHAR"/>
<result column="TYPEDEPT" property="typedept" jdbcType="INTEGER"/>
<result column="CATEGORY" property="category" jdbcType="VARCHAR"/>
<collection property="listchilddept" select="selectChildDeptEnabled" javaType="java.util.ArrayList" column="{id=id}"/>
</resultMap>
<sql id="Base_Column_List">
ID AS id,
DEPTNO AS deptno,
DEPARTSHOTNAME AS departshotname,
DEPARTNAME AS departname,
PARENTID AS parentid,
DEPARTROOT AS departroot,
DLEVEL AS dlevel,
DEPARTDESC AS departdesc,
ENABLED AS enabled,
SORTING AS sorting,
DEPARTADDRESS AS departaddress,
LOGO AS logo,
SOURCEPATH AS sourcepath,
COPYRIGHT AS copyright,
RECORDNUMBER AS recordnumber,
INDEXTEMPLET AS indextemplet,
KEYWORDS AS keywords,
DESCRIPTION AS description,
LONGIDUTE AS longidute,
LATITUDE AS latitude,
CREATEUSER AS createuser,
CREATEDATE AS createdate,
UPDATEUSER AS updateuser,
UPDATETIME AS updatetime,
SERVICENAME AS servicename,
BUILTFORM AS builtform,
FORMURL AS formurl,
FORMDETAIL AS formdetail,
FORMTYPE AS formtype,
PROCESSDEFINITIONID AS processdefinitionid,
TYPEDEPT AS typedept,
CATEGORY AS category
</sql>
<sql id="Base_Where">
<where>
<trim prefixOverrides="and|or">
<if test="id != null"> and ID ${id.dataOp} ${id.likestar}#{id.value}${id.likeend}</if>
<if test="deptno != null"> and DEPTNO ${deptno.dataOp} ${deptno.likestar}#{deptno.value}${deptno.likeend}</if>
<if test="departshotname != null"> and DEPARTSHOTNAME ${departshotname.dataOp} ${departshotname.likestar}#{departshotname.value}${departshotname.likeend}</if>
<if test="departname != null"> and DEPARTNAME ${departname.dataOp} ${departname.likestar}#{departname.value}${departname.likeend}</if>
<if test="parentid != null"> and PARENTID ${parentid.dataOp} ${parentid.likestar}#{parentid.value}${parentid.likeend}</if>
<if test="departroot != null"> and DEPARTROOT ${departroot.dataOp} ${departroot.likestar}#{departroot.value}${departroot.likeend}</if>
<if test="dlevel != null"> and DLEVEL ${dlevel.dataOp} ${dlevel.likestar}#{dlevel.value}${dlevel.likeend}</if>
<if test="departdesc != null"> and DEPARTDESC ${departdesc.dataOp} ${departdesc.likestar}#{departdesc.value}${departdesc.likeend}</if>
<if test="enabled != null"> and ENABLED ${enabled.dataOp} ${enabled.likestar}#{enabled.value}${enabled.likeend}</if>
<if test="sorting != null"> and SORTING ${sorting.dataOp} ${sorting.likestar}#{sorting.value}${sorting.likeend}</if>
<if test="departaddress != null"> and DEPARTADDRESS ${departaddress.dataOp} ${departaddress.likestar}#{departaddress.value}${departaddress.likeend}</if>
<if test="logo != null"> and LOGO ${logo.dataOp} ${logo.likestar}#{logo.value}${logo.likeend}</if>
<if test="sourcepath != null"> and SOURCEPATH ${sourcepath.dataOp} ${sourcepath.likestar}#{sourcepath.value}${sourcepath.likeend}</if>
<if test="copyright != null"> and COPYRIGHT ${copyright.dataOp} ${copyright.likestar}#{copyright.value}${copyright.likeend}</if>
<if test="recordnumber != null"> and RECORDNUMBER ${recordnumber.dataOp} ${recordnumber.likestar}#{recordnumber.value}${recordnumber.likeend}</if>
<if test="indextemplet != null"> and INDEXTEMPLET ${indextemplet.dataOp} ${indextemplet.likestar}#{indextemplet.value}${indextemplet.likeend}</if>
<if test="keywords != null"> and KEYWORDS ${keywords.dataOp} ${keywords.likestar}#{keywords.value}${keywords.likeend}</if>
<if test="description != null"> and DESCRIPTION ${description.dataOp} ${description.likestar}#{description.value}${description.likeend}</if>
<if test="longidute != null"> and LONGIDUTE ${longidute.dataOp} ${longidute.likestar}#{longidute.value}${longidute.likeend}</if>
<if test="latitude != null"> and LATITUDE ${latitude.dataOp} ${latitude.likestar}#{latitude.value}${latitude.likeend}</if>
<if test="createuser != null"> and CREATEUSER ${createuser.dataOp} ${createuser.likestar}#{createuser.value}${createuser.likeend}</if>
<if test="createdate != null"> and CREATEDATE ${createdate.dataOp} ${createdate.likestar}#{createdate.value}${createdate.likeend}</if>
<if test="updateuser != null"> and UPDATEUSER ${updateuser.dataOp} ${updateuser.likestar}#{updateuser.value}${updateuser.likeend}</if>
<if test="updatetime != null"> and UPDATETIME ${updatetime.dataOp} ${updatetime.likestar}#{updatetime.value}${updatetime.likeend}</if>
<if test="servicename != null"> and SERVICENAME ${servicename.dataOp} ${servicename.likestar}#{servicename.value}${servicename.likeend}</if>
<if test="builtform != null"> and BUILTFORM ${builtform.dataOp} ${builtform.likestar}#{builtform.value}${builtform.likeend}</if>
<if test="formurl != null"> and FORMURL ${formurl.dataOp} ${formurl.likestar}#{formurl.value}${formurl.likeend}</if>
<if test="formdetail != null"> and FORMDETAIL ${formdetail.dataOp} ${formdetail.likestar}#{formdetail.value}${formdetail.likeend}</if>
<if test="formtype != null"> and FORMTYPE ${formtype.dataOp} ${formtype.likestar}#{formtype.value}${formtype.likeend}</if>
<if test="processdefinitionid != null"> and PROCESSDEFINITIONID ${processdefinitionid.dataOp} ${processdefinitionid.likestar}#{processdefinitionid.value}${processdefinitionid.likeend}</if>
<if test="typedept != null"> and TYPEDEPT ${typedept.dataOp} ${typedept.likestar}#{typedept.value}${typedept.likeend}</if>
<if test="category != null"> and CATEGORY ${category.dataOp} ${category.likestar}#{category.value}${category.likeend}</if>
<if test="userid != null"> and USERID ${userid.dataOp} ${userid.likestar}#{userid.value}${userid.likeend}</if>
<if test="listdept != null">
and DEPARTID in
<foreach collection="listdept.value" item="item" index="index" open="(" separator="," close=")" >
#{item}
</foreach>
</if>
</trim>
</where>
<if test="page != null">
<if test="page.sortname != null"> order by ${page.sortname} ${page.sortorder}</if>
limit ${page.start}, ${page.Pagesize}
</if>
</sql>
<!-- 查询机构子集的机构信息 end-->
<select id="selectDepartIdByRoleid" resultType="java.lang.Long" parameterType="java.lang.Long">
select DISTINCT d.ID from S_DEPARTMENT_T d
<if test="rolesid != null">
RIGHT JOIN S_ROLESDEPTID_T rd ON ROLESID = #{rolesid} AND rd.DEPTID = d.ID
</if>
</select>
<select id="selectDepartList" resultType="cn.jyjz.xiaoyao.admin.vo.DepartmentVo" parameterType="java.util.Map">
select
ID AS id,
DEPARTNAME AS name,
PARENTID AS pId
from S_DEPARTMENT_T WHERE 1=1
<if test="enabled != null"> and ENABLED ${enabled.dataOp} ${enabled.likestar}#{enabled.value}${enabled.likeend}</if>
<if test="parentid != null"> and PARENTID ${parentid.dataOp} ${parentid.likestar}#{parentid.value}${parentid.likeend}</if>
<if test="listdept != null">
and ID IN
<foreach collection="listdept.value" item="item" index="index" open="(" separator="," close=")" >
#{item}
</foreach>
</if>
<if test="createuser != null"> and CREATEUSER ${createuser.dataOp} ${createuser.likestar}#{createuser.value}${createuser.likeend}</if>
ORDER BY SORTING DESC
</select>
<select id="selectDepartVoById" resultType="cn.jyjz.xiaoyao.admin.vo.DepartmentVo" parameterType="java.lang.Long">
select
ID AS id,
DEPARTNAME AS name,
PARENTID AS pId
from S_DEPARTMENT_T WHERE ID = #{id}
</select>
<select id="selectRootidById" resultMap="BaseResultMap_only" parameterType="java.lang.Long">
select d.* from S_DEPARTMENT_T d
RIGHT JOIN S_DEPARTMENTCHILD_T dc ON dc.CHILDID =#{childid} AND dc.PARENTID = d.ID
WHERE d.PARENTID = '0';
</select>
<!-- 根据用户主键查询所属机构集合 start-->
<select id="selectDeptByUserid" resultType="cn.jyjz.xiaoyao.admin.dataobject.Department" parameterType="java.lang.Long">
select
d.ID AS id,
d.DEPTNO AS deptno,
d.DEPARTSHOTNAME AS departshotname,
d.DEPARTNAME AS departname,
d.PARENTID AS parentid,
d.DEPARTROOT AS departroot,
d.DLEVEL AS dlevel,
d.DEPARTDESC AS departdesc,
d.ENABLED AS enabled,
d.SORTING AS sorting,
d.DEPARTADDRESS AS departaddress,
d.LOGO AS logo,
d.SOURCEPATH AS sourcepath,
d.COPYRIGHT AS copyright,
d.RECORDNUMBER AS recordnumber,
d.INDEXTEMPLET AS indextemplet,
d.KEYWORDS AS keywords,
d.DESCRIPTION AS description,
d.LONGIDUTE AS longidute,
d.LATITUDE AS latitude,
d.CREATEUSER AS createuser,
d.CREATEDATE AS createdate,
d.UPDATEUSER AS updateuser,
d.UPDATETIME AS updatetime,
d.SERVICENAME AS servicename,
d.BUILTFORM AS builtform,
d.FORMURL AS formurl,
d.FORMDETAIL AS formdetail,
d.FORMTYPE AS formtype,
d.PROCESSDEFINITIONID AS processdefinitionid,
d.TYPEDEPT AS typedept,
d.CATEGORY AS category
from S_DEPARTMENT_T d,S_USEROBJECT_T uo where uo.DEPARTID=d.ID and uo.USERID=#{id}
</select>
<!-- 查询机构启用的子集的机构信息 start-->
<select id="selectChildDeptEnabled" parameterType="java.util.Map" resultType="cn.jyjz.xiaoyao.admin.dataobject.Department">
select
dm.ID AS id,
dm.DEPTNO AS deptno,
dm.DEPARTSHOTNAME AS departshotname,
dm.DEPARTNAME AS departname,
dm.PARENTID AS parentid,
dm.DEPARTROOT AS departroot,
dm.DLEVEL AS dlevel,
dm.DEPARTDESC AS departdesc,
dm.ENABLED AS enabled,
dm.SORTING AS sorting,
dm.DEPARTADDRESS AS departaddress,
dm.LOGO AS logo,
dm.SOURCEPATH AS sourcepath,
dm.COPYRIGHT AS copyright,
dm.RECORDNUMBER AS recordnumber,
dm.INDEXTEMPLET AS indextemplet,
dm.KEYWORDS AS keywords,
dm.DESCRIPTION AS description,
dm.LONGIDUTE AS longidute,
dm.LATITUDE AS latitude,
dm.CREATEUSER AS createuser,
dm.CREATEDATE AS createdate,
dm.UPDATEUSER AS updateuser,
dm.UPDATETIME AS updatetime,
dm.SERVICENAME AS servicename,
dm.BUILTFORM AS builtform,
dm.FORMURL AS formurl,
dm.FORMDETAIL AS formdetail,
dm.FORMTYPE AS formtype,
dm.PROCESSDEFINITIONID AS processdefinitionid,
dm.TYPEDEPT AS typedept,
dm.CATEGORY AS category
from S_DEPARTMENT_T dm,S_DEPARTMENTCHILD_T dmc where dm.ID = dmc.CHILDID and dmc.PARENTID = #{id} ORDER BY dm.SORTING DESC
</select>
</mapper>