需求发布
This commit is contained in:
parent
f9797ff89b
commit
00354bffed
|
|
@ -12,7 +12,9 @@ public enum LeaseInfoEnum {
|
|||
|
||||
LEASE_PENDING_ORDER(0, "待接单"),
|
||||
LEASE_ORDER_RECEIVED(1, "已接单"),
|
||||
LEASE_PAST_DUE(2, "已过期");
|
||||
LEASE_PAST_DUE(2, "已过期"),
|
||||
LEASE_ORDER_AUDIT(3, "接单待审核"),
|
||||
LEASE_ORDER_AUDIT_FAIL(4, "驳回");
|
||||
|
||||
private final Integer status;
|
||||
private final String statusName;
|
||||
|
|
|
|||
|
|
@ -112,6 +112,12 @@ public class MaLeaseInfoController extends BaseController {
|
|||
return leaseInfoService.accept(maLeaseInfo);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "承租方审核(同意或驳回)")
|
||||
@PostMapping("/audit")
|
||||
public AjaxResult agreeOrReject(@RequestBody MaLeaseInfo maLeaseInfo) {
|
||||
return leaseInfoService.agreeOrReject(maLeaseInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除租赁需求
|
||||
* @param maLeaseInfo
|
||||
|
|
|
|||
|
|
@ -63,6 +63,9 @@ public class MaLease {
|
|||
@ApiModelProperty(value = "区域id")
|
||||
private Long areaId;
|
||||
|
||||
@ApiModelProperty(value = "市级code")
|
||||
private Long cityCode;
|
||||
|
||||
@ApiModelProperty(value = "区域名称")
|
||||
private String areaName;
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,62 @@
|
|||
package com.bonus.material.lease.domain;
|
||||
|
||||
import com.bonus.common.biz.domain.BmFileInfo;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author ma_sh
|
||||
* @create 2024/12/4 17:23
|
||||
*/
|
||||
@Data
|
||||
public class MaLeaseDetails {
|
||||
|
||||
private Integer id;
|
||||
|
||||
private Integer leaseId;
|
||||
|
||||
/**
|
||||
* 类型id
|
||||
*/
|
||||
private Integer typeId;
|
||||
|
||||
/**
|
||||
* 预估租赁装备数量
|
||||
*/
|
||||
private Integer leaseNum;
|
||||
|
||||
@ApiModelProperty(value = "装备类目id集合")
|
||||
private List<String> typeIds;
|
||||
|
||||
@ApiModelProperty(value = "装备类目id集合")
|
||||
private String ids;
|
||||
|
||||
@ApiModelProperty(value = "类型名称")
|
||||
private String typeName;
|
||||
|
||||
@ApiModelProperty(value = "所属三级类目合集")
|
||||
private String groupName;
|
||||
|
||||
@ApiModelProperty(value = "装备一级类目Id")
|
||||
private String firstId;
|
||||
|
||||
@ApiModelProperty(value = "装备一级类目名称")
|
||||
private String firstName;
|
||||
|
||||
@ApiModelProperty(value = "装备二级类目Id")
|
||||
private String secondId;
|
||||
|
||||
@ApiModelProperty(value = "装备二级类目名称")
|
||||
private String secondName;
|
||||
|
||||
@ApiModelProperty(value = "装备三级类目Id")
|
||||
private String thirdId;
|
||||
|
||||
@ApiModelProperty(value = "装备三级类目名称")
|
||||
private String thirdName;
|
||||
|
||||
@ApiModelProperty(value = "文件信息")
|
||||
private List<BmFileInfo> fileInfoList;
|
||||
}
|
||||
|
|
@ -45,16 +45,6 @@ public class MaLeaseInfo extends BaseEntity implements Serializable {
|
|||
*/
|
||||
private String leaseCode;
|
||||
|
||||
/**
|
||||
* 类型id
|
||||
*/
|
||||
private Integer typeId;
|
||||
|
||||
/**
|
||||
* 所属公司(租赁公司)
|
||||
*/
|
||||
private Integer companyId;
|
||||
|
||||
/**
|
||||
* 需求状态
|
||||
*/
|
||||
|
|
@ -65,11 +55,6 @@ public class MaLeaseInfo extends BaseEntity implements Serializable {
|
|||
*/
|
||||
private Integer leaseDay;
|
||||
|
||||
/**
|
||||
* 预估租赁装备数量
|
||||
*/
|
||||
private Integer leaseNum;
|
||||
|
||||
/**
|
||||
* 需求发布时间
|
||||
*/
|
||||
|
|
@ -119,19 +104,41 @@ public class MaLeaseInfo extends BaseEntity implements Serializable {
|
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date orderTime;
|
||||
|
||||
@ApiModelProperty(value = "省id")
|
||||
private Long provinceCode;
|
||||
|
||||
@ApiModelProperty(value = "省名称")
|
||||
private String provinceName;
|
||||
|
||||
@ApiModelProperty(value = "市id")
|
||||
private Long cityCode;
|
||||
|
||||
@ApiModelProperty(value = "市名称")
|
||||
private String cityName;
|
||||
|
||||
@ApiModelProperty(value = "区域id")
|
||||
private Long areaId;
|
||||
private Long areaCode;
|
||||
|
||||
@ApiModelProperty(value = "区域名称")
|
||||
private String areaName;
|
||||
|
||||
@ApiModelProperty(value = "装备类目id集合")
|
||||
private List<String> typeIds;
|
||||
@ApiModelProperty(value = "详细地址")
|
||||
private String address;
|
||||
|
||||
@ApiModelProperty(value = "装备类目id集合")
|
||||
private String ids;
|
||||
/**
|
||||
* 同意人
|
||||
*/
|
||||
private String agreeUser;
|
||||
|
||||
/**
|
||||
* 驳回人
|
||||
*/
|
||||
private String rejectUser;
|
||||
|
||||
@ApiModelProperty(value = "文件信息")
|
||||
private List<BmFileInfo> fileInfoList;
|
||||
|
||||
@ApiModelProperty(value = "需求详情")
|
||||
private List<MaLeaseDetails> detailsList;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -55,4 +55,7 @@ public class MaLeaseVo extends MaLeaseInfo {
|
|||
|
||||
@ApiModelProperty(value = "接单人联系方式")
|
||||
private String orderPhone;
|
||||
|
||||
@ApiModelProperty(value = "需求租赁总数量")
|
||||
private Integer leaseTotalNum;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.bonus.material.lease.mapper;
|
||||
|
||||
import com.bonus.material.lease.domain.MaLease;
|
||||
import com.bonus.material.lease.domain.MaLeaseDetails;
|
||||
import com.bonus.material.lease.domain.MaLeaseDto;
|
||||
import com.bonus.material.lease.domain.MaLeaseInfo;
|
||||
import com.bonus.material.lease.domain.vo.MaLeaseVo;
|
||||
|
|
@ -91,4 +92,25 @@ public interface MaLeaseInfoMapper {
|
|||
* @return
|
||||
*/
|
||||
List<MaLeaseVo> rentList(MaLeaseDto dto);
|
||||
|
||||
/**
|
||||
* 添加租赁需求详情
|
||||
* @param maLeaseDetails
|
||||
* @return
|
||||
*/
|
||||
int insertDetails(MaLeaseDetails maLeaseDetails);
|
||||
|
||||
/**
|
||||
* 根据租赁需求id查询租赁需求详情
|
||||
* @param maLeaseInfo
|
||||
* @return
|
||||
*/
|
||||
List<MaLeaseDetails> selectDetailsById(MaLeaseInfo maLeaseInfo);
|
||||
|
||||
/**
|
||||
* 根据租赁需求id删除租赁需求详情
|
||||
* @param maLeaseInfo
|
||||
* @return
|
||||
*/
|
||||
int deleteDetailsById(MaLeaseInfo maLeaseInfo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,4 +70,11 @@ public interface MaLeaseInfoService {
|
|||
* @return
|
||||
*/
|
||||
List<MaLeaseVo> rentList(MaLeaseDto dto);
|
||||
|
||||
/**
|
||||
* 乘租方同意或驳回
|
||||
* @param maLeaseInfo
|
||||
* @return
|
||||
*/
|
||||
AjaxResult agreeOrReject(MaLeaseInfo maLeaseInfo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,12 +7,14 @@ import com.bonus.common.biz.constant.MaterialConstants;
|
|||
import com.bonus.common.biz.domain.BmFileInfo;
|
||||
import com.bonus.common.biz.enums.HttpCodeEnum;
|
||||
import com.bonus.common.biz.enums.LeaseInfoEnum;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.material.device.mapper.BmFileInfoMapper;
|
||||
import com.bonus.material.lease.domain.MaLease;
|
||||
import com.bonus.material.lease.domain.MaLeaseDetails;
|
||||
import com.bonus.material.lease.domain.MaLeaseDto;
|
||||
import com.bonus.material.lease.domain.MaLeaseInfo;
|
||||
import com.bonus.material.lease.domain.vo.MaLeaseVo;
|
||||
|
|
@ -60,25 +62,59 @@ public class MaLeaseInfoServiceImpl implements MaLeaseInfoService {
|
|||
// 2. 生成需求编号及其他字段
|
||||
populateLeaseInfoFields(maLeaseInfo);
|
||||
// 3. 插入租赁需求
|
||||
if (CollectionUtils.isNotEmpty(maLeaseInfo.getTypeIds())) {
|
||||
maLeaseInfo.setIds(String.join(",", maLeaseInfo.getTypeIds()));
|
||||
}
|
||||
int result = leaseInfoMapper.insert(maLeaseInfo);
|
||||
if (result <= 0 || maLeaseInfo.getId() == null) {
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||
if (result > 0 && maLeaseInfo.getId() != null) {
|
||||
Integer id = maLeaseInfo.getId();
|
||||
// 4. 插入文件信息
|
||||
insertFileInfo(maLeaseInfo , id);
|
||||
//5.插入详情信息
|
||||
if (CollectionUtils.isNotEmpty(maLeaseInfo.getDetailsList())) {
|
||||
long distinctCodes = maLeaseInfo.getDetailsList().stream().map(MaLeaseDetails::getTypeId).distinct().count();
|
||||
if (distinctCodes < maLeaseInfo.getDetailsList().size()) {
|
||||
throw new ServiceException("提交的数据中设备类型存在重复,请勿重复添加", HttpCodeEnum.FAIL.getCode());
|
||||
}
|
||||
for (MaLeaseDetails maLeaseDetails : maLeaseInfo.getDetailsList()) {
|
||||
if (CollectionUtils.isNotEmpty(maLeaseDetails.getTypeIds())) {
|
||||
maLeaseDetails.setIds(String.join(",", maLeaseDetails.getTypeIds()));
|
||||
}
|
||||
maLeaseDetails.setLeaseId(id);
|
||||
result += leaseInfoMapper.insertDetails(maLeaseDetails);
|
||||
if (result > 0 && maLeaseDetails.getId() != null) {
|
||||
insertFile(maLeaseDetails, maLeaseDetails.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 4. 插入文件信息
|
||||
insertFileInfo(maLeaseInfo);
|
||||
// 5. 返回成功结果
|
||||
return AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入文件信息
|
||||
* @param maLeaseDetails
|
||||
* @param id
|
||||
*/
|
||||
private void insertFile(MaLeaseDetails maLeaseDetails, Integer id) {
|
||||
if (CollectionUtils.isNotEmpty(maLeaseDetails.getFileInfoList())) {
|
||||
List<BmFileInfo> bmFileInfos = new ArrayList<>();
|
||||
for (BmFileInfo fileInfo : maLeaseDetails.getFileInfoList()) {
|
||||
fileInfo.setModelId(Long.valueOf(id));
|
||||
fileInfo.setTaskType(MaterialConstants.LEASE_FILE_TYPE_CODE);
|
||||
fileInfo.setFileType(1L);
|
||||
fileInfo.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
|
||||
bmFileInfos.add(fileInfo);
|
||||
}
|
||||
bmFileInfoMapper.insertBmFileInfos(bmFileInfos);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改租赁需求
|
||||
* @param maLeaseInfo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public AjaxResult edit(MaLeaseInfo maLeaseInfo) {
|
||||
if (maLeaseInfo.getId() == null) {
|
||||
return AjaxResult.error(HttpCodeEnum.TO_PARAM_NULL.getCode(), HttpCodeEnum.TO_PARAM_NULL.getMsg());
|
||||
|
|
@ -99,20 +135,47 @@ public class MaLeaseInfoServiceImpl implements MaLeaseInfoService {
|
|||
return AjaxResult.error(HttpCodeEnum.LEASE_END_TIME_ERROR.getCode(), HttpCodeEnum.LEASE_END_TIME_ERROR.getMsg());
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(maLeaseInfo.getTypeIds())) {
|
||||
maLeaseInfo.setIds(String.join(",", maLeaseInfo.getTypeIds()));
|
||||
}
|
||||
int result = leaseInfoMapper.updateDevInfo(maLeaseInfo);
|
||||
//根据id查询删除详情信息
|
||||
List<MaLeaseDetails> leaseDetailsList = leaseInfoMapper.selectDetailsById(maLeaseInfo);
|
||||
result += leaseInfoMapper.deleteDetailsById(maLeaseInfo);
|
||||
//首先根据id查询文件信息是否存在
|
||||
BmFileInfo bmFileInfo = new BmFileInfo();
|
||||
bmFileInfo.setModelId(Long.valueOf(maLeaseInfo.getId()));
|
||||
bmFileInfo.setTaskType(MaterialConstants.LEASE_FILE_TYPE_CODE);
|
||||
bmFileInfo.setFileType(0L);
|
||||
List<BmFileInfo> bmFileInfoList = bmFileInfoMapper.selectBmFileInfoList(bmFileInfo);
|
||||
if (CollectionUtils.isNotEmpty(bmFileInfoList)) {
|
||||
bmFileInfoMapper.deleteBmFileInfoByIds(bmFileInfoList.stream().map(BmFileInfo::getId).toArray(Long[]::new));
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(leaseDetailsList)) {
|
||||
for (MaLeaseDetails maLeaseDetails : leaseDetailsList) {
|
||||
bmFileInfo.setModelId(Long.valueOf(maLeaseDetails.getId()));
|
||||
bmFileInfo.setFileType(1L);
|
||||
List<BmFileInfo> infoList = bmFileInfoMapper.selectBmFileInfoList(bmFileInfo);
|
||||
if (CollectionUtils.isNotEmpty(infoList)) {
|
||||
bmFileInfoMapper.deleteBmFileInfoByIds(infoList.stream().map(BmFileInfo::getId).toArray(Long[]::new));
|
||||
}
|
||||
}
|
||||
}
|
||||
//插入文件信息
|
||||
insertFileInfo(maLeaseInfo);
|
||||
insertFileInfo(maLeaseInfo, maLeaseInfo.getId());
|
||||
if (CollectionUtils.isNotEmpty(maLeaseInfo.getDetailsList())) {
|
||||
long distinctCodes = maLeaseInfo.getDetailsList().stream().map(MaLeaseDetails::getTypeId).distinct().count();
|
||||
if (distinctCodes < maLeaseInfo.getDetailsList().size()) {
|
||||
throw new ServiceException("提交的数据中设备类型存在重复,请勿重复添加", HttpCodeEnum.FAIL.getCode());
|
||||
}
|
||||
for (MaLeaseDetails maLeaseDetails : maLeaseInfo.getDetailsList()) {
|
||||
if (CollectionUtils.isNotEmpty(maLeaseDetails.getTypeIds())) {
|
||||
maLeaseDetails.setIds(String.join(",", maLeaseDetails.getTypeIds()));
|
||||
}
|
||||
maLeaseDetails.setLeaseId(maLeaseInfo.getId());
|
||||
result += leaseInfoMapper.insertDetails(maLeaseDetails);
|
||||
if (result > 0 && maLeaseDetails.getId() != null) {
|
||||
insertFile(maLeaseDetails, maLeaseDetails.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
return result > 0 ? AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg()) : AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||
}
|
||||
|
||||
|
|
@ -127,24 +190,41 @@ public class MaLeaseInfoServiceImpl implements MaLeaseInfoService {
|
|||
return AjaxResult.error(HttpCodeEnum.TO_PARAM_NULL.getCode(), HttpCodeEnum.TO_PARAM_NULL.getMsg());
|
||||
}
|
||||
MaLeaseVo maLeaseVo = leaseInfoMapper.selectByName(maLeaseInfo);
|
||||
//根据id查询详情信息
|
||||
List<MaLeaseDetails> leaseDetailsList = leaseInfoMapper.selectDetailsById(maLeaseInfo);
|
||||
ArrayList<String> list = new ArrayList<>();
|
||||
if (maLeaseVo != null) {
|
||||
//查询文件信息
|
||||
BmFileInfo bmFileInfo = new BmFileInfo();
|
||||
bmFileInfo.setModelId(Long.valueOf(maLeaseVo.getId()));
|
||||
bmFileInfo.setTaskType(MaterialConstants.LEASE_FILE_TYPE_CODE);
|
||||
bmFileInfo.setFileType(0L);
|
||||
List<BmFileInfo> fileList = bmFileInfoMapper.selectBmFileInfoList(bmFileInfo);
|
||||
if (CollectionUtil.isNotEmpty(fileList)) {
|
||||
maLeaseVo.setFileInfoList(fileList);
|
||||
}
|
||||
if (StringUtils.isNotBlank(maLeaseVo.getIds())) {
|
||||
// 使用 StringUtils.split() 按逗号分割 ids 字符串
|
||||
String[] idsArray = StringUtils.split(maLeaseVo.getIds(), ",");
|
||||
// 将分割后的元素添加到 list 中
|
||||
// 将分割出来的 id 添加到 list 中
|
||||
list.addAll(Arrays.asList(idsArray));
|
||||
maLeaseVo.setTypeIds(list);
|
||||
if (CollectionUtil.isNotEmpty(leaseDetailsList)) {
|
||||
for (MaLeaseDetails details : leaseDetailsList) {
|
||||
if (StringUtils.isNotBlank(details.getIds())) {
|
||||
// 使用 StringUtils.split() 按逗号分割 ids 字符串
|
||||
String[] idsArray = StringUtils.split(details.getIds(), ",");
|
||||
// 将分割后的元素添加到 list 中
|
||||
// 将分割出来的 id 添加到 list 中
|
||||
list.addAll(Arrays.asList(idsArray));
|
||||
details.setTypeIds(list);
|
||||
}
|
||||
//查询文件信息
|
||||
BmFileInfo bmFileInfo1 = new BmFileInfo();
|
||||
bmFileInfo1.setModelId(Long.valueOf(details.getId()));
|
||||
bmFileInfo1.setTaskType(MaterialConstants.LEASE_FILE_TYPE_CODE);
|
||||
bmFileInfo1.setFileType(1L);
|
||||
List<BmFileInfo> fileList1 = bmFileInfoMapper.selectBmFileInfoList(bmFileInfo1);
|
||||
if (CollectionUtil.isNotEmpty(fileList1)) {
|
||||
details.setFileInfoList(fileList1);
|
||||
}
|
||||
}
|
||||
}
|
||||
maLeaseVo.setDetailsList(leaseDetailsList);
|
||||
//更新搜索量
|
||||
try {
|
||||
//只针对于待接单状态租赁需求更新浏览量
|
||||
|
|
@ -217,6 +297,28 @@ public class MaLeaseInfoServiceImpl implements MaLeaseInfoService {
|
|||
return AjaxResult.error(HttpCodeEnum.LEASE_ORDER_RECEIVED_NOT_DELETE.getCode(), HttpCodeEnum.LEASE_ORDER_RECEIVED_NOT_DELETE.getMsg());
|
||||
}
|
||||
int result = leaseInfoMapper.deleteById(maLeaseInfo);
|
||||
//首先根据id查询文件信息是否存在
|
||||
BmFileInfo bmFileInfo = new BmFileInfo();
|
||||
bmFileInfo.setModelId(Long.valueOf(maLeaseInfo.getId()));
|
||||
bmFileInfo.setTaskType(MaterialConstants.LEASE_FILE_TYPE_CODE);
|
||||
bmFileInfo.setFileType(0L);
|
||||
List<BmFileInfo> bmFileInfoList = bmFileInfoMapper.selectBmFileInfoList(bmFileInfo);
|
||||
if (result > 0 && CollectionUtils.isNotEmpty(bmFileInfoList)) {
|
||||
bmFileInfoMapper.deleteBmFileInfoByIds(bmFileInfoList.stream().map(BmFileInfo::getId).toArray(Long[]::new));
|
||||
}
|
||||
//根据id查询删除详情信息
|
||||
List<MaLeaseDetails> leaseDetailsList = leaseInfoMapper.selectDetailsById(maLeaseInfo);
|
||||
result += leaseInfoMapper.deleteDetailsById(maLeaseInfo);
|
||||
if (CollectionUtils.isNotEmpty(leaseDetailsList)) {
|
||||
for (MaLeaseDetails maLeaseDetails : leaseDetailsList) {
|
||||
bmFileInfo.setModelId(Long.valueOf(maLeaseDetails.getId()));
|
||||
bmFileInfo.setFileType(1L);
|
||||
List<BmFileInfo> infoList = bmFileInfoMapper.selectBmFileInfoList(bmFileInfo);
|
||||
if (result > 0 && CollectionUtils.isNotEmpty(infoList)) {
|
||||
bmFileInfoMapper.deleteBmFileInfoByIds(infoList.stream().map(BmFileInfo::getId).toArray(Long[]::new));
|
||||
}
|
||||
}
|
||||
}
|
||||
return result > 0 ? AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg()) : AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||
}
|
||||
|
||||
|
|
@ -264,11 +366,28 @@ public class MaLeaseInfoServiceImpl implements MaLeaseInfoService {
|
|||
maLeaseInfo.setOrderUser(String.valueOf(userId));
|
||||
maLeaseInfo.setOrderCompany(String.valueOf(companyId));
|
||||
maLeaseInfo.setOrderTime(DateUtils.getNowDate());
|
||||
maLeaseInfo.setLeaseStatus(LeaseInfoEnum.LEASE_ORDER_RECEIVED.getStatus());
|
||||
maLeaseInfo.setLeaseStatus(LeaseInfoEnum.LEASE_ORDER_AUDIT.getStatus());
|
||||
int result = leaseInfoMapper.updateDevInfo(maLeaseInfo);
|
||||
return result > 0 ? AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg()) : AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult agreeOrReject(MaLeaseInfo maLeaseInfo) {
|
||||
int result = 0;
|
||||
if (maLeaseInfo.getId() == null) {
|
||||
return AjaxResult.error(HttpCodeEnum.TO_PARAM_NULL.getCode(), HttpCodeEnum.TO_PARAM_NULL.getMsg());
|
||||
}
|
||||
if (maLeaseInfo.getLeaseStatus() == 1) {
|
||||
maLeaseInfo.setAgreeUser(String.valueOf(SecurityUtils.getUserId()));
|
||||
result = leaseInfoMapper.updateDevInfo(maLeaseInfo);
|
||||
}
|
||||
if (maLeaseInfo.getLeaseStatus() == 4) {
|
||||
maLeaseInfo.setRejectUser(String.valueOf(SecurityUtils.getUserId()));
|
||||
result = leaseInfoMapper.updateDevInfo(maLeaseInfo);
|
||||
}
|
||||
return result > 0 ? AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg()) : AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询出租方需求列表
|
||||
* @param dto
|
||||
|
|
@ -300,16 +419,17 @@ public class MaLeaseInfoServiceImpl implements MaLeaseInfoService {
|
|||
* 插入文件信息
|
||||
* @param maLeaseInfo
|
||||
*/
|
||||
private void insertFileInfo(MaLeaseInfo maLeaseInfo) {
|
||||
private void insertFileInfo(MaLeaseInfo maLeaseInfo, Integer id) {
|
||||
if (CollectionUtil.isNotEmpty(maLeaseInfo.getFileInfoList())) {
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
Integer id = maLeaseInfo.getId();
|
||||
List<BmFileInfo> bmFileInfos = new ArrayList<>();
|
||||
for (BmFileInfo bmFileInfo : maLeaseInfo.getFileInfoList()) {
|
||||
bmFileInfo.setModelId(Long.valueOf(id));
|
||||
bmFileInfo.setTaskType(MaterialConstants.LEASE_FILE_TYPE_CODE);
|
||||
bmFileInfo.setCreateBy(String.valueOf(userId));
|
||||
bmFileInfoMapper.insertBmFileInfo(bmFileInfo);
|
||||
bmFileInfo.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
|
||||
bmFileInfo.setFileType(0L);
|
||||
bmFileInfos.add(bmFileInfo);
|
||||
}
|
||||
bmFileInfoMapper.insertBmFileInfos(bmFileInfos);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
name as areaName
|
||||
from base_address
|
||||
where 1 = 1
|
||||
<if test="areaCode == null and areaCode == ''">
|
||||
<if test="areaCode == 0">
|
||||
and parent_code = 0
|
||||
</if>
|
||||
<if test="areaCode != null and areaCode != ''">
|
||||
|
|
|
|||
|
|
@ -8,13 +8,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="leaseName != null and leaseName != ''">lease_name,</if>
|
||||
<if test="leaseCode != null and leaseCode != ''">lease_code,</if>
|
||||
<if test="typeId != null">type_id,</if>
|
||||
<if test="ids != null">type_ids,</if>
|
||||
<if test="companyId != null">company_id,</if>
|
||||
<if test="areaId != null">area_id,</if>
|
||||
<if test="provinceCode != null">province_code,</if>
|
||||
<if test="cityCode != null">city_code,</if>
|
||||
<if test="address != null and address != ''">address,</if>
|
||||
<if test="areaCode != null">area_code,</if>
|
||||
<if test="leaseStatus != null">lease_status,</if>
|
||||
<if test="leaseDay != null">lease_day,</if>
|
||||
<if test="leaseNum != null">lease_num,</if>
|
||||
<if test="startTime != null">start_time,</if>
|
||||
<if test="publishUser != null">publish_user,</if>
|
||||
<if test="publishCompany != null">publish_company,</if>
|
||||
|
|
@ -28,13 +27,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="leaseName != null and leaseName != ''">#{leaseName},</if>
|
||||
<if test="leaseCode != null and leaseCode != ''">#{leaseCode},</if>
|
||||
<if test="typeId != null">#{typeId},</if>
|
||||
<if test="ids != null">#{ids},</if>
|
||||
<if test="companyId != null">#{companyId},</if>
|
||||
<if test="areaId != null">#{areaId},</if>
|
||||
<if test="provinceCode != null">#{provinceCode},</if>
|
||||
<if test="cityCode != null">#{cityCode},</if>
|
||||
<if test="address != null">#{address},</if>
|
||||
<if test="areaCode != null">#{areaCode},</if>
|
||||
<if test="leaseStatus != null">#{leaseStatus},</if>
|
||||
<if test="leaseDay != null ">#{leaseDay},</if>
|
||||
<if test="leaseNum != null ">#{leaseNum},</if>
|
||||
<if test="startTime != null">#{startTime},</if>
|
||||
<if test="publishUser != null">#{publishUser},</if>
|
||||
<if test="publishCompany != null">#{publishCompany},</if>
|
||||
|
|
@ -52,17 +50,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
values(#{id}, 1, now())
|
||||
</insert>
|
||||
|
||||
<insert id="insertDetails" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into ma_lease_details
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="leaseId != null">lease_id,</if>
|
||||
<if test="typeId != null">type_id,</if>
|
||||
<if test="ids != null and ids != ''">type_ids,</if>
|
||||
<if test="leaseNum != null">lease_num,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="leaseId != null">#{leaseId},</if>
|
||||
<if test="typeId != null">#{typeId},</if>
|
||||
<if test="ids != null and ids != ''">#{ids},</if>
|
||||
<if test="leaseNum != null ">#{leaseNum},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateDevInfo">
|
||||
update ma_lease_info
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="leaseName != null and leaseName != ''">lease_name = #{leaseName},</if>
|
||||
<if test="typeId != null">type_id = #{typeId},</if>
|
||||
<if test="ids != null">type_ids = #{ids},</if>
|
||||
<if test="companyId != null">company_id = #{companyId},</if>
|
||||
<if test="areaId != null">area_id = #{areaId},</if>
|
||||
<if test="provinceCode != null">province_code = #{provinceCode},</if>
|
||||
<if test="cityCode != null">city_code = #{cityCode},</if>
|
||||
<if test="areaCode != null">area_code = #{areaCode},</if>
|
||||
<if test="leaseDay != null ">lease_day = #{leaseDay},</if>
|
||||
<if test="leaseStatus != null ">lease_status = #{leaseStatus},</if>
|
||||
<if test="leaseNum != null ">lease_num = #{leaseNum},</if>
|
||||
<if test="startTime != null">start_time = #{startTime},</if>
|
||||
<if test="publishUser != null and publishUser != ''">publish_user = #{publishUser},</if>
|
||||
<if test="endTime != null">end_time = #{endTime},</if>
|
||||
|
|
@ -74,6 +86,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="orderUser != null and orderUser != ''">order_user = #{orderUser},</if>
|
||||
<if test="orderCompany != null and orderCompany != ''">order_company = #{orderCompany},</if>
|
||||
<if test="orderTime != null">order_time = #{orderTime},</if>
|
||||
<if test="agreeUser != null">agree_user = #{agreeUser},</if>
|
||||
<if test="rejectUser != null">reject_user = #{rejectUser},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
|
@ -89,71 +103,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
delete from ma_lease_info where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteDetailsById">
|
||||
delete from ma_lease_details where lease_id = #{id}
|
||||
</delete>
|
||||
|
||||
<select id="selectByName" resultType="com.bonus.material.lease.domain.vo.MaLeaseVo">
|
||||
SELECT
|
||||
m.id as id,
|
||||
m.lease_name as leaseName,
|
||||
m.lease_code as leaseCode,
|
||||
m.type_id as typeId,
|
||||
m.type_ids as ids,
|
||||
mt4.type_name as typeName,
|
||||
m.company_id as companyId,
|
||||
c.company_name as companyName,
|
||||
c.operate_address as operateAddress,
|
||||
m.lease_status as leaseStatus,
|
||||
m.lease_day as leaseDay,
|
||||
m.lease_num as leaseNum,
|
||||
m.start_time as startTime,
|
||||
m.end_time as endTime,
|
||||
m.person as person,
|
||||
m.person_phone as personPhone,
|
||||
m.description as description,
|
||||
IFNULL(h.lease_num, 0) AS searchNum,
|
||||
mt3.type_id as thirdId,
|
||||
mt3.type_name as thirdName,
|
||||
mt2.type_id as secondId,
|
||||
mt2.type_name as secondName,
|
||||
mt1.type_id as firstId,
|
||||
mt1.type_name as firstName,
|
||||
CASE
|
||||
-- 第一级
|
||||
WHEN mt1.type_id IS NULL
|
||||
AND mt2.type_id IS NULL
|
||||
AND mt3.type_id IS NULL
|
||||
AND mt4.type_id IS NOT NULL THEN
|
||||
mt4.type_name
|
||||
-- 第二级
|
||||
WHEN mt1.type_id IS NULL
|
||||
AND mt2.type_id IS NULL
|
||||
AND mt3.type_id IS NOT NULL
|
||||
AND mt4.type_id IS NOT NULL THEN
|
||||
CONCAT( mt3.type_name, '/', mt4.type_name )
|
||||
-- 第三级
|
||||
WHEN mt1.type_id IS NULL
|
||||
AND mt2.type_id IS NOT NULL
|
||||
AND mt3.type_id IS NOT NULL
|
||||
AND mt4.type_id IS NOT NULL THEN
|
||||
CONCAT( mt2.type_name, '/', mt3.type_name, '/', mt4.type_name )
|
||||
-- 第四级
|
||||
WHEN mt1.type_id IS NOT NULL
|
||||
AND mt2.type_id IS NOT NULL
|
||||
AND mt3.type_id IS NOT NULL
|
||||
AND mt4.type_id IS NOT NULL THEN
|
||||
CONCAT( mt1.type_name, '/', mt2.type_name, '/', mt3.type_name, '/', mt4.type_name )
|
||||
ELSE NULL
|
||||
END AS groupName,
|
||||
m.publish_user as publishUser,
|
||||
m.area_id as areaId,
|
||||
b.name as areaName
|
||||
m.publish_company as publishCompany,
|
||||
m.province_code as provinceCode,
|
||||
b1.name as provinceName,
|
||||
m.city_code as cityCode,
|
||||
b2.name as cityName,
|
||||
m.area_code as areaCode,
|
||||
b.name as areaName,
|
||||
m.address as address,
|
||||
sd.dept_name as companyName
|
||||
FROM
|
||||
ma_lease_info m
|
||||
LEFT JOIN bm_company_info c ON m.company_id = c.company_id
|
||||
LEFT JOIN base_address b ON b.id = m.area_id
|
||||
LEFT JOIN base_address b ON b.code = m.area_code
|
||||
LEFT JOIN base_address b1 on m.province_code = b1.code
|
||||
LEFT JOIN base_address b2 on m.city_code = b2.code
|
||||
LEFT JOIN ma_hot_search h ON h.lease_id = m.id
|
||||
LEFT JOIN ma_type mt4 ON mt4.type_id = m.type_id and mt4.del_flag = '0'
|
||||
LEFT JOIN ma_type mt3 ON mt3.type_id = mt4.parent_id and mt3.del_flag = '0'
|
||||
LEFT JOIN ma_type mt2 ON mt2.type_id = mt3.parent_id and mt2.del_flag = '0'
|
||||
LEFT JOIN ma_type mt1 ON mt1.type_id = mt2.parent_id and mt1.del_flag = '0'
|
||||
LEFT JOIN sys_dept sd on m.publish_company = sd.dept_id
|
||||
WHERE 1 = 1
|
||||
<if test="id != null">
|
||||
and m.id = #{id}
|
||||
|
|
@ -175,28 +158,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<select id="list" resultType="com.bonus.material.lease.domain.vo.MaLeaseVo">
|
||||
SELECT
|
||||
m.id as id,
|
||||
m.lease_name as leaseName,
|
||||
m.lease_code as leaseCode,
|
||||
m.company_id as companyId,
|
||||
c.company_name as companyName,
|
||||
c.operate_address as operateAddress,
|
||||
m.lease_status as leaseStatus,
|
||||
m.start_time as startTime,
|
||||
m.end_time as endTime,
|
||||
CASE
|
||||
WHEN lease_status = 0 THEN '待接单'
|
||||
WHEN lease_status = 1 THEN '已接单'
|
||||
WHEN lease_status = 2 THEN '已过期'
|
||||
ELSE '未知'
|
||||
END
|
||||
AS leaseStatusName,
|
||||
su.nick_name as publishUser,
|
||||
su1.nick_name as orderUser,
|
||||
su1.phonenumber as orderPhone
|
||||
m.id as id,
|
||||
m.lease_name as leaseName,
|
||||
m.lease_code as leaseCode,
|
||||
m.lease_status as leaseStatus,
|
||||
m.start_time as startTime,
|
||||
m.end_time as endTime,
|
||||
CASE
|
||||
WHEN lease_status = 0 THEN '待接单'
|
||||
WHEN lease_status = 1 THEN '已接单'
|
||||
WHEN lease_status = 2 THEN '已过期'
|
||||
WHEN lease_status = 3 THEN '接单待审核'
|
||||
WHEN lease_status = 4 THEN '驳回'
|
||||
ELSE '未知'
|
||||
END
|
||||
AS leaseStatusName,
|
||||
su.nick_name as publishUser,
|
||||
su1.nick_name as orderUser,
|
||||
su1.phonenumber as orderPhone,
|
||||
m.province_code as provinceCode,
|
||||
b1.name as provinceName,
|
||||
m.city_code as cityCode,
|
||||
b2.name as cityName,
|
||||
m.area_code as areaCode,
|
||||
b.name as areaName,
|
||||
m.address as address
|
||||
FROM
|
||||
ma_lease_info m
|
||||
LEFT JOIN bm_company_info c ON m.company_id = c.company_id
|
||||
LEFT JOIN base_address b ON b.code = m.area_code
|
||||
LEFT JOIN base_address b1 on m.province_code = b1.code
|
||||
LEFT JOIN base_address b2 on m.city_code = b2.code
|
||||
LEFT JOIN sys_user su ON m.publish_user = su.user_id
|
||||
LEFT JOIN sys_user su1 ON m.order_user = su1.user_id
|
||||
WHERE 1 = 1 and m.publish_company = #{publishCompany}
|
||||
|
|
@ -226,102 +217,43 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<select id="leaseList" resultType="com.bonus.material.lease.domain.vo.MaLeaseVo">
|
||||
SELECT
|
||||
m.id as id,
|
||||
m.lease_name as leaseName,
|
||||
m.lease_code as leaseCode,
|
||||
m.type_id as typeId,
|
||||
mt4.type_name as typeName,
|
||||
m.company_id as companyId,
|
||||
c.company_name as companyName,
|
||||
c.operate_address as operateAddress,
|
||||
m.lease_status as leaseStatus,
|
||||
m.lease_day as leaseDay,
|
||||
m.lease_num as leaseNum,
|
||||
m.start_time as startTime,
|
||||
m.end_time as endTime,
|
||||
m.person as person,
|
||||
m.person_phone as personPhone,
|
||||
m.description as description,
|
||||
mt3.type_id as thirdId,
|
||||
mt3.type_name as thirdName,
|
||||
mt2.type_id as secondId,
|
||||
mt2.type_name as secondName,
|
||||
mt1.type_id as firstId,
|
||||
mt1.type_name as firstName,
|
||||
CASE
|
||||
-- 第一级
|
||||
WHEN mt1.type_id IS NULL
|
||||
AND mt2.type_id IS NULL
|
||||
AND mt3.type_id IS NULL
|
||||
AND mt4.type_id IS NOT NULL THEN
|
||||
mt4.type_name
|
||||
-- 第二级
|
||||
WHEN mt1.type_id IS NULL
|
||||
AND mt2.type_id IS NULL
|
||||
AND mt3.type_id IS NOT NULL
|
||||
AND mt4.type_id IS NOT NULL THEN
|
||||
CONCAT( mt3.type_name, '/', mt4.type_name )
|
||||
-- 第三级
|
||||
WHEN mt1.type_id IS NULL
|
||||
AND mt2.type_id IS NOT NULL
|
||||
AND mt3.type_id IS NOT NULL
|
||||
AND mt4.type_id IS NOT NULL THEN
|
||||
CONCAT( mt2.type_name, '/', mt3.type_name, '/', mt4.type_name )
|
||||
-- 第四级
|
||||
WHEN mt1.type_id IS NOT NULL
|
||||
AND mt2.type_id IS NOT NULL
|
||||
AND mt3.type_id IS NOT NULL
|
||||
AND mt4.type_id IS NOT NULL THEN
|
||||
CONCAT( mt1.type_name, '/', mt2.type_name, '/', mt3.type_name, '/', mt4.type_name )
|
||||
ELSE NULL
|
||||
END AS groupName,
|
||||
m.publish_user as publishUser,
|
||||
m.id AS id,
|
||||
m.lease_name AS leaseName,
|
||||
m.lease_code AS leaseCode,
|
||||
m.lease_status AS leaseStatus,
|
||||
m.lease_day AS leaseDay,
|
||||
m.start_time AS startTime,
|
||||
m.end_time AS endTime,
|
||||
m.person AS person,
|
||||
m.person_phone AS personPhone,
|
||||
m.description AS description,
|
||||
m.publish_user AS publishUser,
|
||||
m.publish_company as publishCompany,
|
||||
b.id as areaId,
|
||||
sd.dept_name AS companyName,
|
||||
SUM(m1.lease_num) AS leaseTotalNum,
|
||||
m.province_code as provinceCode,
|
||||
b1.name as provinceName,
|
||||
m.city_code as cityCode,
|
||||
b2.name as cityName,
|
||||
m.area_code as areaCode,
|
||||
b.name as areaName,
|
||||
su1.nick_name as orderUser,
|
||||
su1.phonenumber as orderPhone
|
||||
m.address as address
|
||||
FROM
|
||||
ma_lease_info m
|
||||
LEFT JOIN bm_company_info c ON m.company_id = c.company_id
|
||||
LEFT JOIN base_address b ON b.id = m.area_id
|
||||
LEFT JOIN sys_user su ON m.publish_user = su.user_id
|
||||
LEFT JOIN sys_user su1 ON m.order_user = su1.user_id
|
||||
LEFT JOIN ma_type mt4 ON mt4.type_id = m.type_id and mt4.del_flag = '0'
|
||||
LEFT JOIN ma_type mt3 ON mt3.type_id = mt4.parent_id and mt3.del_flag = '0'
|
||||
LEFT JOIN ma_type mt2 ON mt2.type_id = mt3.parent_id and mt2.del_flag = '0'
|
||||
LEFT JOIN ma_type mt1 ON mt1.type_id = mt2.parent_id and mt1.del_flag = '0'
|
||||
WHERE m.lease_status = '0'
|
||||
<if test="typeId != null">
|
||||
<choose>
|
||||
<when test="level != null and level == 4">
|
||||
and m.type_id = #{typeId}
|
||||
</when>
|
||||
<when test="level != null and level == 3">
|
||||
and mt3.type_id = #{typeId}
|
||||
</when>
|
||||
<when test="level != null and level == 2">
|
||||
and mt2.type_id = #{typeId}
|
||||
</when>
|
||||
<when test="level != null and level == 1">
|
||||
and (
|
||||
mt1.type_id = 1
|
||||
OR mt2.type_id = 1
|
||||
OR mt3.type_id = 1
|
||||
OR mt4.type_id = 1
|
||||
)
|
||||
</when>
|
||||
</choose>
|
||||
</if>
|
||||
<if test="companyId != null and companyId != ''"> and m.company_id = #{companyId}</if>
|
||||
<if test="areaId != null"> and m.area_id = #{areaId}</if>
|
||||
LEFT JOIN base_address b ON b.code = m.area_code
|
||||
LEFT JOIN base_address b1 on m.province_code = b1.code
|
||||
LEFT JOIN base_address b2 on m.city_code = b2.code
|
||||
LEFT JOIN ma_lease_details m1 ON m.id = m1.lease_id
|
||||
LEFT JOIN sys_user su ON m.publish_user = su.user_id
|
||||
LEFT JOIN sys_dept sd ON m.publish_company = sd.dept_id
|
||||
WHERE m.lease_status = '0'
|
||||
<if test="cityCode != null"> and m.city_code = #{cityCode}</if>
|
||||
<if test="keyWord != null and keyWord != ''">
|
||||
and (
|
||||
locate(#{keyWord},mt1.type_name) > 0
|
||||
or locate(#{keyWord},mt2.type_name) > 0
|
||||
or locate(#{keyWord},mt3.type_name) > 0
|
||||
or locate(#{keyWord},mt4.type_name) > 0
|
||||
or locate(#{keyWord},c.company_name) > 0
|
||||
or locate(#{keyWord},m.lease_name) > 0
|
||||
)
|
||||
</if>
|
||||
|
|
@ -347,10 +279,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
,m.end_time DESC
|
||||
</if>
|
||||
<if test="rentNum != null and rentNum == 'ASC'">
|
||||
,m.lease_num
|
||||
,SUM(m1.lease_num)
|
||||
</if>
|
||||
<if test="rentNum != null and rentNum == 'DESC'">
|
||||
,m.lease_num DESC
|
||||
,SUM(m1.lease_num) DESC
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
|
@ -359,13 +291,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
m.id as id,
|
||||
m.lease_name as leaseName,
|
||||
m.lease_code as leaseCode,
|
||||
m.type_id as typeId,
|
||||
m.company_id as companyId,
|
||||
c.company_name as companyName,
|
||||
c.operate_address as operateAddress,
|
||||
m.lease_status as leaseStatus,
|
||||
m.lease_day as leaseDay,
|
||||
m.lease_num as leaseNum,
|
||||
m.start_time as startTime,
|
||||
m.end_time as endTime,
|
||||
m.person as person,
|
||||
|
|
@ -374,15 +301,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
su.nick_name as publishUser,
|
||||
su1.nick_name as orderUser,
|
||||
m.order_time as orderTime,
|
||||
b.id as areaId,
|
||||
b.name as areaName
|
||||
m.province_code as provinceCode,
|
||||
b1.name as provinceName,
|
||||
m.city_code as cityCode,
|
||||
b2.name as cityName,
|
||||
m.area_code as areaCode,
|
||||
b.name as areaName,
|
||||
m.address as address,
|
||||
CASE
|
||||
WHEN m.lease_status = 0 THEN '待接单'
|
||||
WHEN m.lease_status = 1 THEN '已接单'
|
||||
WHEN m.lease_status = 2 THEN '已过期'
|
||||
WHEN m.lease_status = 3 THEN '接单待审核'
|
||||
WHEN m.lease_status = 4 THEN '驳回'
|
||||
ELSE '未知'
|
||||
END
|
||||
AS leaseStatusName
|
||||
FROM
|
||||
ma_lease_info m
|
||||
LEFT JOIN bm_company_info c ON m.company_id = c.company_id
|
||||
LEFT JOIN base_address b ON b.id = m.area_id
|
||||
LEFT JOIN base_address b ON b.code = m.area_code
|
||||
LEFT JOIN base_address b1 on m.province_code = b1.code
|
||||
LEFT JOIN base_address b2 on m.city_code = b2.code
|
||||
LEFT JOIN sys_user su ON m.publish_user = su.user_id
|
||||
LEFT JOIN sys_user su1 ON m.order_user = su1.user_id
|
||||
WHERE 1 = 1 and m.order_company = #{orderCompany} and m.lease_status = '1'
|
||||
WHERE 1 = 1 and m.order_company = #{orderCompany}
|
||||
<if test="leaseCode != null and leaseCode != ''">
|
||||
and m.lease_code like concat('%',#{leaseCode},'%')
|
||||
</if>
|
||||
|
|
@ -397,4 +339,51 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</if>
|
||||
GROUP BY m.lease_code
|
||||
</select>
|
||||
|
||||
<select id="selectDetailsById" resultType="com.bonus.material.lease.domain.MaLeaseDetails">
|
||||
select m.id as id,
|
||||
m.type_id as typeId,
|
||||
mt4.type_name as typeName,
|
||||
m.type_ids as ids,
|
||||
m.lease_num as leaseNum,
|
||||
mt3.type_id as thirdId,
|
||||
mt3.type_name as thirdName,
|
||||
mt2.type_id as secondId,
|
||||
mt2.type_name as secondName,
|
||||
mt1.type_id as firstId,
|
||||
mt1.type_name as firstName,
|
||||
CASE
|
||||
-- 第一级
|
||||
WHEN mt1.type_id IS NULL
|
||||
AND mt2.type_id IS NULL
|
||||
AND mt3.type_id IS NULL
|
||||
AND mt4.type_id IS NOT NULL THEN
|
||||
mt4.type_name
|
||||
-- 第二级
|
||||
WHEN mt1.type_id IS NULL
|
||||
AND mt2.type_id IS NULL
|
||||
AND mt3.type_id IS NOT NULL
|
||||
AND mt4.type_id IS NOT NULL THEN
|
||||
CONCAT(mt3.type_name, '/', mt4.type_name)
|
||||
-- 第三级
|
||||
WHEN mt1.type_id IS NULL
|
||||
AND mt2.type_id IS NOT NULL
|
||||
AND mt3.type_id IS NOT NULL
|
||||
AND mt4.type_id IS NOT NULL THEN
|
||||
CONCAT(mt2.type_name, '/', mt3.type_name, '/', mt4.type_name)
|
||||
-- 第四级
|
||||
WHEN mt1.type_id IS NOT NULL
|
||||
AND mt2.type_id IS NOT NULL
|
||||
AND mt3.type_id IS NOT NULL
|
||||
AND mt4.type_id IS NOT NULL THEN
|
||||
CONCAT(mt1.type_name, '/', mt2.type_name, '/', mt3.type_name, '/', mt4.type_name)
|
||||
ELSE NULL
|
||||
END AS groupName
|
||||
from ma_lease_details m
|
||||
LEFT JOIN ma_type mt4 ON mt4.type_id = m.type_id and mt4.del_flag = '0'
|
||||
LEFT JOIN ma_type mt3 ON mt3.type_id = mt4.parent_id and mt3.del_flag = '0'
|
||||
LEFT JOIN ma_type mt2 ON mt2.type_id = mt3.parent_id and mt2.del_flag = '0'
|
||||
LEFT JOIN ma_type mt1 ON mt1.type_id = mt2.parent_id and mt1.del_flag = '0'
|
||||
where lease_id = #{id}
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue