Commit 7a4f80b2 authored by tianyiming's avatar tianyiming

两员配备- 设备绑定、解绑保存接口

parent 5861ad4f
......@@ -13,7 +13,7 @@ import java.util.Date;
@ApiModel(value = "TzsEquipLis", description = "设备列表(可绑定、可解绑)")
public class TzsEquipListDto {
@ApiModelProperty(value = "id")
@ApiModelProperty(value = "设备id(userInfo表中的id)")
private String id;
@ApiModelProperty(value = "内部编号")
......
......@@ -33,4 +33,6 @@ public interface ITzsUserInfoService extends IService<TzsUserInfo> {
Map<String,Object> getCompanyType();
Page<TzsEquipListDto> getEquipList(String type,String userSeq,TzsEquipListDto dto, Page<TzsEquipListDto> page);
Boolean equipBind(String type, String userSeq, Map<String,Object> map);
}
......@@ -205,4 +205,13 @@ public class TzsUserInfoController extends BaseController {
return ResponseHelper.buildResponse(tzsUserInfoService.getEquipList(type, userSeq, dto, page));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/equipBind")
@ApiOperation(httpMethod = "POST", value = "设备绑定解绑", notes = "设备绑定解绑")
public ResponseModel<Boolean> equipBind(@RequestParam(value = "type") String type,
@RequestParam(value = "userSeq") String userSeq,
@RequestBody Map<String,Object> map) {
return ResponseHelper.buildResponse(tzsUserInfoService.equipBind(type, userSeq, map));
}
}
......@@ -10,10 +10,12 @@ import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.tcm.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.tcm.api.dto.TzsEquipListDto;
import com.yeejoin.amos.boot.module.tcm.api.dto.TzsUserInfoDto;
import com.yeejoin.amos.boot.module.tcm.api.entity.*;
import com.yeejoin.amos.boot.module.tcm.api.enums.EquipmentClassifityEnum;
import com.yeejoin.amos.boot.module.tcm.api.mapper.TzsUserEquipMapper;
import com.yeejoin.amos.boot.module.tcm.api.mapper.TzsUserInfoMapper;
import com.yeejoin.amos.boot.module.tcm.api.service.ITzsUserInfoService;
import com.yeejoin.amos.boot.module.tcm.api.vo.TzsUserInfoVo;
......@@ -44,6 +46,12 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
private TzsUserInfoMapper tzsUserInfoMapper;
@Autowired
private TzsUserEquipMapper tzsUserEquipMapper;
@Autowired
private TzsUserEquipServiceImpl tzsUserEquipService;
@Autowired
DataDictionaryServiceImpl iDataDictionaryService;
@Autowired
......@@ -348,4 +356,25 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
tzsUserInfoDtoPage = tzsUserInfoMapper.getAllEquipList(page, type, companyCode, userSeq, dto);
return tzsUserInfoDtoPage;
}
@Override
public Boolean equipBind(String type, String userSeq, Map<String,Object> map) {
Object recordList = map.get("ids");
List<String> ids = (List<String>) recordList;
List<TzsUserEquip> tzsUserEquipList = new ArrayList<>();
boolean flag = false;
if ("bind".equals(type)) {
for (String equipId : ids) {
TzsUserEquip tzsUserEquip = new TzsUserEquip();
tzsUserEquip.setEquipId(equipId);
tzsUserEquip.setUserSeq(userSeq);
tzsUserEquipList.add(tzsUserEquip);
}
flag = tzsUserEquipService.saveBatch(tzsUserEquipList);
} else {
int num = tzsUserEquipMapper.delete(new QueryWrapper<TzsUserEquip>().eq("user_seq", userSeq).in("equip_id", ids));
flag = num > 0 ? true : flag;
}
return flag;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment