工机具使用二级开发

This commit is contained in:
hongchao 2025-08-12 14:03:18 +08:00
parent 4fbb8a2672
commit 78def4bee3
6 changed files with 111 additions and 1 deletions

View File

@ -67,4 +67,18 @@ public class ProjUsingRecordController extends BaseController {
util.exportExcel(response, list, "综合查询--工程机具使用"); util.exportExcel(response, list, "综合查询--工程机具使用");
} }
/**
* 租赁机具使用二级列表
*/
@ApiOperation(value = "综合查询--租赁机具使用列表")
@GetMapping("/getLeaseList")
@RequiresPermissions("stquery:projUsingRecord:list")
public AjaxResult getLeaseList(ProjUsingRecord bean) {
List<ProjUsingRecord> list = projUsingRecordService.getLeaseList(bean);
Integer pageIndex = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1);
Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
}
} }

View File

@ -31,6 +31,12 @@ public class ProjUsingRecord {
@Excel(name = "协议号") @Excel(name = "协议号")
private String agreementCode; private String agreementCode;
/**
* 协议ID
*/
@ApiModelProperty(value = "协议ID")
private Integer agreementId;
/** /**
* 往来单位Id * 往来单位Id
*/ */
@ -227,4 +233,22 @@ public class ProjUsingRecord {
*/ */
@ApiModelProperty(value = "是否显示") @ApiModelProperty(value = "是否显示")
private String isView; private String isView;
/**
* 数量类型 0在用数量 1归还数量
*/
@ApiModelProperty(value = "数量类型")
private Integer numType;
/**
* 租赁价
*/
@ApiModelProperty(value = "租赁价")
private BigDecimal leasePrice;
/**
* 购置价
*/
@ApiModelProperty(value = "购置价")
private BigDecimal buyPrice;
} }

View File

@ -20,4 +20,7 @@ public interface ProjUsingRecordMapper {
* @return List<ProjUsingRecord> * @return List<ProjUsingRecord>
*/ */
List<ProjUsingRecord> getProjUsingRecordList(ProjUsingRecord bean); List<ProjUsingRecord> getProjUsingRecordList(ProjUsingRecord bean);
List<ProjUsingRecord> getLeaseList(ProjUsingRecord bean);
} }

View File

@ -18,4 +18,7 @@ public interface ProjUsingRecordService {
* @return List<ProjUsingRecord> * @return List<ProjUsingRecord>
*/ */
List<ProjUsingRecord> getProjUsingRecordList(ProjUsingRecord bean); List<ProjUsingRecord> getProjUsingRecordList(ProjUsingRecord bean);
List<ProjUsingRecord> getLeaseList(ProjUsingRecord bean);
} }

View File

@ -41,4 +41,20 @@ public class ProjUsingRecordServiceImpl implements ProjUsingRecordService {
} }
return projUsingRecordMapper.getProjUsingRecordList(bean); return projUsingRecordMapper.getProjUsingRecordList(bean);
} }
@Override
public List<ProjUsingRecord> getLeaseList(ProjUsingRecord bean) {
Long userId = SecurityUtils.getUserId();
int deptId = leaseRecordMapper.getDeptId(userId);
if (deptId != 1000){
DeptVo deptVo = leaseRecordMapper.getAnsetors(deptId);
String isView = deptVo.getIsView();
bean.setDeptId(deptId);
bean.setIsView(isView);
}else{
bean.setIsView(null);
}
return projUsingRecordMapper.getLeaseList(bean);
}
} }

View File

@ -6,11 +6,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getProjUsingRecordList" resultType="com.bonus.sgzb.material.domain.ProjUsingRecord"> <select id="getProjUsingRecordList" resultType="com.bonus.sgzb.material.domain.ProjUsingRecord">
SELECT subquery1.agreementCode, SELECT subquery1.agreementCode,
subquery1.agreement_id AS agreementId,
subquery1.type_id AS typeId,
subquery1.unitId,
subquery1.proId,
subquery1.unitName, subquery1.unitName,
subquery1.proName, subquery1.proName,
subquery1.typeName, subquery1.typeName,
subquery1.typeModelName, subquery1.typeModelName,
subquery1.unit, subquery1.unit,
subquery1.manageType,
IFNULL(subquery1.outNum, 0) as outNum, IFNULL(subquery1.outNum, 0) as outNum,
IFNULL(subquery2.backNum, 0) as backNum, IFNULL(subquery2.backNum, 0) as backNum,
CASE CASE
@ -28,14 +33,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
END as usPrice, END as usPrice,
IFNULL(subquery1.outNum, 0) * IFNULL(subquery1.rent_price, 0) as totalPrice IFNULL(subquery1.outNum, 0) * IFNULL(subquery1.rent_price, 0) as totalPrice
FROM (SELECT bai.agreement_id, FROM (SELECT bai.agreement_id,
mt.type_id, mt.type_id as type_id,
mt.rent_price, mt.rent_price,
bui.unit_id as unitId,
bpl.lot_id as proId,
bai.agreement_code AS agreementCode, bai.agreement_code AS agreementCode,
bui.unit_name AS unitName, bui.unit_name AS unitName,
bpl.lot_name AS proName, bpl.lot_name AS proName,
mt2.type_name AS typeName, mt2.type_name AS typeName,
mt.type_name AS typeModelName, mt.type_name AS typeModelName,
mt.unit_name AS unit, mt.unit_name AS unit,
mt.manage_type as manageType,
SUM(IFNULL(lod.out_num, 0)) AS outNum SUM(IFNULL(lod.out_num, 0)) AS outNum
FROM lease_out_details lod FROM lease_out_details lod
LEFT JOIN lease_apply_info lai ON lai.id = lod.parent_id LEFT JOIN lease_apply_info lai ON lai.id = lod.parent_id
@ -133,4 +141,46 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if> </if>
</select> </select>
<select id="getLeaseList" resultType="com.bonus.sgzb.material.domain.ProjUsingRecord">
SELECT
sai.ma_id as maId,
mm.ma_code as maCode,
bai.agreement_id,
mt.type_id,
bai.agreement_code AS agreementCode,
bui.unit_name AS unitName,
mt2.type_name AS typeName,
mt.type_name AS typeModelName,
mt.unit_name AS unit,
mt.manage_type as manageType,
DATE_FORMAT(sai.start_time, '%Y-%m-%d') as startTime,
DATE_FORMAT(sai.end_time, '%Y-%m-%d') as endTime,
sai.lease_price as leasePrice,
sai.buy_price as buyPrice
FROM slt_agreement_info sai
LEFT JOIN lease_apply_info lai ON sai.lease_id = lai.id
LEFT JOIN tm_task_agreement tta ON tta.task_id = lai.task_id
LEFT JOIN bm_agreement_info bai ON bai.agreement_id = tta.agreement_id
LEFT JOIN bm_unit_info bui ON bui.unit_id = bai.unit_id
LEFT JOIN ma_type mt ON mt.type_id = sai.type_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
where 1=1
<if test="typeId != null">
and sai.type_id = #{typeId}
</if>
<if test="agreementId != null">
and sai.agreement_id = #{agreementId}
</if>
<if test="numType != null">
and sai.status = #{numType}
</if>
<if test="isView == 1">
and bui.dept_id = #{deptId}
</if>
<if test="maCode != null and maCode != ''">
and (mm.ma_code like concat('%',#{maCode},'%'))
</if>
order by sai.start_time asc
</select>
</mapper> </mapper>