报表权限

This commit is contained in:
mashuai 2025-07-17 20:15:23 +08:00
parent 41ea12a1ed
commit 76fe998670
13 changed files with 98 additions and 7 deletions

View File

@ -7,7 +7,6 @@ import com.bonus.common.core.utils.ServletUtils;
import com.bonus.common.core.utils.poi.ExcelUtil; import com.bonus.common.core.utils.poi.ExcelUtil;
import com.bonus.common.core.web.controller.BaseController; import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.material.back.domain.BackApplyInfo;
import com.bonus.material.basic.domain.report.*; import com.bonus.material.basic.domain.report.*;
import com.bonus.material.basic.service.BmReportService; import com.bonus.material.basic.service.BmReportService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -275,9 +274,10 @@ public class BmReportController extends BaseController {
@GetMapping("/getBackInputList") @GetMapping("/getBackInputList")
public AjaxResult getBackInputList(BackInputInfo bean) { public AjaxResult getBackInputList(BackInputInfo bean) {
bean.setIsExport(1); bean.setIsExport(1);
startPage(); Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1);
Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10);
List<BackInputInfo> pageList = bmReportService.getBackInputList(bean); List<BackInputInfo> pageList = bmReportService.getBackInputList(bean);
return AjaxResult.success(getDataTable(pageList)); return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, pageList));
} }
/** /**

View File

@ -62,6 +62,7 @@ public class ComplexQueryController extends BaseController {
@GetMapping("/getRetainedEquipmentListNoPage") @GetMapping("/getRetainedEquipmentListNoPage")
public AjaxResult getRetainedEquipmentListNoPage(RetainedEquipmentInfo bean) { public AjaxResult getRetainedEquipmentListNoPage(RetainedEquipmentInfo bean) {
bean.setIsExport(0); bean.setIsExport(0);
bean.setUserId( SecurityUtils.getLoginUser().getUserid());
List<RetainedEquipmentInfo> list = complexQueryService.getRetainedEquipmentList(bean); List<RetainedEquipmentInfo> list = complexQueryService.getRetainedEquipmentList(bean);
RetainedEquipmentInfo dto = new RetainedEquipmentInfo(); RetainedEquipmentInfo dto = new RetainedEquipmentInfo();
if (CollectionUtils.isNotEmpty(list)) { if (CollectionUtils.isNotEmpty(list)) {
@ -91,6 +92,7 @@ public class ComplexQueryController extends BaseController {
@PostMapping("/exportRetainedEquipmentList") @PostMapping("/exportRetainedEquipmentList")
public void exportRetainedEquipmentList(HttpServletResponse response, RetainedEquipmentInfo bean) public void exportRetainedEquipmentList(HttpServletResponse response, RetainedEquipmentInfo bean)
{ {
bean.setUserId(SecurityUtils.getLoginUser().getUserid());
bean.setIsExport(0); bean.setIsExport(0);
List<RetainedEquipmentInfo> list = complexQueryService.getRetainedEquipmentList(bean); List<RetainedEquipmentInfo> list = complexQueryService.getRetainedEquipmentList(bean);
ExcelUtil<RetainedEquipmentInfo> util = new ExcelUtil<>(RetainedEquipmentInfo.class); ExcelUtil<RetainedEquipmentInfo> util = new ExcelUtil<>(RetainedEquipmentInfo.class);
@ -304,6 +306,8 @@ public class ComplexQueryController extends BaseController {
@ApiOperation(value = "综合查询--工程机具使用列表不带分页") @ApiOperation(value = "综合查询--工程机具使用列表不带分页")
@GetMapping("/getProjUsingRecordListNoPage") @GetMapping("/getProjUsingRecordListNoPage")
public AjaxResult getProjUsingRecordListNoPage(ProjUsingRecord bean) { public AjaxResult getProjUsingRecordListNoPage(ProjUsingRecord bean) {
LoginUser loginUser = SecurityUtils.getLoginUser();
bean.setUserId(loginUser.getUserid());
List<ProjUsingRecord> list = complexQueryService.exportProjUsingRecord(bean); List<ProjUsingRecord> list = complexQueryService.exportProjUsingRecord(bean);
ProjUsingDto projUsingDto = new ProjUsingDto(); ProjUsingDto projUsingDto = new ProjUsingDto();
if (CollectionUtils.isNotEmpty(list)) { if (CollectionUtils.isNotEmpty(list)) {
@ -326,6 +330,7 @@ public class ComplexQueryController extends BaseController {
@PostMapping("/exportProjUsingRecord") @PostMapping("/exportProjUsingRecord")
public void exportProjUsingRecord(HttpServletResponse response, ProjUsingRecord bean) public void exportProjUsingRecord(HttpServletResponse response, ProjUsingRecord bean)
{ {
bean.setUserId(SecurityUtils.getLoginUser().getUserid());
List<ProjUsingRecord> list = complexQueryService.exportProjUsingRecord(bean); List<ProjUsingRecord> list = complexQueryService.exportProjUsingRecord(bean);
ExcelUtil<ProjUsingRecord> util = new ExcelUtil<>(ProjUsingRecord.class); ExcelUtil<ProjUsingRecord> util = new ExcelUtil<>(ProjUsingRecord.class);
util.exportExcel(response, list, "综合查询--工程机具使用查询"); util.exportExcel(response, list, "综合查询--工程机具使用查询");
@ -339,6 +344,7 @@ public class ComplexQueryController extends BaseController {
@ApiOperation(value = "综合查询--设备使用追溯查询") @ApiOperation(value = "综合查询--设备使用追溯查询")
@GetMapping("/getMachineHistoryRecordList") @GetMapping("/getMachineHistoryRecordList")
public AjaxResult getMachineHistoryRecordList(MachineHistoryRecordBean bean) { public AjaxResult getMachineHistoryRecordList(MachineHistoryRecordBean bean) {
bean.setUserId(SecurityUtils.getLoginUser().getUserid());
startPage(); startPage();
List<MachineHistoryRecordBean> list = complexQueryService.getMachineHistoryRecordList(bean); List<MachineHistoryRecordBean> list = complexQueryService.getMachineHistoryRecordList(bean);
return AjaxResult.success(getDataTable(list)); return AjaxResult.success(getDataTable(list));
@ -353,6 +359,7 @@ public class ComplexQueryController extends BaseController {
@PostMapping("/exportMachineHistoryRecord") @PostMapping("/exportMachineHistoryRecord")
public void exportMachineHistoryRecord(HttpServletResponse response, MachineHistoryRecordBean bean) public void exportMachineHistoryRecord(HttpServletResponse response, MachineHistoryRecordBean bean)
{ {
bean.setUserId(SecurityUtils.getLoginUser().getUserid());
List<MachineHistoryRecordBean> list = complexQueryService.getMachineHistoryRecordList(bean); List<MachineHistoryRecordBean> list = complexQueryService.getMachineHistoryRecordList(bean);
ExcelUtil<MachineHistoryRecordBean> util = new ExcelUtil<>(MachineHistoryRecordBean.class); ExcelUtil<MachineHistoryRecordBean> util = new ExcelUtil<>(MachineHistoryRecordBean.class);
util.exportExcel(response, list, "综合查询--设备使用追溯查询"); util.exportExcel(response, list, "综合查询--设备使用追溯查询");

View File

@ -97,4 +97,6 @@ public class MachineHistoryRecordBean {
@ApiModelProperty(value="关键字") @ApiModelProperty(value="关键字")
private String keyWord; private String keyWord;
private Long userId;
} }

View File

@ -77,4 +77,7 @@ public class BackInputInfo {
@ApiModelProperty(value = "关键字") @ApiModelProperty(value = "关键字")
private String keyWord; private String keyWord;
@ApiModelProperty(value = "用户id")
private Long userId;
} }

View File

@ -93,4 +93,7 @@ public class LeaseOutInfo {
@ApiModelProperty(value = "任务类型") @ApiModelProperty(value = "任务类型")
private int taskType; private int taskType;
@ApiModelProperty(value = "用户id")
private Long userId;
} }

View File

@ -99,4 +99,6 @@ public class PurChaseReportInfo {
@ApiModelProperty(value = "关键字") @ApiModelProperty(value = "关键字")
private String keyWord; private String keyWord;
private Long userId;
} }

View File

@ -90,4 +90,7 @@ public class RepairInfo {
@ApiModelProperty(value = "关键字") @ApiModelProperty(value = "关键字")
private String keyWord; private String keyWord;
@ApiModelProperty(value = "用户id")
private Long userId;
} }

View File

@ -78,4 +78,7 @@ public class RepairInputDto {
@ApiModelProperty(value = "关键字") @ApiModelProperty(value = "关键字")
private String keyWord; private String keyWord;
@ApiModelProperty(value = "用户id")
private Long userId;
} }

View File

@ -101,4 +101,7 @@ public class ScrapInfo {
/** 维修ID */ /** 维修ID */
@ApiModelProperty(value = "维修ID") @ApiModelProperty(value = "维修ID")
private Long repairId; private Long repairId;
@ApiModelProperty(value = "用户id")
private Long userId;
} }

