大屏后端首页和工作台接口

This commit is contained in:
jjLv 2024-09-27 14:42:55 +08:00
parent 9f6f64f69b
commit 3029e5d868
17 changed files with 805 additions and 8 deletions

View File

@ -4,8 +4,8 @@ import com.bonus.base.config.DeviceTypeEnum;
import com.bonus.base.domain.TbDevice;
import com.bonus.screen.vo.DeviceViewVo;
import com.bonus.screen.vo.DeviceWarnRecordVo;
import com.bonus.screen.vo.TbBdDeviceRecordTwo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -68,6 +68,8 @@ public interface TbDeviceMapper {
DeviceViewVo getDeviceView();
DeviceViewVo getBdDeviceView();
DeviceViewVo getSensingDevice(DeviceTypeEnum baseSafetyHat,
DeviceTypeEnum baseEnvironmentMonitor,
DeviceTypeEnum basePitMonitor,
@ -83,4 +85,12 @@ public interface TbDeviceMapper {
* @return
*/
int getById(Long id);
}
/**
* 左侧物联边缘代理总设备详情
* @param bdData
* @return
*/
List<TbBdDeviceRecordTwo> getDeviceModelDataAll(TbBdDeviceRecordTwo bdData);
}

View File

@ -9,6 +9,7 @@ import com.bonus.screen.domain.ScreenDeskConfig;
import com.bonus.screen.service.ScreenDeskConfigService;
import com.bonus.screen.service.impl.ProjectViewServiceImpl;
import com.bonus.screen.vo.DeviceWarnRecordVo;
import com.bonus.screen.vo.WarnPredictionRecordVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

View File

@ -0,0 +1,177 @@
package com.bonus.screen.controller;
import com.bonus.base.domain.TbDevice;
import com.bonus.base.service.TbUserPostService;
import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.core.web.page.TableDataInfo;
import com.bonus.screen.service.ScreenDeskConfigService;
import com.bonus.screen.service.impl.ProjectViewServiceImpl;
import com.bonus.screen.vo.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* @author : 阮世耀
* @version : 1.0
* @model 工程模块by工作台
*/
@RestController
@RequestMapping("/screen/homeTwo")
public class ProjectViewTwoController extends BaseController {
@Autowired
private ProjectViewServiceImpl projectViewService;
@Resource
private TbUserPostService tbUserPostService;
@Resource
private ScreenDeskConfigService screenDeskConfigService;
/**
* 左侧物联边缘代理数量
* @return
*/
@GetMapping("/getDeviceModelDataAmount")
public AjaxResult getDeviceModelDataAmount() {
return success(projectViewService.getBdDeviceMapper());
}
/**
* 左侧物联边缘代理总设备详情/在线设备详情
* @return
*/
@GetMapping("/getDeviceModelDataAll")
public TableDataInfo getDeviceModelDataAll(TbBdDeviceRecordTwo bdData) {
startPage();
List<TbBdDeviceRecordTwo> list = projectViewService.getDeviceModelDataAll(bdData);
return getDataTable(list);
}
/**
* 安全隐患预测记录信息
* @param record
* @return
*/
@GetMapping("/getWarnPredictionRecord")
public AjaxResult getWarnPredictionRecord(WarnPredictionRecordVo record) {
return success(projectViewService.getWarnPredictionRecord(record));
}
/**
* 安全隐患预测记录所有信息
* @param record
* @return
*/
@GetMapping("/getWarnPredictionRecordAll")
public TableDataInfo getWarnPredictionRecordAll(WarnPredictionRecordVo record) {
startPage();
List<WarnPredictionRecordVo> list = projectViewService.getWarnPredictionRecord(record);
return getDataTable(list);
}
/**
* 施工记录数量
* @return
*/
@GetMapping("/getTeamDataAmount")
public AjaxResult getTeamDataAmount() {
return success(projectViewService.getTeamDataAmount());
}
/**
* 施工班组详情页
* @param record
* @return
*/
@GetMapping("/getTeamDetails")
public TableDataInfo getTeamDetails(TeamRecord record) {
startPage();
List<TeamRecord> list = projectViewService.getTeamDetails(record);
return getDataTable(list);
}
/**
* 施工人员详情页
* @param record
* @return
*/
@GetMapping("/getTeamPeopleDetails")
public TableDataInfo getTeamPeopleDetails(TeamRecord record) {
startPage();
List<TeamRecord> list = projectViewService.getTeamPeopleDetails(record);
return getDataTable(list);
}
/**
* 施工人员-班组骨干详情页
* @param record
* @return
*/
@GetMapping("/getTeamMasterDetails")
public TableDataInfo getTeamMasterDetails(TeamRecord record) {
startPage();
List<TeamRecord> list = projectViewService.getTeamMasterDetails(record);
return getDataTable(list);
}
/**
* 人员到岗到位页面
* @param record
* @return
*/
@GetMapping("/getUserPostDetails")
public AjaxResult getUserPostDetails(UserPost record) {
return success(projectViewService.getUserPostDetails(record));
}
/**
* 人员到岗到位所有页面
* @param record
* @return
*/
@GetMapping("/getUserPostDetailsAll")
public TableDataInfo getUserPostDetailsAl(UserPost record) {
startPage();
List<UserPost> list = projectViewService.getUserPostDetails(record);
return getDataTable(list);
}
// /**
// * 感知设备数量
// * @return
// */
// @GetMapping("/getSensingDeviceModelData")
// public AjaxResult getSensingDeviceModelData() {
// return success(projectViewService.getSensingDevice());
// }
// /**
// * 感知设备各部分详情页
// * @param tbDevice
// * @return
// */
// @GetMapping("/getDeviceModelDetailsPagePart")
// public TableDataInfo getDeviceModelDetailsPagePart(TbDevice tbDevice) {
// startPage();
// List<DeviceWarnRecordVo> list = projectViewService.getDeviceModelDetailsPage(tbDevice);
// return getDataTable(list);
// }
// /**
// * 左侧工程信息数量
// * @return
// */
// @GetMapping("/getProjectModelDataAll")
// public AjaxResult getProjectModelDataAll() {
// return success(projectViewService.getProjectView());
// }
}

View File

@ -3,6 +3,7 @@ package com.bonus.screen.mapper;
import com.bonus.base.domain.TbDevAttribute;
import com.bonus.data.entity.DevAttributeVo;
import com.bonus.screen.vo.DeviceWarnRecordVo;
import com.bonus.screen.vo.WarnPredictionRecordVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -21,6 +22,13 @@ public interface TbDeviceDataRecord {
List<Map<String,String>> queryDevInfoByProject(@Param("proId") Integer proId, @Param("devType") Integer devType);
/**
* 安全隐患预测记录信息
* @param record
* @return
*/
List<WarnPredictionRecordVo> getWarnPredictionRecord(WarnPredictionRecordVo record);
List<DeviceWarnRecordVo> getDeviceWarnRecord(DeviceWarnRecordVo deviceWarnRecordVo);
/**

View File

@ -0,0 +1,40 @@
package com.bonus.screen.mapper;
import com.bonus.screen.vo.TeamRecord;
import com.bonus.screen.vo.TeamRecordNum;
import com.bonus.screen.vo.WarnPredictionRecordVo;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface TeamRecordMapper {
/**
* 施工记录数量
* @return
*/
TeamRecordNum getTeamDataAmount();
/**
* 施工班组详情页
* @param record
* @return
*/
List<TeamRecord> getTeamDetails(TeamRecord record);
/**
* 施工人员详情页
* @param record
* @return
*/
List<TeamRecord> getTeamPeopleDetails(TeamRecord record);
/**
* 施工人员-班组骨干详情页
* @param record
* @return
*/
List<TeamRecord> getTeamMasterDetails(TeamRecord record);
}

View File

@ -0,0 +1,19 @@
package com.bonus.screen.mapper;
import com.bonus.screen.vo.TeamRecord;
import com.bonus.screen.vo.UserPost;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface UserPostMapper {
/**
* 人员到岗到位页面
* @param record
* @return
*/
List<UserPost> getUserPostDetails(UserPost record);
}

View File

@ -9,16 +9,13 @@ import com.bonus.base.mapper.TbDeviceMapper;
import com.bonus.base.mapper.TbProDepartMapper;
import com.bonus.base.mapper.TbProjectMapper;
import com.bonus.base.mapper.TbTeamMapper;
import com.bonus.base.vo.TbDeviceVo;
import com.bonus.base.vo.TbProjectVo;
import com.bonus.common.core.utils.StringUtils;
import com.bonus.common.core.utils.encryption.Sm4Utils;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.screen.mapper.TbDeviceDataRecord;
import com.bonus.screen.mapper.TeamRecordMapper;
import com.bonus.screen.mapper.UserPostMapper;
import com.bonus.screen.vo.*;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -47,6 +44,12 @@ public class ProjectViewServiceImpl {
@Autowired
private TbTeamMapper tbTeamMapper;
@Autowired
private TeamRecordMapper teamRecord;
@Autowired
private UserPostMapper userPost;
public ProjectViewVo getProjectView() {
return tbProjectMapper.getProjectView(
ProjectTypeEnum.PROJECT_TYPE_POWER.getCode(),
@ -58,6 +61,10 @@ public class ProjectViewServiceImpl {
return tbDeviceMapper.getDeviceView();
}
public DeviceViewVo getBdDeviceMapper() {
return tbDeviceMapper.getBdDeviceView();
}
public DeviceViewVo getSensingDevice() {
return tbDeviceMapper.getSensingDevice(
DeviceTypeEnum.BASE_SAFETY_HAT,
@ -73,6 +80,15 @@ public class ProjectViewServiceImpl {
return tbDeviceDataRecord.getDeviceWarnRecord(deviceWarnRecordVo);
}
/**
* 安全隐患预测记录信息
* @param record
* @return
*/
public List<WarnPredictionRecordVo> getWarnPredictionRecord(WarnPredictionRecordVo record) {
return tbDeviceDataRecord.getWarnPredictionRecord(record);
}
/**
* TODO待完善
@ -120,10 +136,24 @@ public class ProjectViewServiceImpl {
}
/**
* 感知设备各部分详情页
* @param tbDevice
* @return
*/
public List<DeviceWarnRecordVo> getDeviceModelDetailsPage(TbDevice tbDevice) {
return tbDeviceMapper.getDeviceModelDetailsPage(tbDevice);
}
/**
* 左侧物联边缘代理总设备详情
* @param bdData
* @return
*/
public List<TbBdDeviceRecordTwo> getDeviceModelDataAll(TbBdDeviceRecordTwo bdData) {
return tbDeviceMapper.getDeviceModelDataAll(bdData);
}
public AjaxResult getTeamJoinPersonListByProId(Integer proId){
List<TeamJoinPersonVo> teamPersonList = tbTeamMapper.getTeamJoinPersonListByProId(proId);
@ -161,4 +191,80 @@ public class ProjectViewServiceImpl {
}
return null; // 如果未找到返回 null
}
/**
* 施工记录数量
* @return
*/
public TeamRecordNum getTeamDataAmount() {
return teamRecord.getTeamDataAmount();
}
/**
* 施工班组详情页
* @param record
* @return
*/
public List<TeamRecord> getTeamDetails(TeamRecord record) {
List<TeamRecord> list = new ArrayList<>();
list = teamRecord.getTeamDetails(record);
if(CollectionUtils.isNotEmpty(list))
list.forEach(teamRecordOne -> {
if (StringUtils.isNotBlank(teamRecordOne.getMasterPhone())) {
teamRecordOne.setMasterPhone(Sm4Utils.decode(teamRecordOne.getMasterPhone()));
}
});
return list;
}
/**
* 施工人员详情页
* @param record
* @return
*/
public List<TeamRecord> getTeamPeopleDetails(TeamRecord record) {
List<TeamRecord> list = new ArrayList<>();
list = teamRecord.getTeamPeopleDetails(record);
if(CollectionUtils.isNotEmpty(list))
list.forEach(teamRecordOne -> {
if (StringUtils.isNotBlank(teamRecordOne.getPhone())) {
teamRecordOne.setPhone(Sm4Utils.decode(teamRecordOne.getPhone()));
}
});
return list;
}
/**
* 施工人员-班组骨干详情页
* @param record
* @return
*/
public List<TeamRecord> getTeamMasterDetails(TeamRecord record) {
List<TeamRecord> list = new ArrayList<>();
list = teamRecord.getTeamMasterDetails(record);
if(CollectionUtils.isNotEmpty(list))
list.forEach(teamRecordOne -> {
if (StringUtils.isNotBlank(teamRecordOne.getPhone())) {
teamRecordOne.setPhone(Sm4Utils.decode(teamRecordOne.getPhone()));
}
});
return list;
}
/**
* 人员到岗到位页面
* @param record
* @return
*/
public List<UserPost> getUserPostDetails(UserPost record) {
List<UserPost> list = new ArrayList<>();
list = userPost.getUserPostDetails(record);
if(CollectionUtils.isNotEmpty(list))
list.forEach(userPostOne -> {
if (StringUtils.isNotBlank(userPostOne.getPhone())) {
userPostOne.setPhone(Sm4Utils.decode(userPostOne.getPhone()));
}
});
return list;
}
}

View File

@ -0,0 +1,65 @@
package com.bonus.screen.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.Size;
import java.io.Serializable;
/**
* @PackagePath: com.bonus.base.domain
* @CreateTime: 2024-09-26
* @Description: 边带记录设备表
* @version : 1.0
*/
@ApiModel(description="边带记录设备表")
@Data
public class TbBdDeviceRecordTwo implements Serializable {
/**
* id
*/
@ApiModelProperty(value="id")
private Long id;
/**
* 记录id
*/
@ApiModelProperty(value="记录id")
private Long recordId;
/**
* 设备名称
*/
@ApiModelProperty(value="设备名称")
@Size(max = 255,message = "设备名称最大长度要小于 255")
private String devName;
/**
* 设备编码-唯一校验
*/
@ApiModelProperty(value="设备编码-唯一校验")
@Size(max = 64,message = "设备编码-唯一校验最大长度要小于 64")
private String devCode;
@ApiModelProperty(value="工程id")
private Long proId;
@ApiModelProperty(value="工程名称")
private Long proName;
/**
* 设备状态 0 离线 1在线
*/
@ApiModelProperty(value="设备状态 0 离线 1在线")
private Integer devStatus;
/**
* 设备状态名称
*/
@ApiModelProperty(value="设备状态名称")
private String devStatusName;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,74 @@
package com.bonus.screen.vo;
import com.bonus.common.core.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.models.auth.In;
import lombok.Data;
import javax.validation.constraints.Size;
import java.io.Serializable;
@ApiModel(description="班组,人员表")
@Data
public class TeamRecord implements Serializable {
/**
* 班组id
*/
private Long teamId;
/**
* 班组名称
*/
@ApiModelProperty(value="班组名称")
private String teamName;
/**
* 班组长
*/
@ApiModelProperty(value="班组长")
@Size(max = 50,message = "姓名最大长度要小于 50")
private String masterName;
/**
* 人员姓名
*/
@ApiModelProperty(value="人员姓名")
@Size(max = 50,message = "姓名最大长度要小于 50")
private String peopleName;
/**
* 岗位工种
*/
@ApiModelProperty(value="岗位工种")
private String postCode;
/**
* 班组长电话
*/
@ApiModelProperty(value="班组长电话")
@Size(max = 11,message = "电话最大长度要小于 11")
private String masterPhone;
/**
* 手机号
*/
@ApiModelProperty(value="手机号")
@Size(max = 11,message = "电话最大长度要小于 11")
private String phone;
/**
* 性别
*/
@ApiModelProperty(value="性别")
private Integer sex;
/**
* 班组人数
*/
@Excel(name = "班组人数")
private Integer peopleCount;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,45 @@
package com.bonus.screen.vo;
import com.bonus.common.core.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.Size;
import java.io.Serializable;
@ApiModel(description="班组,人员表")
@Data
public class TeamRecordNum implements Serializable {
/**
* 施工班组数
*/
@Excel(name = "施工班组数")
private Integer teamNum;
/**
* 施工人员数
*/
@Excel(name = "施工人员数")
private Integer peopleNum;
/**
* 班组骨干
*/
@Excel(name = "班组骨干")
private Integer teamMaster;
/**
* 一般作业
*/
@Excel(name = "一般作业")
private Integer teamSame;
/**
* 特种作业
*/
@Excel(name = "特种作业")
private Integer teamSpecial;
}

View File

@ -0,0 +1,62 @@
package com.bonus.screen.vo;
import com.bonus.common.core.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.Size;
import java.io.Serializable;
@ApiModel(description="人员到岗到位表")
@Data
public class UserPost implements Serializable {
private static final long serialVersionUID = 935926443103754206L;
/**
* id
*/
private Long id;
/**
* 岗位
*/
@ApiModelProperty(value="岗位")
private String postName;
/**
* 人员名称
*/
@ApiModelProperty(value="人员名称")
@Size(max = 50,message = "姓名最大长度要小于 50")
private String peopleName;
/**
* 手机号
*/
@ApiModelProperty(value="手机号")
@Size(max = 11,message = "电话最大长度要小于 11")
private String phone;
/**
* 岗位工种
*/
@ApiModelProperty(value="岗位工种")
private String postCode;
/**
* 签到时间
*/
@ApiModelProperty(value="签到时间")
private String createTime;
@ApiModelProperty(value = "开始时间")
private String startTime;
@ApiModelProperty(value = "结束时间")
private String endTime;
/**
* 工程id
*/
private Long proId;
}

View File

@ -0,0 +1,33 @@
package com.bonus.screen.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @PackagePath: com.bonus.screen.vo
* @CreateTime: 2024-09-26
* @Description: Vo
*/
@Data
public class WarnPredictionRecordVo implements Serializable {
@ApiModelProperty(value = "工程名称")
private String proName;
@ApiModelProperty(value = "预警时间")
private String createTime;
@ApiModelProperty(value = "预警内容")
private String content;
@ApiModelProperty(value = "开始时间")
private String startTime;
@ApiModelProperty(value = "结束时间")
private String endTime;
}

View File

@ -231,6 +231,15 @@
where del_flag = 0
</select>
<select id="getBdDeviceView" resultType="com.bonus.screen.vo.DeviceViewVo">
select
count(tbdr.id) as deviceTotal,
count(case when tbdr.dev_status = 1 then 1 end) as deviceOnlineTotal
from tb_bd_device_record tbdr
left join tb_bd_record tbr on tbdr.record_id = tbr.id and tbr.del_flag = 0
where tbr.audit_status = 1
</select>
<select id="getSensingDevice" resultType="com.bonus.screen.vo.DeviceViewVo">
select count(1) as deviceTotal,
count(CASE WHEN dev_type = #{param1.code} THEN 1 END) as baseSafetyHat,
@ -343,4 +352,31 @@
FROM tb_people
WHERE dev_id = #{id}
</select>
<!-- 左侧物联边缘代理总设备详情 -->
<select id="getDeviceModelDataAll" resultType="com.bonus.screen.vo.TbBdDeviceRecordTwo">
select tbdr.id as id,
record_id as recordId,
dev_name as devName,
dev_code as devCode,
dev_status as devStatus,
tp.pro_name as proName,
case
WHEN dev_status=0 then '离线'
WHEN dev_status=1 then '在线'
ELSE ''
END AS devStatusName
from tb_bd_device_record tbdr
left join tb_bd_record tbr on tbdr.record_id = tbr.id and tbr.del_flag = 0
where tbr.audit_status = 1 and tp.del_flag = 0
<if test="devName != null and devName != ''">
and tbdr.dev_name like concat('%',#{devName},'%')
</if>
<if test="devCode != null and devCode != ''">
and tbdr.dev_code like concat('%',#{devCode},'%')
</if>
<if test="devStatus != null ">
and tbdr.dev_status = #{devStatus}
</if>
</select>
</mapper>

View File

@ -266,5 +266,6 @@
WHERE
tt.id = #{id}
</select>
</mapper>

View File

@ -37,6 +37,23 @@
GROUP BY tddr.id
</select>
<!-- 安全隐患预测记录信息 -->
<select id="getWarnPredictionRecord" resultType="com.bonus.screen.vo.WarnPredictionRecordVo">
select tp.pro_name as proName,twp.create_time as createTime,twp.content as content
from t_warn_prediction twp
left join tb_area ta on twp.province = ta.area_name
left join tb_project tp on ta.id = tp.area_id
where
tp.del_flag = 0
<if test="proName != null and proName != ''">
and tp.pro_name like concat('%',#{proName},'%')
</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
<![CDATA[and DATE(twp.create_time) BETWEEN #{startTime} AND #{endTime} ]]>
</if>
order by twp.create_time
</select>
<select id="getDevAttributeLatestInfoById" resultType="com.bonus.base.domain.TbDevAttribute">
select
tddr.dev_id as devId, t2.dev_name as devName,t2.dev_code as devCode,tddr.jc_name as jcName,tddr.jc_value as jcValue,tddr.jc_unit as jcUnit,
@ -158,4 +175,5 @@
ORDER BY
tddr.create_time DESC
</select>
</mapper>
</mapper>

View File

@ -0,0 +1,76 @@
<?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.bonus.screen.mapper.TeamRecordMapper">
<!-- 施工记录数量 -->
<select id="getTeamDataAmount" resultType="com.bonus.screen.vo.TeamRecordNum">
select count(tt.id) as teamNum,count(tp.id) as peopleNum,
count(case when (tp.post_code = '0900101' || tp.post_code = '0900102' || tp.post_code = '0900103') then 1 end ) teamMaster,
count(case when tp.post_code = '0900104' then 1 end) teamSame,
count(case when tp.post_code = '0900106' then 1 end) teamSpecial
from tb_team tt
left join tb_people tp on tt.id = tp.team_id and tp.del_flag = 0
where tt.del_flag = 0
</select>
<!-- 施工人员详情页 -->
<select id="getTeamDetails" resultType="com.bonus.screen.vo.TeamRecord">
select
tt.id as teamId,
tt.team_name as teamName,
tt.rel_name as masterName,
tt.rel_phone as masterPhone,
count(tp.id) as peopleCount
from tb_team tt
left join tb_people tp on tt.id = tp.team_id and tp.del_flag = 0
where tt.del_flag = 0
<if test="teamName != null and teamName != ''">
and tt.team_name like concat('%',#{teamName},'%')
</if>
<if test="masterName != null and masterName != ''">
and tt.rel_name like concat('%',#{masterName},'%')
</if>
group by tt.id
order by tt.team_name
</select>
<!-- 施工班组详情页 -->
<select id="getTeamPeopleDetails" resultType="com.bonus.screen.vo.TeamRecord">
select
tp.rel_name as peopleName,
tt.team_name as teamName,
tp.sex as sex,
tp.rel_phone as phone,
tp.post_code as postCode
from tb_people tp
left join tb_team tt on tp.team_id = tt.id and tt.del_flag = 0
where tp.del_flag = 0
<if test="peopleName != null and peopleName != ''">
and tp.rel_name like concat('%',#{peopleName},'%')
</if>
<if test="postCode != null and postCode != ''">
and tp.post_code = #{postCode}
</if>
</select>
<!-- 施工人员-班组骨干详情页 -->
<select id="getTeamMasterDetails" resultType="com.bonus.screen.vo.TeamRecord">
select
tp.rel_name as peopleName,
tt.team_name as teamName,
tp.sex as sex,
tp.rel_phone as phone,
tp.post_code as postCode
from tb_people tp
left join tb_team tt on tp.team_id = tt.id and tt.del_flag = 0
where (tp.post_code = '0900101' or tp.post_code = '0900102' or tp.post_code = '0900103')
and tp.del_flag = 0
<if test="peopleName != null and peopleName != ''">
and tp.rel_name like concat('%',#{peopleName},'%')
</if>
<if test="postCode != null and postCode != ''">
and tp.post_code = #{postCode}
</if>
</select>
</mapper>

View File

@ -0,0 +1,26 @@
<?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.bonus.screen.mapper.UserPostMapper">
<!-- 人员到岗到位页面 -->
<select id="getUserPostDetails" resultType="com.bonus.screen.vo.UserPost">
select
post_name as postName,
rel_name as peopleName,
rel_phone as phone,
create_time as createTime
from tb_user_post tup
where 1=1
<if test="peopleName != null and peopleName != ''">
and rel_name like concat('%',#{peopleName},'%')
</if>
<if test="postName != null and postName != ''">
and post_name like concat('%',#{postName},'%')
</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
<![CDATA[and DATE(create_time) BETWEEN #{startTime} AND #{endTime} ]]>
</if>
ORDER BY create_time
</select>
</mapper>