更新9.21
This commit is contained in:
parent
80c28d93ac
commit
672a04e102
@ -6,6 +6,7 @@ import com.fuint.business.fleet.service.FleetInfoService;
|
||||
import com.fuint.business.fleet.vo.FleetInfoVo;
|
||||
import com.fuint.framework.web.BaseController;
|
||||
import com.fuint.framework.web.ResponseObject;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@ -84,5 +85,14 @@ public class FleetInfoController extends BaseController {
|
||||
return getSuccessResult(fleetInfoService.deleteById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据storeId获取车队信息
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getFleetInfoByStoreId")
|
||||
public ResponseObject getFleetInfoByStoreId(@Param("storeId")Integer storeId){
|
||||
return getSuccessResult(fleetInfoService.queryByStoreId(storeId));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@ package com.fuint.business.fleet.service;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.fleet.entity.FleetInfo;
|
||||
import com.fuint.business.fleet.vo.FleetInfoUniVo;
|
||||
import com.fuint.business.fleet.vo.FleetInfoVo;
|
||||
|
||||
/**
|
||||
@ -59,4 +60,10 @@ public interface FleetInfoService {
|
||||
*/
|
||||
int deleteById(Integer id);
|
||||
|
||||
/**
|
||||
* 根据storeId查询车队信息
|
||||
* @param storeId
|
||||
* @return
|
||||
*/
|
||||
FleetInfoUniVo queryByStoreId(Integer storeId);
|
||||
}
|
||||
|
@ -1,18 +1,26 @@
|
||||
package com.fuint.business.fleet.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fuint.business.fleet.entity.FleetInfo;
|
||||
import com.fuint.business.fleet.entity.FleetMember;
|
||||
import com.fuint.business.fleet.mapper.FleetInfoMapper;
|
||||
import com.fuint.business.fleet.mapper.FleetMemberMapper;
|
||||
import com.fuint.business.fleet.service.FleetInfoService;
|
||||
import com.fuint.business.fleet.vo.FleetInfoUniVo;
|
||||
import com.fuint.business.fleet.vo.FleetInfoVo;
|
||||
import com.fuint.business.member.entity.LJStaff;
|
||||
import com.fuint.business.member.service.ILJStaffService;
|
||||
import com.fuint.business.store.mapper.MtStoreMapper;
|
||||
import com.fuint.common.dto.AccountInfo;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import com.fuint.repository.mapper.MtUserMapper;
|
||||
import com.fuint.repository.model.MtUser;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -32,6 +40,15 @@ public class FleetInfoServiceImpl extends ServiceImpl<FleetInfoMapper,FleetInfo>
|
||||
@Autowired
|
||||
private ILJStaffService mtStaffService;
|
||||
|
||||
@Autowired
|
||||
private MtUserMapper mtUserMapper;
|
||||
|
||||
@Autowired
|
||||
private FleetMemberMapper fleetMemberMapper;
|
||||
|
||||
@Autowired
|
||||
private MtStoreMapper mtStoreMapper;
|
||||
|
||||
@Override
|
||||
public IPage<FleetInfoVo> queryPage(Page page, FleetInfoVo fleetInfo) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
@ -121,4 +138,36 @@ public class FleetInfoServiceImpl extends ServiceImpl<FleetInfoMapper,FleetInfo>
|
||||
public int deleteById(Integer id) {
|
||||
return baseMapper.deleteById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据storeId查询车队信息
|
||||
*
|
||||
* @param storeId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public FleetInfoUniVo queryByStoreId(Integer storeId) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
|
||||
LambdaQueryWrapper<MtUser> lambdaQueryWrapper1 = new LambdaQueryWrapper<>();
|
||||
// lambdaQueryWrapper1.eq(MtUser::getStoreId, storeId);
|
||||
lambdaQueryWrapper1.eq(MtUser::getId, nowAccountInfo.getId());
|
||||
lambdaQueryWrapper1.last("limit 1");
|
||||
MtUser mtUser = mtUserMapper.selectOne(lambdaQueryWrapper1);
|
||||
|
||||
LambdaQueryWrapper<FleetMember> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(FleetMember::getStoreId, storeId);
|
||||
lambdaQueryWrapper.eq(FleetMember::getUserCardNum, mtUser.getUserNo());
|
||||
lambdaQueryWrapper.last("limit 1");
|
||||
FleetMember fleetMember = fleetMemberMapper.selectOne(lambdaQueryWrapper);
|
||||
|
||||
if (ObjectUtil.isEmpty(fleetMember)) {
|
||||
throw new RuntimeException("该会员未绑定车队");
|
||||
}
|
||||
|
||||
FleetInfo fleetInfo = baseMapper.selectById(fleetMember.getFleetId());
|
||||
FleetInfoUniVo fleetInfoUniVo = BeanUtil.copyProperties(fleetInfo, FleetInfoUniVo.class);
|
||||
fleetInfoUniVo.setStoreName(mtStoreMapper.selectById(storeId).getName());
|
||||
return fleetInfoUniVo;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
package com.fuint.business.fleet.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.fuint.business.fleet.entity.FleetInfo;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class FleetInfoUniVo extends FleetInfo {
|
||||
|
||||
private String storeName;
|
||||
}
|
@ -86,12 +86,14 @@ public class MtUser implements Serializable {
|
||||
@ApiModelProperty("密码")
|
||||
private String password;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty("salt")
|
||||
private String salt;
|
||||
|
||||
@ApiModelProperty("地址")
|
||||
private String address;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty("所属商户ID")
|
||||
private Integer merchantId;
|
||||
|
||||
@ -112,6 +114,7 @@ public class MtUser implements Serializable {
|
||||
@ApiModelProperty("备注信息")
|
||||
private String description;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty("最后操作人")
|
||||
private String operator;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user