You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
weaver-hrm-organization/src/com/engine/organization/mapper/scheme/SchemeMapper.xml

175 lines
5.7 KiB
XML

<?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.engine.organization.mapper.scheme.SchemeMapper">
<resultMap id="BaseResultMap" type="com.engine.organization.entity.scheme.po.SchemePO">
<result column="id" property="id"/>
<result column="scheme_no" property="schemeNo"/>
<result column="scheme_name" property="schemeName"/>
<result column="scheme_description" property="schemeDescription"/>
<result column="forbidden_tag" property="forbiddenTag"/>
<result column="creator" property="creator"/>
<result column="delete_type" property="deleteType"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<resultMap id="TreeResultMap" type="com.engine.organization.entity.TreeData">
<result column="id" property="key"/>
<result column="scheme_name" property="title"/>
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
t
.
id
, t.scheme_no
, t.scheme_name
, t.scheme_description
, t.forbidden_tag
, t.creator
, t.delete_type
, t.create_time
, t.update_time
</sql>
<select id="listByNo" parameterType="com.engine.organization.entity.scheme.po.SchemePO" resultMap="BaseResultMap">
select
<include refid="baseColumns"/>
from jcl_org_scheme t where scheme_no = #{schemeNo} AND delete_type = 0
</select>
<select id="getSchemeByID" parameterType="com.engine.organization.entity.scheme.po.SchemePO"
resultMap="BaseResultMap">
select
<include refid="baseColumns"/>
from jcl_org_scheme t where id = #{id} AND delete_type = 0
</select>
<select id="listSchemesByIds" resultType="java.util.Map">
select
id,
scheme_name as name
from jcl_org_scheme t
WHERE delete_type = 0
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</select>
<select id="listUsedId" resultType="java.lang.String">
select scheme_id
from jcl_org_level
where delete_type = 0
union
select scheme_id
from jcl_org_grade
where delete_type = 0
union
select scheme_id
from JCL_ORG_SEQUENCE
where delete_type = 0
union
select scheme_id
from JCL_ORG_JOB
where delete_type = 0
</select>
<select id="getTreeData" resultMap="TreeResultMap">
select id, scheme_name
from jcl_org_scheme
where delete_type = '0'
</select>
<select id="getSchemesByIds" resultMap="BaseResultMap">
select
<include refid="baseColumns"/>
from jcl_org_scheme t
WHERE delete_type = 0
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</select>
<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.scheme.po.SchemePO" keyProperty="id"
keyColumn="id" useGeneratedKeys="true">
INSERT INTO jcl_org_scheme
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="creator != null">
creator,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="schemeNo != null ">
scheme_no,
</if>
<if test="schemeName != null ">
scheme_name,
</if>
<if test="schemeDescription != null ">
scheme_description,
</if>
forbidden_tag,
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="creator != null">
#{creator},
</if>
<if test="deleteType != null">
#{deleteType},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
<if test="schemeNo != null ">
#{schemeNo},
</if>
<if test="schemeName != null ">
#{schemeName},
</if>
<if test="schemeDescription != null ">
#{schemeDescription},
</if>
0,
</trim>
</insert>
<update id="updateScheme" parameterType="com.engine.organization.entity.scheme.po.SchemePO">
update jcl_org_scheme
<set>
creator=#{creator},
update_time=#{updateTime},
scheme_no=#{schemeNo},
scheme_name=#{schemeName},
scheme_description=#{schemeDescription},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<update id="updateForbiddenTagById" parameterType="com.engine.organization.entity.scheme.po.SchemePO">
update jcl_org_scheme
<set>
forbidden_tag=#{forbiddenTag},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<update id="deleteByIds">
UPDATE jcl_org_scheme
SET delete_type = 1
WHERE delete_type = 0
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</update>
</mapper>