View File

@ -145,4 +145,11 @@ public interface ComplexQueryMapper {
* @return * @return
*/ */
String getPartInfoList(MaTypeSelectInfo dto); String getPartInfoList(MaTypeSelectInfo dto);
/**
* 查询用户权限
* @param userId
* @return
*/
List<Long> selectTypeIdList(Long userId);
} }

View File

@ -4,6 +4,7 @@ import com.alibaba.nacos.common.utils.CollectionUtils;
import com.bonus.common.biz.domain.BmFileInfo; import com.bonus.common.biz.domain.BmFileInfo;
import com.bonus.common.biz.enums.TmTaskTypeEnum; import com.bonus.common.biz.enums.TmTaskTypeEnum;
import com.bonus.common.core.utils.StringUtils; import com.bonus.common.core.utils.StringUtils;
import com.bonus.common.security.utils.SecurityUtils;
import com.bonus.material.basic.domain.report.*; import com.bonus.material.basic.domain.report.*;
import com.bonus.material.basic.mapper.BmFileInfoMapper; import com.bonus.material.basic.mapper.BmFileInfoMapper;
import com.bonus.material.basic.mapper.BmReportMapper; import com.bonus.material.basic.mapper.BmReportMapper;
@ -36,6 +37,7 @@ public class BmReportServiceImpl implements BmReportService {
*/ */
@Override @Override
public List<PurChaseReportInfo> getPurChaseReportList(PurChaseReportInfo bean) { public List<PurChaseReportInfo> getPurChaseReportList(PurChaseReportInfo bean) {
bean.setUserId(SecurityUtils.getLoginUser().getUserid());
BigDecimal totalPurchaseNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP); BigDecimal totalPurchaseNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
BigDecimal totalPassNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP); BigDecimal totalPassNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
BigDecimal totalInputNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP); BigDecimal totalInputNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
@ -114,11 +116,15 @@ public class BmReportServiceImpl implements BmReportService {
*/ */
@Override @Override
public List<LeaseOutInfo> getLeaseOutList(LeaseOutInfo bean) { public List<LeaseOutInfo> getLeaseOutList(LeaseOutInfo bean) {
Long userId = SecurityUtils.getLoginUser().getUserid();
BigDecimal totalLeaseNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP); BigDecimal totalLeaseNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
BigDecimal totalOutNumNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP); BigDecimal totalOutNumNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
BigDecimal totalPendingOutNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP); BigDecimal totalPendingOutNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
List<LeaseOutInfo> list = bmReportMapper.getLeaseOutList(bean); List<LeaseOutInfo> list = bmReportMapper.getLeaseOutList(bean);
if (CollectionUtils.isNotEmpty(list)) { if (CollectionUtils.isNotEmpty(list)) {
// 将list集合中userId不为空且和userId相等的数据过滤处理
list = list.stream().filter(item -> item.getUserId() != null && item.getUserId().equals(userId))
.collect(Collectors.toList());
for (LeaseOutInfo leaseOutInfo : list) { for (LeaseOutInfo leaseOutInfo : list) {
totalLeaseNum = totalLeaseNum.add(leaseOutInfo.getLeaseNum()); totalLeaseNum = totalLeaseNum.add(leaseOutInfo.getLeaseNum());
totalOutNumNum = totalOutNumNum.add(leaseOutInfo.getOutNum()); totalOutNumNum = totalOutNumNum.add(leaseOutInfo.getOutNum());
@ -177,9 +183,12 @@ public class BmReportServiceImpl implements BmReportService {
*/ */
@Override @Override
public List<BackInputInfo> getBackInputList(BackInputInfo bean) { public List<BackInputInfo> getBackInputList(BackInputInfo bean) {
Long userid = SecurityUtils.getLoginUser().getUserid();
BigDecimal totalBackNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP); BigDecimal totalBackNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
List<BackInputInfo> list = bmReportMapper.getBackInputList(bean); List<BackInputInfo> list = bmReportMapper.getBackInputList(bean);
if (CollectionUtils.isNotEmpty(list)) { if (CollectionUtils.isNotEmpty(list)) {
list = list.stream().filter(item -> item.getUserId() != null && item.getUserId().equals(userid))
.collect(Collectors.toList());
for (BackInputInfo backInputInfo : list) { for (BackInputInfo backInputInfo : list) {
totalBackNum = totalBackNum.add(backInputInfo.getBackNum()); totalBackNum = totalBackNum.add(backInputInfo.getBackNum());
} }
@ -210,6 +219,7 @@ public class BmReportServiceImpl implements BmReportService {
*/ */
@Override @Override
public List<RepairInfo> getRepairList(RepairInfo bean) { public List<RepairInfo> getRepairList(RepairInfo bean) {
bean.setUserId(SecurityUtils.getLoginUser().getUserid());
BigDecimal totalBackNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP); BigDecimal totalBackNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
BigDecimal totalRepairedNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP); BigDecimal totalRepairedNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
BigDecimal totalPendingScrapNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP); BigDecimal totalPendingScrapNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
@ -252,6 +262,7 @@ public class BmReportServiceImpl implements BmReportService {
*/ */
@Override @Override
public List<RepairInputDto> getRepairInputList(RepairInputDto bean) { public List<RepairInputDto> getRepairInputList(RepairInputDto bean) {
bean.setUserId(SecurityUtils.getLoginUser().getUserid());
BigDecimal totalRepairedNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP); BigDecimal totalRepairedNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
BigDecimal totalInputNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP); BigDecimal totalInputNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
BigDecimal totalPendingInputNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP); BigDecimal totalPendingInputNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
@ -291,6 +302,7 @@ public class BmReportServiceImpl implements BmReportService {
*/ */
@Override @Override
public List<ScrapInfo> getScrapList(ScrapInfo bean) { public List<ScrapInfo> getScrapList(ScrapInfo bean) {
bean.setUserId(SecurityUtils.getLoginUser().getUserid());
BigDecimal totalScrapNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP); BigDecimal totalScrapNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
List<ScrapInfo> list = bmReportMapper.getScrapList(bean); List<ScrapInfo> list = bmReportMapper.getScrapList(bean);
if (CollectionUtils.isNotEmpty(list)) { if (CollectionUtils.isNotEmpty(list)) {

View File

@ -38,8 +38,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM bm_storage_log FROM bm_storage_log
GROUP BY task_id, type_id GROUP BY task_id, type_id
) a ON pcd.task_id = a.task_id AND pcd.type_id = a.type_id ) a ON pcd.task_id = a.task_id AND pcd.type_id = a.type_id
LEFT JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
LEFT JOIN ma_type_manage mtm ON mt4.type_id = mtm.type_id
WHERE WHERE
pcd.check_num > 0 pcd.check_num > 0
<if test="userId != null ">
and mtm.user_id = #{userId}
</if>
<if test="keyWord != null and keyWord != ''"> <if test="keyWord != null and keyWord != ''">
AND ( AND (
mt2.type_name LIKE CONCAT('%', #{keyWord}, '%') mt2.type_name LIKE CONCAT('%', #{keyWord}, '%')
@ -208,7 +214,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mt1.manage_type as manageType, mt1.manage_type as manageType,
lad.parent_id as parentId, lad.parent_id as parentId,
lad.type_id as typeId, lad.type_id as typeId,
tt.task_type as taskType tt.task_type as taskType,
mtm.user_id as userId
FROM FROM
lease_apply_details lad lease_apply_details lad
LEFT JOIN ma_type mt1 ON lad.type_id = mt1.type_id LEFT JOIN ma_type mt1 ON lad.type_id = mt1.type_id
@ -223,9 +230,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
LEFT JOIN ( SELECT parent_id, type_id, GROUP_CONCAT( DISTINCT create_by ) AS createBy, MAX( create_time ) AS createTime FROM lease_out_details GROUP BY parent_id, type_id ) a ON a.parent_id = lad.parent_id LEFT JOIN ( SELECT parent_id, type_id, GROUP_CONCAT( DISTINCT create_by ) AS createBy, MAX( create_time ) AS createTime FROM lease_out_details GROUP BY parent_id, type_id ) a ON a.parent_id = lad.parent_id
AND a.type_id = lad.type_id AND a.type_id = lad.type_id
LEFT JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
LEFT JOIN ma_type_manage mtm ON mt4.type_id = mtm.type_id
WHERE WHERE
1 = 1 1 = 1
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''"> <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
<![CDATA[and DATE_FORMAT( lai.create_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]> <![CDATA[and DATE_FORMAT( lai.create_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]>
</if> </if>
@ -272,7 +281,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bai.`code` as code, bai.`code` as code,
bad.parent_id as parentId, bad.parent_id as parentId,
bad.type_id as typeId, bad.type_id as typeId,
mt1.manage_type as manageType mt1.manage_type as manageType,
mtm.user_id as userId
FROM FROM
back_apply_details bad back_apply_details bad
LEFT JOIN ma_type mt1 ON bad.type_id = mt1.type_id LEFT JOIN ma_type mt1 ON bad.type_id = mt1.type_id
@ -284,8 +294,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN bm_agreement_info ba ON tta.agreement_id = ba.agreement_id LEFT JOIN bm_agreement_info ba ON tta.agreement_id = ba.agreement_id
LEFT JOIN bm_unit bu ON ba.unit_id = bu.unit_id LEFT JOIN bm_unit bu ON ba.unit_id = bu.unit_id
LEFT JOIN bm_project bp ON ba.project_id = bp.pro_id LEFT JOIN bm_project bp ON ba.project_id = bp.pro_id
LEFT JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
LEFT JOIN ma_type_manage mtm ON mt4.type_id = mtm.type_id
WHERE WHERE
1 = 1 mt2.type_name is not null and mt1.type_name is not null
<if test="keyWord != null and keyWord != ''"> <if test="keyWord != null and keyWord != ''">
AND ( AND (
mt2.type_name LIKE CONCAT('%', #{keyWord}, '%') mt2.type_name LIKE CONCAT('%', #{keyWord}, '%')
@ -360,8 +373,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN bm_agreement_info ba ON tta.agreement_id = ba.agreement_id LEFT JOIN bm_agreement_info ba ON tta.agreement_id = ba.agreement_id
LEFT JOIN bm_unit bu ON ba.unit_id = bu.unit_id LEFT JOIN bm_unit bu ON ba.unit_id = bu.unit_id
LEFT JOIN bm_project bp ON ba.project_id = bp.pro_id LEFT JOIN bm_project bp ON ba.project_id = bp.pro_id
LEFT JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
LEFT JOIN ma_type_manage mtm ON mt4.type_id = mtm.type_id
WHERE WHERE
1 = 1 1 = 1
<if test="userId != null ">
and mtm.user_id = #{userId}
</if>
<if test="keyWord != null and keyWord != ''"> <if test="keyWord != null and keyWord != ''">
AND ( AND (
mt2.type_name LIKE CONCAT('%', #{keyWord}, '%') mt2.type_name LIKE CONCAT('%', #{keyWord}, '%')
@ -430,8 +449,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN tm_task tt on rid.task_id = tt.task_id LEFT JOIN tm_task tt on rid.task_id = tt.task_id
LEFT JOIN ( SELECT task_id, type_id, GROUP_CONCAT( DISTINCT creator ) AS creator, MAX( create_time ) AS create_time FROM bm_storage_log GROUP BY task_id, type_id) a ON rid.task_id = a.task_id LEFT JOIN ( SELECT task_id, type_id, GROUP_CONCAT( DISTINCT creator ) AS creator, MAX( create_time ) AS create_time FROM bm_storage_log GROUP BY task_id, type_id) a ON rid.task_id = a.task_id
AND rid.type_id = a.type_id AND rid.type_id = a.type_id
LEFT JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
LEFT JOIN ma_type_manage mtm ON mt4.type_id = mtm.type_id
WHERE WHERE
1 = 1 1 = 1
<if test="userId != null ">
and mtm.user_id = #{userId}
</if>
<if test="keyWord != null and keyWord != ''"> <if test="keyWord != null and keyWord != ''">
AND ( AND (
mt2.type_name LIKE CONCAT('%', #{keyWord}, '%') mt2.type_name LIKE CONCAT('%', #{keyWord}, '%')
@ -522,8 +547,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND bpi.del_flag = '0' AND bpi.del_flag = '0'
LEFT JOIN ma_machine mm ON sad.ma_id = mm.ma_id LEFT JOIN ma_machine mm ON sad.ma_id = mm.ma_id
LEFT JOIN repair_audit_details rad ON rad.id = sad.parent_id LEFT JOIN repair_audit_details rad ON rad.id = sad.parent_id
LEFT JOIN ma_type mt3 ON mt3.type_id = mt1.parent_id
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
LEFT JOIN ma_type_manage mtm ON mt4.type_id = mtm.type_id
WHERE WHERE
sad.ledger_status = '1' sad.ledger_status = '1'
<if test="userId != null ">
and mtm.user_id = #{userId}
</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''"> <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
<![CDATA[AND DATE_FORMAT(sad.create_time, '%Y-%m-%d') BETWEEN #{startTime} AND #{endTime}]]> <![CDATA[AND DATE_FORMAT(sad.create_time, '%Y-%m-%d') BETWEEN #{startTime} AND #{endTime}]]>
</if> </if>

View File

@ -110,9 +110,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
LEFT JOIN ma_machine mm ON mm.ma_id = sai.ma_id LEFT JOIN ma_machine mm ON mm.ma_id = sai.ma_id
LEFT JOIN back_apply_info baif ON baif.id = sai.back_id LEFT JOIN back_apply_info baif ON baif.id = sai.back_id
LEFT JOIN ma_type mt3 ON mt2.parent_id = mt3.type_id
LEFT JOIN ma_type mt4 ON mt3.parent_id = mt4.type_id
LEFT JOIN ma_type_manage mtm ON mt3.parent_id = mtm.type_id
WHERE WHERE
1 = 1 1 = 1
AND sai.ma_id IS NOT NULL AND sai.ma_id IS NOT NULL
<if test="userId != null">
and mtm.user_id = #{userId}
</if>
<if test="keyWord != null and keyWord != ''"> <if test="keyWord != null and keyWord != ''">
and (bai.agreement_code like concat('%',#{keyWord},'%') or and (bai.agreement_code like concat('%',#{keyWord},'%') or
bui.unit_name like concat('%',#{keyWord},'%') or bui.unit_name like concat('%',#{keyWord},'%') or
@ -1058,4 +1064,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if> </if>
</select> </select>
<select id="selectTypeIdList" resultType="java.lang.Long">
select
type_id
from
ma_type_manage
where
user_id = #{userId}
</select>
</mapper> </mapper>