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/resource/ResourceMapper.xml

128 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.resource.ResourceMapper">
<resultMap id="HrmResourceMap" type="com.engine.organization.entity.hrmresource.po.HrmResourcePO">
<result column="id" property="id"/>
<result column="last_name" property="lastName"/>
<result column="sex" property="sex"/>
<result column="account_type" property="accountType"/>
<result column="belong_to" property="belongTo"/>
<result column="company_id" property="companyId"/>
<result column="department_id" property="departmentId"/>
<result column="job_activity" property="jobActivity"/>
<result column="job_title" property="jobTitle"/>
<result column="job_level" property="jobLevel"/>
<result column="job_group_id" property="jobGroupId"/>
<result column="job_activity_desc" property="jobActivityDesc"/>
<result column="status" property="status"/>
<result column="resource_image_id" property="resourceImageId"/>
<result column="location_id" property="locationId"/>
<result column="mobile" property="mobile"/>
<result column="telephone" property="telephone"/>
<result column="email" property="email"/>
<result column="company_start_date" property="companyStartDate"/>
<result column="work_start_date" property="workStartDate"/>
<result column="show_order" property="showOrder"/>
<result column="ec_department" property="ecDepartment"/>
<result column="ec_company" property="ecCompany"/>
<result column="uuid" property="uuid"/>
<result column="job_grade" property="jobGrade"/>
<result column="scheme_id" property="schemeId"/>
<result column="sequence_id" property="sequenceId"/>
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
t.id,t.work_code,t.last_name,t.sex,t.status,t.account_type,
t.belong_to,t.ec_company,t.job_title,t.ec_department,t.
scheme_id,t.sequence_id,t.job_grade,t.job_level,t.job_group_id,
t.job_activity,t.location_id,t.show_order,t.company_start_date,
t.work_start_date,t.job_activity_desc,t.resource_image_id,t.mobile,
t.telephone,t.email,t.uuid
</sql>
<update id="updateResourceJob">
update jcl_org_hrmresource
<set>
job_title = #{targetJobId},
company_id = #{parentComp},
department_id = #{parentDept},
ec_company = #{ecCompany},
ec_department = #{ecDepartment},
</set>
where delete_type = 0 and job_title =#{originalJobId}
</update>
<select id="listAll" resultType="com.engine.organization.entity.hrmresource.vo.HrmResourceVO">
SELECT t.last_name as lastName,d.dept_name as departmentName,
c.comp_name as companyName,t.mobile,t.telephone,t1.last_name as managerName
from jcl_org_hrmresource t
left join JCL_ORG_DEPT d on t.department_id = d.id
left join jcl_org_comp c on t.company_id = c.id
left join jcl_org_hrmresource t1 on t.manager_id = t1.id
where 1 = 1
<if test="ids != null and ids.size > 0">
AND t.id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
<!--<include refid="likeSql"/>-->
<!--<if test="param.departmentId != null and param.departmentId != ''">-->
<!--and t.department_id = #{param.departmentId}-->
<!--</if>-->
<!--<if test="param.companyId != null and param.companyId != ''">-->
<!--and t.company_id = #{param.companyId}-->
<!--</if>-->
<!--<if test="param.mobile != null and param.mobile != ''">-->
<!--and t.mobile = #{param.mobile}-->
<!--</if>-->
<!--<if test="param.telephone != null and param.telephone != ''">-->
<!--and t.telephone = #{param.telephone}-->
<!--</if>-->
<!--<if test="param.managerId != null and param.managerId != ''">-->
<!--and t.manager_id = #{param.managerId}-->
<!--</if>-->
<!--<if test="param.mobileCall != null and param.mobileCall != ''">-->
<!--and t.mobile_call = #{param.mobileCall}-->
<!--</if>-->
<!--<if test="param.jobTitle != null and param.jobTitle != ''">-->
<!--and t.job_title = #{param.jobTitle}-->
<!--</if>-->
order by t.id asc;
</select>
<select id="getResourceListByJobId"
resultMap="HrmResourceMap">
select
<include refid="baseColumns"/>
from jcl_org_hrmresource t where job_title = #{jobId}
</select>
<select id="getResourceById" resultType="com.engine.organization.entity.hrmresource.po.HrmResourcePO">
select
<include refid="baseColumns"/>
from jcl_org_hrmresource t where delete_type = 0 and id = #{id}
</select>
<select id="listByNo" resultMap="HrmResourceMap">
select
<include refid="baseColumns"/>
from jcl_org_hrmresource t where delete_type = 0 and work_code = #{workCode}
</select>
<sql id="likeSql">
<if test="param.lastName != null and param.lastName != ''">
AND t.last_name like CONCAT('%',#{param.lastName},'%')
</if>
</sql>
<sql id="likeSql" databaseId="oracle">
<if test="param.lastName != null and param.lastName != ''">
AND t.last_name like '%'||#{param.lastName}||'%'
</if>
</sql>
<sql id="likeSql" databaseId="sqlserver">
<if test="param.lastName != null and param.lastName != ''">
AND t.last_name like '%'+#{param.lastName}+'%'
</if>
</sql>
</mapper>