Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
e822fc5c54
1
.gitignore
vendored
1
.gitignore
vendored
@ -45,3 +45,4 @@ nbdist/
|
|||||||
!*/build/*.java
|
!*/build/*.java
|
||||||
!*/build/*.html
|
!*/build/*.html
|
||||||
!*/build/*.xml
|
!*/build/*.xml
|
||||||
|
/zhyc-module/src/main/java/com/zhyc/module/group_management/service/impl/GroupServiceImpl.java
|
||||||
|
@ -23,6 +23,10 @@
|
|||||||
<version>1.18.38</version> <!-- 使用最新版本 -->
|
<version>1.18.38</version> <!-- 使用最新版本 -->
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
@ -1,17 +1,14 @@
|
|||||||
package com.zhyc.module.fileManagement.controller;
|
package com.zhyc.module.fileManagement.controller;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.zhyc.common.utils.StringUtils;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import com.zhyc.common.annotation.Log;
|
import com.zhyc.common.annotation.Log;
|
||||||
import com.zhyc.common.core.controller.BaseController;
|
import com.zhyc.common.core.controller.BaseController;
|
||||||
import com.zhyc.common.core.domain.AjaxResult;
|
import com.zhyc.common.core.domain.AjaxResult;
|
||||||
@ -46,6 +43,24 @@ public class BasSheepGroupMappingController extends BaseController
|
|||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('sheep_grouping:sheep_grouping:list')")
|
||||||
|
@GetMapping("/listJoin")
|
||||||
|
public TableDataInfo list(
|
||||||
|
@RequestParam(required = false) Long sheepId,
|
||||||
|
@RequestParam(required = false) Long groupId,
|
||||||
|
@RequestParam(required = false) String bsManageTags) {
|
||||||
|
|
||||||
|
List<String> earList = null;
|
||||||
|
if (StringUtils.hasText(bsManageTags)) {
|
||||||
|
earList = Arrays.asList(bsManageTags.split("[,,\\s]+"));
|
||||||
|
}
|
||||||
|
startPage();
|
||||||
|
List<Map<String,Object>> list = basSheepGroupMappingService
|
||||||
|
.selectBasSheepGroupMappingList(sheepId, groupId, earList);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出羊只分组关联列表
|
* 导出羊只分组关联列表
|
||||||
*/
|
*/
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
package com.zhyc.module.fileManagement.mapper;
|
package com.zhyc.module.fileManagement.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.zhyc.module.fileManagement.domain.BasSheepGroupMapping;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.zhyc.module.fileManagement.domain.BasSheepGroupMapping;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
/**
|
/**
|
||||||
* 羊只分组关联Mapper接口
|
* 羊只分组关联Mapper接口
|
||||||
*
|
*
|
||||||
@ -27,6 +29,20 @@ public interface BasSheepGroupMappingMapper
|
|||||||
*/
|
*/
|
||||||
public List<BasSheepGroupMapping> selectBasSheepGroupMappingList(BasSheepGroupMapping basSheepGroupMapping);
|
public List<BasSheepGroupMapping> selectBasSheepGroupMappingList(BasSheepGroupMapping basSheepGroupMapping);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联表查询羊只分组关联列表(支持耳号列表)
|
||||||
|
*/
|
||||||
|
List<Map<String, Object>> selectBasSheepGroupMappingList(
|
||||||
|
@Param("sheepId") Long sheepId,
|
||||||
|
@Param("groupId") Long groupId,
|
||||||
|
@Param("bsManageTags") List<String> bsManageTags
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增羊只分组关联
|
* 新增羊只分组关联
|
||||||
*
|
*
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package com.zhyc.module.fileManagement.service;
|
package com.zhyc.module.fileManagement.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import com.zhyc.module.fileManagement.domain.BasSheepGroupMapping;
|
import com.zhyc.module.fileManagement.domain.BasSheepGroupMapping;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -27,6 +29,13 @@ public interface IBasSheepGroupMappingService
|
|||||||
*/
|
*/
|
||||||
public List<BasSheepGroupMapping> selectBasSheepGroupMappingList(BasSheepGroupMapping basSheepGroupMapping);
|
public List<BasSheepGroupMapping> selectBasSheepGroupMappingList(BasSheepGroupMapping basSheepGroupMapping);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联表查询羊只分组关联列表(支持耳号列表)
|
||||||
|
*/
|
||||||
|
List<Map<String, Object>> selectBasSheepGroupMappingList(Long sheepId, Long groupId, List<String> bsManageTags);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增羊只分组关联
|
* 新增羊只分组关联
|
||||||
*
|
*
|
||||||
@ -58,6 +67,4 @@ public interface IBasSheepGroupMappingService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteBasSheepGroupMappingById(Long id);
|
public int deleteBasSheepGroupMappingById(Long id);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package com.zhyc.module.fileManagement.service.impl;
|
package com.zhyc.module.fileManagement.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.zhyc.module.fileManagement.mapper.BasSheepGroupMappingMapper;
|
import com.zhyc.module.fileManagement.mapper.BasSheepGroupMappingMapper;
|
||||||
@ -43,6 +45,13 @@ public class BasSheepGroupMappingServiceImpl implements IBasSheepGroupMappingSer
|
|||||||
return basSheepGroupMappingMapper.selectBasSheepGroupMappingList(basSheepGroupMapping);
|
return basSheepGroupMappingMapper.selectBasSheepGroupMappingList(basSheepGroupMapping);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Map<String, Object>> selectBasSheepGroupMappingList(
|
||||||
|
Long sheepId, Long groupId, List<String> bsManageTags) {
|
||||||
|
return basSheepGroupMappingMapper.selectBasSheepGroupMappingList(sheepId, groupId, bsManageTags);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增羊只分组关联
|
* 新增羊只分组关联
|
||||||
*
|
*
|
||||||
@ -91,6 +100,4 @@ public class BasSheepGroupMappingServiceImpl implements IBasSheepGroupMappingSer
|
|||||||
return basSheepGroupMappingMapper.deleteBasSheepGroupMappingById(id);
|
return basSheepGroupMappingMapper.deleteBasSheepGroupMappingById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,12 +5,10 @@ import com.zhyc.common.core.domain.AjaxResult;
|
|||||||
import com.zhyc.common.enums.BusinessType;
|
import com.zhyc.common.enums.BusinessType;
|
||||||
import com.zhyc.common.exception.ServiceException;
|
import com.zhyc.common.exception.ServiceException;
|
||||||
import com.zhyc.common.utils.poi.ExcelUtil;
|
import com.zhyc.common.utils.poi.ExcelUtil;
|
||||||
import com.zhyc.module.base.variety.domain.BasSheepVariety;
|
|
||||||
import com.zhyc.module.base.variety.service.IBasSheepVarietyService;
|
|
||||||
import com.zhyc.module.fileManagement.domain.DaSheepfold;
|
|
||||||
import com.zhyc.module.fileManagement.service.IDaSheepfoldService;
|
|
||||||
import com.zhyc.module.produce.manage_sheep.add_sheep.domain.ScAddSheep;
|
import com.zhyc.module.produce.manage_sheep.add_sheep.domain.ScAddSheep;
|
||||||
import com.zhyc.module.produce.manage_sheep.add_sheep.service.IScAddSheepService;
|
import com.zhyc.module.produce.manage_sheep.add_sheep.service.IScAddSheepService;
|
||||||
|
import com.zhyc.module.fileManagement.domain.DaSheepfold;
|
||||||
|
import com.zhyc.module.fileManagement.service.IDaSheepfoldService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
@ -35,8 +33,6 @@ public class ScAddSheepController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IDaSheepfoldService daSheepfoldMapper;
|
private IDaSheepfoldService daSheepfoldMapper;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private IBasSheepVarietyService basSheepVarietyService;
|
|
||||||
//新增羊只验证
|
//新增羊只验证
|
||||||
@PreAuthorize("@ss.hasPermi('produce:add_sheep:add')")
|
@PreAuthorize("@ss.hasPermi('produce:add_sheep:add')")
|
||||||
@Log(title = "新增", businessType = BusinessType.INSERT)
|
@Log(title = "新增", businessType = BusinessType.INSERT)
|
||||||
@ -87,12 +83,7 @@ public class ScAddSheepController {
|
|||||||
scAddSheep.setSheepfoldNameExcel(fold.getSheepfoldName());
|
scAddSheep.setSheepfoldNameExcel(fold.getSheepfoldName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (scAddSheep.getVarietyId() != null) {
|
|
||||||
BasSheepVariety variety = basSheepVarietyService.selectBasSheepVarietyById(scAddSheep.getVarietyId().longValue());
|
|
||||||
if (variety != null) {
|
|
||||||
scAddSheep.setVarietyName(variety.getVariety());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
list.add(scAddSheep);
|
list.add(scAddSheep);
|
||||||
util.exportExcel(response, list, "羊只信息");
|
util.exportExcel(response, list, "羊只信息");
|
||||||
}
|
}
|
||||||
|
@ -2,23 +2,20 @@ package com.zhyc.module.produce.manage_sheep.add_sheep.service.impl;
|
|||||||
|
|
||||||
import com.zhyc.common.exception.ServiceException;
|
import com.zhyc.common.exception.ServiceException;
|
||||||
import com.zhyc.common.utils.StringUtils;
|
import com.zhyc.common.utils.StringUtils;
|
||||||
import com.zhyc.module.base.variety.domain.BasSheepVariety;
|
|
||||||
import com.zhyc.module.base.variety.service.IBasSheepVarietyService;
|
|
||||||
import com.zhyc.module.fileManagement.domain.DaSheepfold;
|
|
||||||
import com.zhyc.module.fileManagement.mapper.DaSheepfoldMapper;
|
|
||||||
import com.zhyc.module.produce.manage_sheep.add_sheep.domain.ScAddSheep;
|
import com.zhyc.module.produce.manage_sheep.add_sheep.domain.ScAddSheep;
|
||||||
import com.zhyc.module.produce.manage_sheep.add_sheep.mapper.ScAddSheepMapper;
|
import com.zhyc.module.produce.manage_sheep.add_sheep.mapper.ScAddSheepMapper;
|
||||||
import com.zhyc.module.produce.manage_sheep.add_sheep.service.IScAddSheepService;
|
import com.zhyc.module.produce.manage_sheep.add_sheep.service.IScAddSheepService;
|
||||||
import com.zhyc.module.produce.sheep.domain.BasSheep;
|
import com.zhyc.module.produce.sheep.domain.BasSheep;
|
||||||
|
import com.zhyc.module.produce.sheep.mapper.BasSheepMapper;
|
||||||
import com.zhyc.module.produce.sheep.service.IBasSheepService;
|
import com.zhyc.module.produce.sheep.service.IBasSheepService;
|
||||||
|
import com.zhyc.module.produce.sheep.service.impl.BasSheepServiceImpl;
|
||||||
|
import com.zhyc.module.fileManagement.domain.DaSheepfold;
|
||||||
|
import com.zhyc.module.fileManagement.mapper.DaSheepfoldMapper;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class ScAddSheepServiceImpl implements IScAddSheepService {
|
public class ScAddSheepServiceImpl implements IScAddSheepService {
|
||||||
@ -32,9 +29,6 @@ public class ScAddSheepServiceImpl implements IScAddSheepService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IBasSheepService basSheepService;
|
private IBasSheepService basSheepService;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private IBasSheepVarietyService basSheepVarietyService;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean insertScAddSheep(ScAddSheep scAddSheep) {
|
public boolean insertScAddSheep(ScAddSheep scAddSheep) {
|
||||||
// 1. 重复校验
|
// 1. 重复校验
|
||||||
@ -68,7 +62,6 @@ public class ScAddSheepServiceImpl implements IScAddSheepService {
|
|||||||
basSheepService.insertBasSheep(bs);
|
basSheepService.insertBasSheep(bs);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ScAddSheep> selectScAddSheepList(ScAddSheep scAddSheep) {
|
public List<ScAddSheep> selectScAddSheepList(ScAddSheep scAddSheep) {
|
||||||
return scAddSheepMapper.selectScAddSheepList(scAddSheep);
|
return scAddSheepMapper.selectScAddSheepList(scAddSheep);
|
||||||
@ -86,7 +79,6 @@ public class ScAddSheepServiceImpl implements IScAddSheepService {
|
|||||||
|
|
||||||
/* ------------------ 导入:羊舍名称 → ID ------------------ */
|
/* ------------------ 导入:羊舍名称 → ID ------------------ */
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public String importSheep(List<ScAddSheep> list, boolean updateSupport, String operName) {
|
public String importSheep(List<ScAddSheep> list, boolean updateSupport, String operName) {
|
||||||
if (list == null || list.isEmpty()) {
|
if (list == null || list.isEmpty()) {
|
||||||
throw new ServiceException("导入数据不能为空!");
|
throw new ServiceException("导入数据不能为空!");
|
||||||
@ -95,58 +87,50 @@ public class ScAddSheepServiceImpl implements IScAddSheepService {
|
|||||||
int success = 0, failure = 0;
|
int success = 0, failure = 0;
|
||||||
StringBuilder failureMsg = new StringBuilder();
|
StringBuilder failureMsg = new StringBuilder();
|
||||||
|
|
||||||
// 1. 一次性加载全部品种和羊舍,避免循环查库
|
|
||||||
Map<String, Long> varietyNameToIdMap = basSheepVarietyService
|
|
||||||
.selectBasSheepVarietyList(new BasSheepVariety())
|
|
||||||
.stream()
|
|
||||||
.collect(Collectors.toMap(
|
|
||||||
BasSheepVariety::getVariety,
|
|
||||||
BasSheepVariety::getId,
|
|
||||||
(existing, replacement) -> existing // 保留第一个
|
|
||||||
));
|
|
||||||
|
|
||||||
Map<String, Long> sheepfoldNameToIdMap = daSheepfoldMapper
|
|
||||||
.selectDaSheepfoldList(new DaSheepfold())
|
|
||||||
.stream()
|
|
||||||
.collect(Collectors.toMap(
|
|
||||||
DaSheepfold::getSheepfoldName,
|
|
||||||
DaSheepfold::getId,
|
|
||||||
(existing, replacement) -> existing // 保留第一个
|
|
||||||
));
|
|
||||||
|
|
||||||
for (int i = 0; i < list.size(); i++) {
|
for (int i = 0; i < list.size(); i++) {
|
||||||
ScAddSheep sheep = list.get(i);
|
ScAddSheep sheep = list.get(i);
|
||||||
try {
|
try {
|
||||||
// 2. 羊舍名称 → ID
|
/* 1. 羊舍名称 → ID */
|
||||||
if (StringUtils.isNotBlank(sheep.getSheepfoldNameExcel())) {
|
if (StringUtils.isNotBlank(sheep.getSheepfoldNameExcel())) {
|
||||||
Long sheepfoldId = sheepfoldNameToIdMap.get(sheep.getSheepfoldNameExcel());
|
DaSheepfold param = new DaSheepfold();
|
||||||
if (sheepfoldId == null) {
|
param.setSheepfoldName(sheep.getSheepfoldNameExcel());
|
||||||
throw new ServiceException("羊舍名称不存在:" + sheep.getSheepfoldNameExcel());
|
List<DaSheepfold> foldList = daSheepfoldMapper.selectDaSheepfoldList(param);
|
||||||
|
|
||||||
|
if (foldList == null || foldList.isEmpty()) {
|
||||||
|
failure++;
|
||||||
|
failureMsg.append("<br/>第")
|
||||||
|
.append(i + 1)
|
||||||
|
.append("行:羊舍名称不存在【")
|
||||||
|
.append(sheep.getSheepfoldNameExcel())
|
||||||
|
.append("】");
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
sheep.setSheepfold(sheepfoldId.intValue());
|
sheep.setSheepfold(foldList.get(0).getId().intValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. 品种名称 → ID
|
/* 2. 耳号非空校验 */
|
||||||
if (StringUtils.isNotBlank(sheep.getVarietyName())) {
|
|
||||||
Long varietyId = varietyNameToIdMap.get(sheep.getVarietyName());
|
|
||||||
if (varietyId == null) {
|
|
||||||
throw new ServiceException("品种名称不存在:" + sheep.getVarietyName());
|
|
||||||
}
|
|
||||||
sheep.setVarietyId(varietyId.intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
// 4. 耳号非空校验
|
|
||||||
if (StringUtils.isBlank(sheep.getEarNumber())) {
|
if (StringUtils.isBlank(sheep.getEarNumber())) {
|
||||||
throw new ServiceException("耳号不能为空");
|
failure++;
|
||||||
|
failureMsg.append("<br/>第")
|
||||||
|
.append(i + 1)
|
||||||
|
.append("行:耳号不能为空");
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 5. 耳号重复校验
|
/* 3. 耳号重复校验(增量导入核心) */
|
||||||
ScAddSheep exist = scAddSheepMapper.selectByEarNumber(sheep.getEarNumber());
|
ScAddSheep exist = scAddSheepMapper.selectByEarNumber(sheep.getEarNumber());
|
||||||
if (exist != null) {
|
if (exist != null) {
|
||||||
if (!updateSupport) {
|
failure++;
|
||||||
throw new ServiceException("耳号已存在:" + sheep.getEarNumber());
|
failureMsg.append("<br/>第")
|
||||||
|
.append(i + 1)
|
||||||
|
.append("行:耳号已存在【")
|
||||||
|
.append(sheep.getEarNumber())
|
||||||
|
.append("】");
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
sheep.setId(exist.getId());
|
|
||||||
|
/* 4. 插入或更新 */
|
||||||
|
if (updateSupport && sheep.getId() != null) {
|
||||||
sheep.setUpdateBy(operName);
|
sheep.setUpdateBy(operName);
|
||||||
updateScAddSheep(sheep);
|
updateScAddSheep(sheep);
|
||||||
} else {
|
} else {
|
||||||
@ -156,7 +140,10 @@ public class ScAddSheepServiceImpl implements IScAddSheepService {
|
|||||||
success++;
|
success++;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
failure++;
|
failure++;
|
||||||
failureMsg.append("<br/>第").append(i + 1).append("行:").append(e.getMessage());
|
failureMsg.append("<br/>第")
|
||||||
|
.append(i + 1)
|
||||||
|
.append("行:")
|
||||||
|
.append(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,6 +66,13 @@ public class ScTransGroup extends BaseEntity {
|
|||||||
@Excel(name = "品种")
|
@Excel(name = "品种")
|
||||||
private String varietyName;
|
private String varietyName;
|
||||||
|
|
||||||
|
/** 品种id */
|
||||||
|
private Long varietyId;
|
||||||
|
|
||||||
|
/** 品种名称(联表查询返回,非数据库字段) */
|
||||||
|
@Excel(name = "品种")
|
||||||
|
private String varietyName;
|
||||||
|
|
||||||
private Integer reason;
|
private Integer reason;
|
||||||
/**
|
/**
|
||||||
* 转群原因描述 用于导出
|
* 转群原因描述 用于导出
|
||||||
|
@ -14,14 +14,58 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
select id, sheep_id, group_id from bas_sheep_group_mapping
|
select id, sheep_id, group_id from bas_sheep_group_mapping
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectBasSheepGroupMappingList" parameterType="BasSheepGroupMapping" resultMap="BasSheepGroupMappingResult">
|
<!-- <select id="selectBasSheepGroupMappingList" parameterType="BasSheepGroupMapping" resultMap="BasSheepGroupMappingResult">-->
|
||||||
<include refid="selectBasSheepGroupMappingVo"/>
|
<!-- <include refid="selectBasSheepGroupMappingVo"/>-->
|
||||||
|
<!-- <where> -->
|
||||||
|
<!-- <if test="sheepId != null "> and sheep_id = #{sheepId}</if>-->
|
||||||
|
<!-- <if test="groupId != null "> and group_id = #{groupId}</if>-->
|
||||||
|
<!-- </where>-->
|
||||||
|
<!-- </select>-->
|
||||||
|
|
||||||
|
<select id="selectBasSheepGroupMappingList"
|
||||||
|
parameterType="map"
|
||||||
|
resultType="map"> <!-- 1. 返回 map 方便前端直接取值 -->
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
m.id,
|
||||||
|
m.sheep_id,
|
||||||
|
m.group_id,
|
||||||
|
s.id AS bs_sheep_id,
|
||||||
|
s.bs_manage_tags,
|
||||||
|
s.variety,
|
||||||
|
s.gender,
|
||||||
|
s.name,
|
||||||
|
s.birthday,
|
||||||
|
s.parity,
|
||||||
|
s.month_age,
|
||||||
|
s.breed,
|
||||||
|
s.birth_weight,
|
||||||
|
s.weaning_weight,
|
||||||
|
s.current_weight,
|
||||||
|
s.father_manage_tags,
|
||||||
|
s.mother_manage_tags,
|
||||||
|
s.family
|
||||||
|
FROM bas_sheep_group_mapping m
|
||||||
|
JOIN sheep_file s ON s.id = m.sheep_id
|
||||||
<where>
|
<where>
|
||||||
<if test="sheepId != null "> and sheep_id = #{sheepId}</if>
|
<if test="sheepId != null"> AND m.sheep_id = #{sheepId}</if>
|
||||||
<if test="groupId != null "> and group_id = #{groupId}</if>
|
<if test="groupId != null"> AND m.group_id = #{groupId}</if>
|
||||||
|
<if test="bsManageTags != null and bsManageTags.size > 0">
|
||||||
|
AND s.bs_manage_tags IN
|
||||||
|
<foreach collection="bsManageTags" item="bsManageTag " open="(" separator="," close=")">
|
||||||
|
#{bsManageTag}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
|
ORDER BY m.id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<select id="selectBasSheepGroupMappingById" parameterType="Long" resultMap="BasSheepGroupMappingResult">
|
<select id="selectBasSheepGroupMappingById" parameterType="Long" resultMap="BasSheepGroupMappingResult">
|
||||||
<include refid="selectBasSheepGroupMappingVo"/>
|
<include refid="selectBasSheepGroupMappingVo"/>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
|
@ -6,9 +6,8 @@
|
|||||||
|
|
||||||
<resultMap type="ScFixHoof" id="ScFixHoofResult">
|
<resultMap type="ScFixHoof" id="ScFixHoofResult">
|
||||||
<result property="id" column="id"/>
|
<result property="id" column="id"/>
|
||||||
<result property="manageTags" column="manageTags"/>
|
<result property="sheepId" column="sheep_id"/>
|
||||||
<result property="sheepfold" column="sheepfold"/>
|
<result property="sheepfold" column="sheepfold"/>
|
||||||
<result property="varietyId" column="variety_id"/>
|
|
||||||
<result property="sheepfoldName" column="sheepfoldName"/>
|
<result property="sheepfoldName" column="sheepfoldName"/>
|
||||||
<result property="comment" column="comment"/>
|
<result property="comment" column="comment"/>
|
||||||
<result property="technician" column="technician"/>
|
<result property="technician" column="technician"/>
|
||||||
@ -18,19 +17,15 @@
|
|||||||
|
|
||||||
<sql id="selectScFixHoofVo">
|
<sql id="selectScFixHoofVo">
|
||||||
select fh.id,
|
select fh.id,
|
||||||
bs.manage_tags AS manageTags,
|
fh.sheep_id,
|
||||||
fh.sheepfold,
|
fh.sheepfold,
|
||||||
sf.sheepfold_name AS sheepfoldName,
|
sf.sheepfold_name as sheepfoldName,
|
||||||
fh.variety_id,
|
|
||||||
bv.variety AS varietyName,
|
|
||||||
fh.comment,
|
fh.comment,
|
||||||
fh.technician,
|
fh.technician,
|
||||||
fh.create_by,
|
fh.create_by,
|
||||||
fh.create_time
|
fh.create_time
|
||||||
from sc_fix_hoof fh
|
from sc_fix_hoof fh
|
||||||
left join bas_sheep bs on fh.sheep_id = bs.id
|
|
||||||
left join da_sheepfold sf on fh.sheepfold = sf.id
|
left join da_sheepfold sf on fh.sheepfold = sf.id
|
||||||
left join bas_sheep_variety bv on fh.variety_id = bv.id
|
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectScFixHoofList" parameterType="ScFixHoof" resultMap="ScFixHoofResult">
|
<select id="selectScFixHoofList" parameterType="ScFixHoof" resultMap="ScFixHoofResult">
|
||||||
@ -38,15 +33,9 @@
|
|||||||
<where>
|
<where>
|
||||||
<if test="sheepId != null ">and sheep_id = #{sheepId}</if>
|
<if test="sheepId != null ">and sheep_id = #{sheepId}</if>
|
||||||
<if test="sheepfold != null ">and sheepfold = #{sheepfold}</if>
|
<if test="sheepfold != null ">and sheepfold = #{sheepfold}</if>
|
||||||
<if test="varietyId != null">
|
|
||||||
and fh.variety_id = #{varietyId}
|
|
||||||
</if>
|
|
||||||
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">
|
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">
|
||||||
and create_time between #{params.beginCreateTime} and #{params.endCreateTime}
|
and create_time between #{params.beginCreateTime} and #{params.endCreateTime}
|
||||||
</if>
|
</if>
|
||||||
<if test="manageTags != null and manageTags != ''">
|
|
||||||
and bs.manage_tags like concat('%', #{manageTags}, '%')
|
|
||||||
</if>
|
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@ -55,24 +44,24 @@
|
|||||||
where fh.id = #{id}
|
where fh.id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertScFixHoof" parameterType="ScFixHoof"
|
<insert id="insertScFixHoof" parameterType="ScFixHoof" useGeneratedKeys="true" keyProperty="id">
|
||||||
useGeneratedKeys="true" keyProperty="id">
|
insert into sc_fix_hoof
|
||||||
INSERT INTO sc_fix_hoof
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
(sheep_id,
|
<if test="sheepId != null and sheepId != ''">and fh.sheep_id like concat('%', #{sheepId}, '%')</if>
|
||||||
sheepfold,
|
<if test="sheepfold != null">and fh.sheepfold = #{sheepfold}</if>
|
||||||
variety_id,
|
|
||||||
<if test="comment != null">comment,</if>
|
<if test="comment != null">comment,</if>
|
||||||
<if test="technician != null and technician != ''">technician,</if>
|
<if test="technician != null and technician != ''">technician,</if>
|
||||||
create_by,
|
<if test="createBy != null">create_by,</if>
|
||||||
create_time)
|
<if test="createTime != null">create_time,</if>
|
||||||
VALUES
|
</trim>
|
||||||
(#{sheepId},
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
#{sheepfold},
|
<if test="sheepId != null">#{sheepId},</if>
|
||||||
<if test="varietyId != null">#{varietyId},</if>
|
<if test="sheepfold != null">#{sheepfold},</if>
|
||||||
<if test="comment != null">#{comment},</if>
|
<if test="comment != null">#{comment},</if>
|
||||||
<if test="technician != null and technician != ''">#{technician},</if>
|
<if test="technician != null and technician != ''">#{technician},</if>
|
||||||
#{createBy},
|
<if test="createBy != null">#{createBy},</if>
|
||||||
#{createTime})
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<update id="updateScFixHoof" parameterType="ScFixHoof">
|
<update id="updateScFixHoof" parameterType="ScFixHoof">
|
||||||
@ -80,7 +69,6 @@
|
|||||||
<trim prefix="SET" suffixOverrides=",">
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
<if test="sheepId != null">sheep_id = #{sheepId},</if>
|
<if test="sheepId != null">sheep_id = #{sheepId},</if>
|
||||||
<if test="sheepfold != null">sheepfold = #{sheepfold},</if>
|
<if test="sheepfold != null">sheepfold = #{sheepfold},</if>
|
||||||
<if test="varietyId != null">variety_id=#{varietyId},</if>
|
|
||||||
<if test="comment != null">comment = #{comment},</if>
|
<if test="comment != null">comment = #{comment},</if>
|
||||||
<if test="technician != null and technician != ''">technician = #{technician},</if>
|
<if test="technician != null and technician != ''">technician = #{technician},</if>
|
||||||
<if test="createBy != null">create_by = #{createBy},</if>
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||||||
@ -101,6 +89,4 @@
|
|||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
Loading…
x
Reference in New Issue
Block a user