完成移动端接口联调
This commit is contained in:
parent
e3edc8d751
commit
a78df52829
@ -39,6 +39,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@ -0,0 +1,42 @@
|
||||
package com.lz.modules.app.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 员工基本信息表
|
||||
*
|
||||
* @author fumeiai
|
||||
* @email fumeiai@linzikg.com
|
||||
* @date 2020-04-29 20:59:20
|
||||
*/
|
||||
@Data
|
||||
@TableName("lz_staff")
|
||||
public class SearchStaffEntity implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 自增主键
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 员工姓名
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 性别【1:男;2:女;0:未知】
|
||||
*/
|
||||
|
||||
//盐
|
||||
private String position;
|
||||
//描述,name-position
|
||||
private String desc;
|
||||
|
||||
|
||||
}
|
||||
@ -1,41 +1,26 @@
|
||||
package com.lz.modules.equipment.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.lz.common.utils.PageUtils;
|
||||
import com.lz.common.utils.R;
|
||||
import com.lz.common.utils.RedisUtils;
|
||||
import com.lz.common.utils.StringUtil;
|
||||
import com.lz.modules.app.annotation.Login;
|
||||
import com.lz.modules.app.entity.StaffEntity;
|
||||
import com.lz.modules.app.service.StaffService;
|
||||
import com.lz.modules.equipment.entity.EquipmentInfo;
|
||||
import com.lz.modules.equipment.entity.SpecialApplyInfo;
|
||||
import com.lz.modules.equipment.entity.model.FindByNameModel;
|
||||
import com.lz.modules.equipment.entity.model.FindEmployeeResModel;
|
||||
import com.lz.modules.equipment.entity.model.FindEquipmentResModel;
|
||||
import com.lz.modules.equipment.entity.model.FindEquipmentsByNameModel;
|
||||
import com.lz.modules.equipment.service.IEquipmentInfoService;
|
||||
import com.lz.modules.equipment.service.SpecialApplyInfoService;
|
||||
import com.lz.modules.sys.controller.AbstractController;
|
||||
import com.lz.modules.sys.oauth2.TokenGenerator;
|
||||
import io.swagger.annotations.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.DigestUtils;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author: djc
|
||||
@ -80,27 +65,12 @@ public class EmployeeController extends AbstractController {
|
||||
|
||||
@PostMapping("findUsersEquipmentsByName")
|
||||
public R findUsersEquipmentsByName(@RequestBody @ApiParam FindEquipmentsByNameModel nameModel){
|
||||
/*Page<FindEquipmentResModel> data = new Page<>();
|
||||
Page<EquipmentInfo> equipmentInfoPage = iEquipmentInfoService.selectPage(
|
||||
new Page<>(nameModel.getCurrPage(), nameModel.getPageSize()),
|
||||
new EntityWrapper<EquipmentInfo>()
|
||||
.eq("is_delete", 0)
|
||||
.eq(nameModel.isEmployee(), "user_id", nameModel.getUserId())
|
||||
.eq(!nameModel.isEmployee(), "sai_id", nameModel.getUserId()));
|
||||
|
||||
List<EquipmentInfo> records = equipmentInfoPage.getRecords();
|
||||
if(CollectionUtils.isEmpty(records)){
|
||||
return R.ok();
|
||||
}
|
||||
List<FindEquipmentResModel> list = records.stream().map(info -> {
|
||||
FindEquipmentResModel model = new FindEquipmentResModel();
|
||||
BeanUtils.copyProperties(info, model);
|
||||
return model;
|
||||
}).collect(Collectors.toList());
|
||||
data.setTotal(equipmentInfoPage.getPages());
|
||||
data.setRecords(list);
|
||||
return R.ok().put("data", data);*/
|
||||
return null;
|
||||
PageUtils pageUtils = PageUtils.startPage(nameModel.getCurrPage(), nameModel.getPageSize()).doSelect(
|
||||
page -> iEquipmentInfoService.selectByStaffIdOrDepId(page, nameModel)
|
||||
);
|
||||
|
||||
return R.ok().put("data", pageUtils);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -11,6 +11,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.lz.modules.equipment.entity.EquipmentInfo;
|
||||
import com.lz.modules.equipment.entity.EquipmentInfoReq;
|
||||
import com.lz.modules.equipment.entity.model.FindByNameModel;
|
||||
import com.lz.modules.equipment.entity.model.FindEquipmentsByNameModel;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@ -38,4 +40,6 @@ public interface EquipmentInfoMapper extends BaseMapper<EquipmentInfo> {
|
||||
|
||||
|
||||
List<EquipmentInfo> selectByCondition(IPage page, EquipmentInfoReq req);
|
||||
|
||||
List<EquipmentInfo> selectByStaffIdOrDepId(@Param("page") IPage page, @Param("nameModel") FindEquipmentsByNameModel nameModel);
|
||||
}
|
||||
@ -1,13 +1,19 @@
|
||||
package com.lz.modules.equipment.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.lz.common.utils.PageUtils;
|
||||
import com.lz.modules.equipment.entity.EquipmentDto;
|
||||
import com.lz.modules.equipment.entity.EquipmentInfo;
|
||||
import com.lz.modules.equipment.entity.EquipmentInfoReq;
|
||||
import com.lz.modules.equipment.entity.model.FindByNameModel;
|
||||
import com.lz.modules.equipment.entity.model.FindEmployeeResModel;
|
||||
import com.lz.modules.equipment.entity.model.FindEquipmentsByNameModel;
|
||||
import com.lz.modules.sys.entity.SysUserEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
@ -41,4 +47,6 @@ public interface IEquipmentInfoService extends IService<EquipmentInfo> {
|
||||
EquipmentInfo selectEquipmentInfoByCode(String code);
|
||||
|
||||
PageUtils selectByCondition(EquipmentInfoReq req);
|
||||
|
||||
List<EquipmentInfo> selectByStaffIdOrDepId(IPage page, FindEquipmentsByNameModel nameModel);
|
||||
}
|
||||
@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.lz.modules.equipment.entity.SpecialApplyInfo;
|
||||
import com.lz.modules.equipment.entity.model.FindByNameModel;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -37,5 +38,5 @@ public interface SpecialApplyInfoService extends IService<SpecialApplyInfo> {
|
||||
|
||||
SpecialApplyInfo selectSpecialApplyInfoByTypeDesc(String owner);
|
||||
|
||||
List<SpecialApplyInfo> selectBySearchName(IPage page, FindByNameModel nameModel);
|
||||
List<SpecialApplyInfo> selectBySearchName(@Param("page")IPage page, @Param("model")FindByNameModel nameModel);
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
package com.lz.modules.equipment.service.impl;
|
||||
|
||||
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.lz.common.emun.EquipmentState;
|
||||
@ -11,6 +12,8 @@ import com.lz.modules.app.entity.StaffEntity;
|
||||
import com.lz.modules.app.service.StaffService;
|
||||
import com.lz.modules.equipment.dao.*;
|
||||
import com.lz.modules.equipment.entity.*;
|
||||
import com.lz.modules.equipment.entity.model.FindByNameModel;
|
||||
import com.lz.modules.equipment.entity.model.FindEquipmentsByNameModel;
|
||||
import com.lz.modules.equipment.service.IEquipmentInfoService;
|
||||
import com.lz.modules.sys.entity.SysUserEntity;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
@ -247,13 +250,18 @@ public class EquipmentInfoServiceImpl extends ServiceImpl<EquipmentInfoMapper, E
|
||||
|
||||
//记录日志
|
||||
private void addRecord(EquipmentInfo info,SysUserEntity infoDto){
|
||||
EquipmentFlowRecord record = new EquipmentFlowRecord();
|
||||
/*EquipmentFlowRecord record = new EquipmentFlowRecord();
|
||||
BeanUtils.copyProperties(info,record);
|
||||
record.setEquipmentId(info.getId());
|
||||
record.setChangeType(info.getEquipmentState());
|
||||
//record.setOriginalUser();
|
||||
record.setRecordUserId(infoDto.getUserId());
|
||||
record.setRecordUser(infoDto.getRealName());
|
||||
equipmentFlowRecordMapper.insertEquipmentFlowRecord(record);
|
||||
equipmentFlowRecordMapper.insertEquipmentFlowRecord(record);*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EquipmentInfo> selectByStaffIdOrDepId(IPage page, FindEquipmentsByNameModel nameModel){
|
||||
return equipmentInfoMapper.selectByStaffIdOrDepId(page, nameModel);
|
||||
}
|
||||
}
|
||||
|
||||
@ -232,5 +232,16 @@
|
||||
order by id desc
|
||||
</select>
|
||||
|
||||
<select id="selectByStaffIdOrDepId" resultType="EquipmentInfo">
|
||||
|
||||
select * from equipment_info where is_delete = 0
|
||||
<if test="nameModel.employee == true">
|
||||
and user_id = #{nameModel.userId}
|
||||
</if>
|
||||
<if test="nameModel.employee == false">
|
||||
and sai_id = #{nameModel.userId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
|
||||
@ -437,10 +437,10 @@
|
||||
select * from lz_staff where is_delete = 0 and employee_id = #{employeeId} limit 1
|
||||
</select>
|
||||
|
||||
<select id="selectBySearchName" resultType="com.lz.modules.app.entity.StaffEntity">
|
||||
select * from lz_staff where is_delete=0
|
||||
<select id="selectBySearchName" resultType="com.lz.modules.app.entity.SearchStaffEntity">
|
||||
select staf.id, staf.name, occ.position, concat(staf.name, '-', occ.position) as 'desc' from lz_staff staf LEFT JOIN lz_staff_occupation occ on staf.id = occ.staff_id where staf.is_delete = 0
|
||||
<if test="model.name != null and model.name != ''"></if>
|
||||
AND name LIKE CONCAT('%',#{model.name},'%')
|
||||
AND staf.name LIKE CONCAT('%',#{model.name},'%')
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user