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.
141 lines
7.3 KiB
141 lines
7.3 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="com.lnsoft.workflow.hxgk.mapper.PositionMapper">
|
|
|
|
<resultMap id="BaseResultMap" type="com.lnsoft.workflow.hxgk.entity.Position">
|
|
<id property="id" column="id" jdbcType="BIGINT"/>
|
|
<result property="number" column="number" jdbcType="VARCHAR"/>
|
|
<result property="name" column="name" jdbcType="VARCHAR"/>
|
|
<result property="duties" column="duties" jdbcType="BIGINT"/>
|
|
<result property="time" column="time" jdbcType="BIGINT"/>
|
|
<result property="state" column="state" jdbcType="TINYINT"/>
|
|
<result property="administrativeOrganization" column="administrative_organization" jdbcType="BIGINT"/>
|
|
<result property="superior" column="superior" jdbcType="BIGINT"/>
|
|
<result property="personInCharge" column="person_in_charge" jdbcType="TINYINT"/>
|
|
<result property="department" column="department" jdbcType="BIGINT"/>
|
|
<result property="menuPermit" column="menu_permit" jdbcType="VARCHAR"/>
|
|
<result property="buttonPermit" column="button_permit" jdbcType="VARCHAR"/>
|
|
<result property="school" column="school" jdbcType="BIGINT"/>
|
|
<result property="kingdeeid" column="kingdeeid" jdbcType="VARCHAR"/>
|
|
<result property="unifyId" column="unify_id" jdbcType="BIGINT"/>
|
|
<result property="orglist" column="orglist" jdbcType="VARCHAR"/>
|
|
<!-- collection实现一对多-->
|
|
<collection property="children" javaType="com.lnsoft.workflow.hxgk.entity.Position">
|
|
<id property="id" column="p2Id" jdbcType="BIGINT"/>
|
|
<result property="number" column="p2Number" jdbcType="VARCHAR"/>
|
|
<result property="name" column="p2Name" jdbcType="VARCHAR"/>
|
|
<result property="duties" column="p2Duties" jdbcType="BIGINT"/>
|
|
<result property="time" column="p2Time" jdbcType="BIGINT"/>
|
|
<result property="state" column="p2State" jdbcType="TINYINT"/>
|
|
<result property="administrativeOrganization" column="p2Administrative_organization" jdbcType="BIGINT"/>
|
|
<result property="superior" column="p2Superior" jdbcType="BIGINT"/>
|
|
<result property="personInCharge" column="p2Person_in_charge" jdbcType="TINYINT"/>
|
|
<result property="department" column="p2Department" jdbcType="BIGINT"/>
|
|
<result property="menuPermit" column="p2Menu_permit" jdbcType="VARCHAR"/>
|
|
<result property="buttonPermit" column="p2Button_permit" jdbcType="VARCHAR"/>
|
|
<result property="school" column="p2School" jdbcType="BIGINT"/>
|
|
<result property="kingdeeid" column="p2Kingdeeid" jdbcType="VARCHAR"/>
|
|
<result property="unifyId" column="p2Unify_id" jdbcType="BIGINT"/>
|
|
<result property="orglist" column="p2Orglist" jdbcType="VARCHAR"/>
|
|
</collection>
|
|
</resultMap>
|
|
|
|
<resultMap id="ResultMap" type="com.lnsoft.workflow.hxgk.entity.Position">
|
|
<id property="id" column="id" jdbcType="BIGINT"/>
|
|
<result property="number" column="number" jdbcType="VARCHAR"/>
|
|
<result property="name" column="name" jdbcType="VARCHAR"/>
|
|
<result property="duties" column="duties" jdbcType="BIGINT"/>
|
|
<result property="time" column="time" jdbcType="BIGINT"/>
|
|
<result property="state" column="state" jdbcType="TINYINT"/>
|
|
<result property="administrativeOrganization" column="administrative_organization" jdbcType="BIGINT"/>
|
|
<result property="superior" column="superior" jdbcType="BIGINT"/>
|
|
<result property="personInCharge" column="person_in_charge" jdbcType="TINYINT"/>
|
|
<result property="department" column="department" jdbcType="BIGINT"/>
|
|
<result property="menuPermit" column="menu_permit" jdbcType="VARCHAR"/>
|
|
<result property="buttonPermit" column="button_permit" jdbcType="VARCHAR"/>
|
|
<result property="school" column="school" jdbcType="BIGINT"/>
|
|
<result property="kingdeeid" column="kingdeeid" jdbcType="VARCHAR"/>
|
|
<result property="unifyId" column="unify_id" jdbcType="BIGINT"/>
|
|
<result property="orglist" column="orglist" jdbcType="VARCHAR"/>
|
|
<!-- collection嵌套select子查询实现一对多-->
|
|
<!-- <collection property="children" ofType="com.lnsoft.mmbdf.framework.api.domain.Position"-->
|
|
<!-- column="id" foreignColumn="superior" select="selectPositionBySuperior"/>-->
|
|
</resultMap>
|
|
|
|
<sql id="Base_Column_List">
|
|
id,number,name,
|
|
duties,time,state,
|
|
administrative_organization,superior,person_in_charge,
|
|
department,menu_permit,button_permit,
|
|
school,kingdeeid,unify_id,
|
|
orglist
|
|
</sql>
|
|
|
|
<select id="selectPositionBySuperior" resultType="com.lnsoft.workflow.hxgk.entity.Position">
|
|
select <include refid="Base_Column_List"/>
|
|
from position
|
|
where superior = #{id}
|
|
</select>
|
|
|
|
<select id="selectPositionByCondition" resultMap="ResultMap">
|
|
select
|
|
pos.id,pos.number,pos.name,
|
|
pos.duties,pos.time,pos.state,
|
|
pos.administrative_organization,pos.superior,pos.person_in_charge,
|
|
pos.department,pos.menu_permit,pos.button_permit,
|
|
pos.school,pos.kingdeeid,pos.unify_id,
|
|
pos.orglist
|
|
from position pos
|
|
left join administrative_organization org on pos.administrative_organization = org.id
|
|
<where>
|
|
<if test="id != null">
|
|
AND pos.id = #{id}
|
|
</if>
|
|
<if test="orgIds != null and orgIds != ''">
|
|
AND org.id in
|
|
<foreach collection="orgIds" item="orgId" separator="," open="(" close=")">
|
|
#{orgId}
|
|
</foreach>
|
|
</if>
|
|
<if test="number != null and number != ''">
|
|
AND `number` = #{number}
|
|
</if>
|
|
<if test="name != null and name != ''">
|
|
AND `name` like concat('%', #{name}, '%')
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
|
|
<select id="selectPosition" resultMap="BaseResultMap">
|
|
select
|
|
p1.id,p1.number,p1.name,
|
|
p1.duties,p1.time,p1.state,
|
|
p1.administrative_organization,p1.superior,p1.person_in_charge,
|
|
p1.department,p1.menu_permit,p1.button_permit,
|
|
p1.school,p1.kingdeeid,p1.unify_id,
|
|
p1.orglist,
|
|
p2.id p2Id,p2.number p2Number,p2.name p2Name,
|
|
p2.duties p2Duties,p2.time p2Time,p2.state p2State,
|
|
p2.administrative_organization p2Administrative_organization,p2.superior p2Superior,p2.person_in_charge p2Person_in_charge,
|
|
p2.department p2Department,p2.menu_permit p2Menu_permit,p2.button_permit p2Button_permit,
|
|
p2.school p2School,p2.kingdeeid p2Kingdeeid,p2.unify_id p2Unify_id,
|
|
p2.orglist p2Orglist
|
|
from position p1 left join position p2 on p1.id = p2.superior
|
|
<where>
|
|
<if test="id != null">
|
|
AND p1.id = #{id}
|
|
</if>
|
|
<if test="number != null and number != ''">
|
|
AND p1.`number` = #{number}
|
|
</if>
|
|
<if test="name != null and name != ''">
|
|
AND p1.`name` like concat('%', #{name}, '%')
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
|
|
</mapper>
|
|
|