Commit 89ba96b3 authored by tangwei's avatar tangwei

注解查询改为 mapper 文件查询

parent b9eeaab4
...@@ -24,32 +24,32 @@ public interface FirefightersMapper extends BaseMapper<Firefighters> { ...@@ -24,32 +24,32 @@ public interface FirefightersMapper extends BaseMapper<Firefighters> {
* 消防人员首页列表 * 消防人员首页列表
* *
***/ ***/
@Select("<script>" //@Select("<script>"
+ "select a.* from cb_firefighters a LEFT JOIN cb_firefighters_post b on a.sequence_nbr=b.firefighters_id where a.is_delete=0 " //+ "select a.* from cb_firefighters a LEFT JOIN cb_firefighters_post b on a.sequence_nbr=b.firefighters_id where a.is_delete=0 "
+ "<if test='par.postQualification!=null'>" + "and b.post_qualification_code = #{par.postQualification}" + "</if>" //+ "<if test='par.postQualification!=null'>" + "and b.post_qualification_code = #{par.postQualification}" + "</if>"
+ "<if test='par.areasExpertise!=null'>" + "and b.areas_expertise_code= #{par.areasExpertise}" + "</if>" //+ "<if test='par.areasExpertise!=null'>" + "and b.areas_expertise_code= #{par.areasExpertise}" + "</if>"
+ "<if test='par.name!=null'>" + "and a.name= #{par.name}" + "</if>" //+ "<if test='par.name!=null'>" + "and a.name= #{par.name}" + "</if>"
+ "<if test='par.state!=null'>" + "and a.state_code= #{par.state}" + "</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.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.jobTitle!=null'>" + "and a.job_title_code =#{par.jobTitle}" + "</if>"
+" limit #{pageNum},#{pageSize}" //+" limit #{pageNum},#{pageSize}"
+ "</script>") //+ "</script>")
List<Firefighters>getFirefighters(@Param("pageNum")int pageNum,@Param("pageSize")int pageSize,@Param("par")FirefightersDto par); List<Firefighters>getFirefighters(@Param("pageNum")int pageNum,@Param("pageSize")int pageSize,@Param("par")FirefightersDto par);
@Select("<script>" //@Select("<script>"
+ "select COUNT(a.sequence_nbr) num from cb_firefighters a LEFT JOIN cb_firefighters_post b on a.sequence_nbr=b.firefighters_id where a.is_delete=0 " //+ "select COUNT(a.sequence_nbr) num from cb_firefighters a LEFT JOIN cb_firefighters_post b on a.sequence_nbr=b.firefighters_id where a.is_delete=0 "
+ "<if test='par.postQualification!=null'>" + "and b.post_qualification_code = #{par.postQualification}" + "</if>" //+ "<if test='par.postQualification!=null'>" + "and b.post_qualification_code = #{par.postQualification}" + "</if>"
+ "<if test='par.areasExpertise!=null'>" + "and b.areas_expertise_code= #{par.areasExpertise}" + "</if>" //+ "<if test='par.areasExpertise!=null'>" + "and b.areas_expertise_code= #{par.areasExpertise}" + "</if>"
+ "<if test='par.name!=null'>" + "and a.name= #{par.name}" + "</if>" //+ "<if test='par.name!=null'>" + "and a.name= #{par.name}" + "</if>"
+ "<if test='par.state!=null'>" + "and a.state_code= #{par.state}" + "</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.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.jobTitle!=null'>" + "and a.job_title_code= #{par.jobTitle}" + "</if>"
+ "</script>") //+ "</script>")
Map<String, Long>getFirefightersCount(@Param("pageNum")int pageNum,@Param("pageSize")int pageSize,@Param("par")FirefightersDto par); Map<String, Long>getFirefightersCount(@Param("pageNum")int pageNum,@Param("pageSize")int pageSize,@Param("par")FirefightersDto par);
@Select("<script>" //@Select("<script>"
+ "SELECT IFNULL(a.personnel_photos,'') personnelPhotos, a.sequence_nbr sequenceNbr,IFNULL(a.`name`,'无')`name`, IFNULL(a.job_title,'无') jobTitle, IFNULL(b.administrative_position,'无') administrativePosition, IFNULL(c.`name`,'无') fireTeamName, IFNULL(a.state,'无') state, IFNULL(b.employee_hierarchy,'无') employeeHierarchy, IFNULL(b.areas_expertise,'无') areasExpertise, IFNULL(a.gender,'无') gender, IFNULL(b.post_qualification,'无') postQualification,year( from_days( datediff( now( ), a.birthday_time))) age " //+ "SELECT IFNULL(a.personnel_photos,'') personnelPhotos, a.sequence_nbr sequenceNbr,IFNULL(a.`name`,'无')`name`, IFNULL(a.job_title,'无') jobTitle, IFNULL(b.administrative_position,'无') administrativePosition, IFNULL(c.`name`,'无') fireTeamName, IFNULL(a.state,'无') state, IFNULL(b.employee_hierarchy,'无') employeeHierarchy, IFNULL(b.areas_expertise,'无') areasExpertise, IFNULL(a.gender,'无') gender, IFNULL(b.post_qualification,'无') postQualification,year( from_days( datediff( now( ), a.birthday_time))) age "
+ " FROM cb_firefighters a LEFT JOIN cb_firefighters_post b ON a.sequence_nbr = b.firefighters_id LEFT JOIN cb_fire_team c on c.sequence_nbr=a.fire_team_id WHERE a.is_delete =0" //+ " FROM cb_firefighters a LEFT JOIN cb_firefighters_post b ON a.sequence_nbr = b.firefighters_id LEFT JOIN cb_fire_team c on c.sequence_nbr=a.fire_team_id WHERE a.is_delete =0"
+" and a.sequence_nbr=#{id}" //+" and a.sequence_nbr=#{id}"
+ "</script>") //+ "</script>")
Map<String, Object> listToSelectById(@Param("id")Long id); Map<String, Object> listToSelectById(@Param("id")Long id);
} }
<?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 namespace="com.yeejoin.amos.boot.module.jcs.api.mapper.FirefightersMapper"> <mapper
namespace="com.yeejoin.amos.boot.module.jcs.api.mapper.FirefightersMapper">
<select id="getFirefighters"
resultType="com.yeejoin.amos.boot.module.jcs.api.entity.Firefighters">
select a.* from cb_firefighters a LEFT JOIN cb_firefighters_post b on
a.sequence_nbr=b.firefighters_id where a.is_delete=0
<if test='par.postQualification!=null'>and b.post_qualification_code = #{par.postQualification} </if>
<if test='par.areasExpertise!=null'>and b.areas_expertise_code= #{par.areasExpertise}" </if>
<if test='par.name!=null'>and a.name= #{par.name}</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>
limit #{pageNum},#{pageSize}
</select>
<select id="getFirefightersCount" resultType="Map">
select COUNT(a.sequence_nbr) num from cb_firefighters a LEFT JOIN
cb_firefighters_post b on a.sequence_nbr=b.firefighters_id where
a.is_delete=0
<if test='par.postQualification!=null'>and b.post_qualification_code = #{par.postQualification} </if>
<if test='par.areasExpertise!=null'>and b.areas_expertise_code= #{par.areasExpertise}" </if>
<if test='par.name!=null'>and a.name= #{par.name}</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>
</select>
<select id="listToSelectById" resultType="Map">
SELECT IFNULL(a.personnel_photos,'') personnelPhotos, a.sequence_nbr
sequenceNbr,IFNULL(a.`name`,'无')`name`, IFNULL(a.job_title,'无')
jobTitle, IFNULL(b.administrative_position,'无')
administrativePosition, IFNULL(c.`name`,'无') fireTeamName,
IFNULL(a.state,'无') state, IFNULL(b.employee_hierarchy,'无')
employeeHierarchy, IFNULL(b.areas_expertise,'无') areasExpertise,
IFNULL(a.gender,'无') gender, IFNULL(b.post_qualification,'无')
postQualification,year( from_days( datediff( now( ),
a.birthday_time))) age
FROM cb_firefighters a LEFT JOIN cb_firefighters_post b ON a.sequence_nbr
= b.firefighters_id LEFT JOIN cb_fire_team c on
c.sequence_nbr=a.fire_team_id WHERE a.is_delete =0
and a.sequence_nbr=#{id}
</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