Commit ca86ba05 authored by chenhao's avatar chenhao

修改excle导出时的关系字段逻辑错误的问题

parent 19739748
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper <mapper
namespace="com.yeejoin.amos.boot.module.common.api.mapper.FirefightersMapper"> namespace="com.yeejoin.amos.boot.module.common.api.mapper.FirefightersMapper">
<select id="getFirefightersJobTitleCount" resultType="com.yeejoin.amos.boot.biz.common.utils.FirefightersTreeDto"> <select id="getFirefightersJobTitleCount"
select COUNT(a.sequence_nbr) num, a.job_title_code jobTitleCode resultType="com.yeejoin.amos.boot.biz.common.utils.FirefightersTreeDto">
from cb_firefighters a select COUNT(a.sequence_nbr) num, a.job_title_code jobTitleCode
where a.is_delete = 0 from cb_firefighters a
GROUP BY a.job_title_code where a.is_delete = 0
</select> GROUP BY a.job_title_code
<!--消防队员列表按时间倒叙排列add desc 2021-09-08 by kongfm --> </select>
<select id="getFirefighters" <!--消防队员列表按时间倒叙排列add desc 2021-09-08 by kongfm -->
resultType="com.yeejoin.amos.boot.module.common.api.dto.FirefightersZhDto"> <select id="getFirefighters"
select a.*,b.areas_expertise areasExpertise ,b.areas_expertise_code areasExpertiseCode from cb_firefighters a LEFT JOIN cb_firefighters_post b on resultType="com.yeejoin.amos.boot.module.common.api.dto.FirefightersZhDto">
a.sequence_nbr=b.firefighters_id where a.is_delete=0 select a.*,b.areas_expertise areasExpertise ,b.areas_expertise_code
<if test='par.postQualification!=null'>and b.post_qualification_code = #{par.postQualification}</if> areasExpertiseCode from cb_firefighters a LEFT JOIN
<if test='par.areasExpertise!=null'>and b.areas_expertise_code= #{par.areasExpertise}</if> cb_firefighters_post b on
<if test='par.name!=null'>and a.name like concat ('%',#{par.name},'%')</if> a.sequence_nbr=b.firefighters_id where a.is_delete=0
<if test='par.state!=null'>and a.state_code= #{par.state}</if> <if test='par.postQualification!=null'>and b.post_qualification_code = #{par.postQualification}</if>
<if test='par.fireTeamId!=null'>and a.fire_team_id= #{par.fireTeamId}</if> <if test='par.areasExpertise!=null'>and b.areas_expertise_code= #{par.areasExpertise}</if>
<if test='par.jobTitle!=null'>and a.job_title_code =#{par.jobTitle}</if> <if test='par.name!=null'>and a.name like concat ('%',#{par.name},'%')</if>
<if test='par.areasExpertiseCode!=null and par.areasExpertiseCode!="0"'>and b.areas_expertise_code =#{par.areasExpertiseCode}</if> <if test='par.state!=null'>and a.state_code= #{par.state}</if>
<if test='par.areasExpertiseCode=="0"'>and b.areas_expertise_code is not null</if> <if test='par.fireTeamId!=null'>and a.fire_team_id= #{par.fireTeamId}</if>
ORDER BY a.rec_date desc limit #{pageNum},#{pageSize} <if test='par.jobTitle!=null'>and a.job_title_code =#{par.jobTitle}</if>
</select> <if
<!--消防队员列表按时间倒叙排列add desc 2021-09-08 by kongfm --> test='par.areasExpertiseCode!=null and par.areasExpertiseCode!="0"'>and b.areas_expertise_code =#{par.areasExpertiseCode}</if>
<select id="getFirefightersCount" resultType="Map"> <if test='par.areasExpertiseCode=="0"'>and b.areas_expertise_code is not null</if>
select COUNT(a.sequence_nbr) num from cb_firefighters a LEFT JOIN ORDER BY a.rec_date desc limit #{pageNum},#{pageSize}
cb_firefighters_post b on a.sequence_nbr=b.firefighters_id where </select>
a.is_delete=0 <!--消防队员列表按时间倒叙排列add desc 2021-09-08 by kongfm -->
<if test='par.postQualification!=null'>and b.post_qualification_code = #{par.postQualification}</if> <select id="getFirefightersCount" resultType="Map">
<if test='par.areasExpertise!=null'>and b.areas_expertise_code= #{par.areasExpertise}</if> select COUNT(a.sequence_nbr) num from cb_firefighters a LEFT JOIN
<if test='par.name!=null'>and a.name like concat ('%',#{par.name},'%')</if> cb_firefighters_post b on a.sequence_nbr=b.firefighters_id where
<if test='par.state!=null'>and a.state_code= #{par.state}</if> a.is_delete=0
<if test='par.fireTeamId!=null'>and a.fire_team_id= #{par.fireTeamId}</if> <if test='par.postQualification!=null'>and b.post_qualification_code = #{par.postQualification}</if>
<if test='par.jobTitle!=null'>and a.job_title_code =#{par.jobTitle}</if> <if test='par.areasExpertise!=null'>and b.areas_expertise_code= #{par.areasExpertise}</if>
<if test='par.areasExpertiseCode!=null and par.areasExpertiseCode!="0"'>and b.areas_expertise_code =#{par.areasExpertiseCode}</if> <if test='par.name!=null'>and a.name like concat ('%',#{par.name},'%')</if>
<if test='par.areasExpertiseCode=="0"'>and b.areas_expertise_code is not null</if> <if test='par.state!=null'>and a.state_code= #{par.state}</if>
<if test='par.fireTeamId!=null'>and a.fire_team_id= #{par.fireTeamId}</if>
<if test='par.jobTitle!=null'>and a.job_title_code =#{par.jobTitle}</if>
<if
test='par.areasExpertiseCode!=null and par.areasExpertiseCode!="0"'>and b.areas_expertise_code =#{par.areasExpertiseCode}</if>
<if test='par.areasExpertiseCode=="0"'>and b.areas_expertise_code is not null</if>
ORDER BY a.rec_date desc ORDER BY a.rec_date desc
</select> </select>
<select id="listToSelectById" resultType="Map"> <select id="listToSelectById" resultType="Map">
SELECT IFNULL(a.personnel_photos, '') personnelPhotos, SELECT IFNULL(a.personnel_photos, '') personnelPhotos,
a.sequence_nbr a.sequence_nbr
sequenceNbr, sequenceNbr,
IFNULL(a.`name`, '无') `name`, IFNULL(a.`name`, '无') `name`,
IFNULL(a.job_title, '无') IFNULL(a.job_title, '无')
jobTitle, jobTitle,
IFNULL(b.administrative_position, '无') IFNULL(b.administrative_position, '无')
administrativePosition, administrativePosition,
IFNULL(c.`name`, '无') fireTeamName, IFNULL(c.`name`, '无') fireTeamName,
IFNULL(a.state, '无') state, IFNULL(a.state, '无') state,
IFNULL(b.employee_hierarchy, '无') IFNULL(b.employee_hierarchy, '无')
employeeHierarchy, employeeHierarchy,
IFNULL(b.areas_expertise, '无') areasExpertise, IFNULL(b.areas_expertise, '无') areasExpertise,
IFNULL(a.gender, '无') gender, IFNULL(a.gender, '无') gender,
IFNULL(b.post_qualification, '无') IFNULL(b.post_qualification, '无')
postQualification, year ( from_days( datediff( now( ), postQualification, year ( from_days( datediff( now( ),
a.birthday_time))) age a.birthday_time))) age
FROM cb_firefighters a LEFT JOIN cb_firefighters_post b FROM cb_firefighters a LEFT JOIN cb_firefighters_post b
ON a.sequence_nbr ON a.sequence_nbr
= b.firefighters_id LEFT JOIN cb_fire_team c on = b.firefighters_id LEFT JOIN cb_fire_team c on
c.sequence_nbr=a.fire_team_id c.sequence_nbr=a.fire_team_id
WHERE a.is_delete =0 WHERE a.is_delete =0
and a.sequence_nbr=#{id} and a.sequence_nbr=#{id}
</select> </select>
<!-- BUG3553 BY kongfm 人员关系显示汉字--> <!-- BUG3553 BY kongfm 人员关系显示汉字 -->
<select id="exportToExcel" resultType="com.yeejoin.amos.boot.module.common.api.dto.FirefightersExcelDto"> <select id="exportToExcel"
select f.*, resultType="com.yeejoin.amos.boot.module.common.api.dto.FirefightersExcelDto">
(select cb_fire_team.name from cb_fire_team where cb_fire_team.sequence_nbr=f.fire_team_id) fireTeam, SELECT
emergency_contact, (select da.name from cb_data_dictionary da where da.code = fc.relationship) as relationship , emergency_contact_phone f.*,
from cb_firefighters f ( SELECT cb_fire_team.NAME FROM cb_fire_team WHERE
left join cb_firefighters_contacts fc on f.sequence_nbr = fc.firefighters_id cb_fire_team.sequence_nbr = f.fire_team_id ) fireTeam,
where f.is_delete = #{isDelete} emergency_contact,
</select> da.NAME AS relationship,
emergency_contact_phone
FROM
cb_firefighters f
LEFT JOIN cb_firefighters_contacts fc ON f.sequence_nbr =
fc.firefighters_id
left join cb_data_dictionary da on da.CODE = fc.relationship
where f.is_delete = #{isDelete}
</select>
</mapper> </mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment