<?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.dg.core.db.gen.mapper.OrganizationChartMapper">
|
|
<resultMap type="com.dg.core.db.gen.entity.OrganizationChartEntity" id="OrganizationChartResult">
|
<id property="id" column="id" />
|
<id property="organizationName" column="organization_name" />
|
<id property="city" column="city" />
|
<id property="district" column="district" />
|
<id property="village" column="village" />
|
<id property="detailedAddress" column="detailed_address" />
|
<id property="createTime" column="create_time" />
|
<id property="updateTime" column="update_time" />
|
<id property="parentId" column="parent_id" />
|
<id property="grade" column="grade" />
|
<id property="resume" column="resume" />
|
<id property="contactNumber" column="contact_number" />
|
<id property="departmentalApplication" column="departmental_application" />
|
<id property="updateUserId" column="update_user_id" />
|
<id property="areaList" column="area_list" />
|
|
</resultMap>
|
|
<sql id="selectOrganizationChartVo">
|
SELECT
|
id,
|
resume,
|
organization_name,
|
contact_number,
|
departmental_application,
|
create_time,
|
update_time,
|
parent_id,
|
update_user_id,
|
(select user_name from automessage_sys_user where user_id=automessage_organization_chart.update_user_id) as updateUserName,
|
(select organization_name from automessage_organization_chart as oc where oc.id=automessage_organization_chart.parent_id) as parentName,
|
city,
|
district,
|
village,
|
(select name from automessage_area_code_2022 where city=automessage_area_code_2022.code) as cityName,
|
(select name from automessage_area_code_2022 where district=automessage_area_code_2022.code) as districtName,
|
(select name from automessage_area_code_2022 where village=automessage_area_code_2022.code) as villageName,
|
detailed_address,
|
grade,
|
area_list
|
FROM
|
automessage_organization_chart
|
</sql>
|
|
<select id="selectConfigById" resultMap="OrganizationChartResult">
|
<include refid="selectOrganizationChartVo"/>
|
where id= #{id}
|
</select>
|
|
<select id="queryList" resultMap="OrganizationChartResult">
|
<include refid="selectOrganizationChartVo"/>
|
<where>
|
<if test="organizationName != null and organizationName != ''">
|
AND organization_name like concat('%', #{organizationName}, '%')
|
</if>
|
<if test="ids != null">
|
and id IN
|
<foreach collection="ids" item="param" open="(" close=")" separator=",">
|
#{param}
|
</foreach>
|
</if>
|
</where>
|
</select>
|
|
<select id="countList" resultType="integer">
|
select count(id) from automessage_organization_chart
|
<where>
|
<if test="organizationName != null and organizationName != ''">
|
AND organization_name like concat('%', #{organizationName}, '%')
|
</if>
|
<if test="ids != null">
|
and id IN
|
<foreach collection="ids" item="param" open="(" close=")" separator=",">
|
#{param}
|
</foreach>
|
</if>
|
</where>
|
</select>
|
|
<select id="selectConfigList" resultMap="OrganizationChartResult">
|
<include refid="selectOrganizationChartVo"/>
|
<where>
|
<if test="parentId != null and parentId != ''">
|
AND parent_id=#{parentId}
|
</if>
|
<if test="grade != null and grade != ''">
|
AND grade=#{grade}
|
</if>
|
<if test="ids != null">
|
and id IN
|
<foreach collection="ids" item="param" open="(" close=")" separator=",">
|
#{param}
|
</foreach>
|
</if>
|
</where>
|
</select>
|
|
<select id="selectByKeyWord" resultMap="OrganizationChartResult">
|
<include refid="selectOrganizationChartVo"/>
|
where grade=1 and ( organization_name like concat('%', #{keyWord}, '%')
|
or((detailed_address like concat('%', #{keyWord}, '%') ) and TRIM(detailed_address) !='')
|
or((resume like concat('%', #{keyWord}, '%') ) and TRIM(resume) != '' ))
|
</select>
|
|
<select id="selectByCode" resultMap="OrganizationChartResult">
|
<include refid="selectOrganizationChartVo"/>
|
<where>
|
( id=#{id} or parent_id=#{id}) and (city=#{areaCode} or district= #{areaCode} or village=#{areaCode}) and grade=#{grade}
|
</where>
|
order by grade
|
</select>
|
|
<insert id="insertConfig" parameterType="com.dg.core.db.gen.entity.OrganizationChartEntity">
|
insert into automessage_organization_chart (
|
<if test="id != null">id,</if>
|
<if test="organizationName != null and organizationName != '' ">organization_name,</if>
|
<if test="parentId != null">parent_id,</if>
|
<if test="city != null and city != '' ">city,</if>
|
<if test="district != null and district != '' ">district,</if>
|
<if test="village != null and village != '' ">village,</if>
|
<if test="detailedAddress != null and detailedAddress != '' ">detailed_address,</if>
|
<if test="grade != null and grade != '' ">grade,</if>
|
<if test="areaList != null and areaList != '' ">area_list,</if>
|
<if test="contactNumber != null and contactNumber != '' ">contact_number,</if>
|
<if test="departmentalApplication != null and departmentalApplication != '' ">departmental_application,</if>
|
<if test="updateUserId != null and updateUserId != '' ">update_user_id,</if>
|
<if test="resume != null and resume != '' ">resume,</if>
|
update_time,
|
create_time
|
)values(
|
<if test="id != null">#{id},</if>
|
<if test="organizationName != null and organizationName != '' ">#{organizationName},</if>
|
<if test="parentId != null">#{parentId},</if>
|
<if test="city != null and city != '' ">#{city},</if>
|
<if test="district != null and district != '' ">#{district},</if>
|
<if test="village != null and village != '' ">#{village},</if>
|
<if test="detailedAddress != null and detailedAddress != '' ">#{detailedAddress},</if>
|
<if test="grade != null and grade != '' ">#{grade},</if>
|
<if test="areaList != null and areaList != '' ">#{areaList},</if>
|
<if test="contactNumber != null and contactNumber != '' ">#{contactNumber},</if>
|
<if test="departmentalApplication != null and departmentalApplication != '' ">#{departmentalApplication},</if>
|
<if test="updateUserId != null and updateUserId != '' ">#{updateUserId},</if>
|
<if test="resume != null and resume != '' ">#{resume},</if>
|
sysdate(),
|
sysdate()
|
)
|
</insert>
|
|
<update id="updateConfig" parameterType="com.dg.core.db.gen.entity.OrganizationChartEntity">
|
update automessage_organization_chart
|
<set>
|
<if test="id != null">id=#{id},</if>
|
<if test="organizationName != null and organizationName != '' ">organization_name=#{organizationName},</if>
|
<if test="parentId != null">parent_id=#{parentId},</if>
|
<if test="city != null and city != '' ">city=#{city},</if>
|
<if test="district != null and district != '' ">district=#{district},</if>
|
<if test="village != null and village != '' ">village=#{village},</if>
|
<if test="detailedAddress != null and detailedAddress != '' ">detailed_address=#{detailedAddress},</if>
|
<if test="grade != null and grade != '' ">grade=#{grade},</if>
|
<if test="departmentalApplication != null and departmentalApplication != '' ">departmental_application=#{departmentalApplication},</if>
|
<if test="updateUserId != null">update_user_id=#{updateUserId},</if>
|
<if test="areaList != null and areaList != '' ">area_list=#{areaList},</if>
|
<if test="contactNumber != null and contactNumber != '' ">contact_number=#{contactNumber},</if>
|
<if test="departmentalApplication != null ">departmental_application=#{departmentalApplication},</if>
|
<if test="updateUserId != null and updateUserId != '' ">update_user_id=#{updateUserId},</if>
|
<if test="resume != null and resume != '' ">resume=#{resume},</if>
|
update_time=sysdate()
|
</set>
|
where id= #{id}
|
</update>
|
|
<delete id="deleteConfigById" parameterType="string">
|
delete from automessage_organization_chart where id= #{Id}
|
</delete>
|
|
<select id="countNum" resultType="integer">
|
select count(id) from automessage_organization_chart
|
</select>
|
|
</mapper>
|