Compare commits
No commits in common. "4f45e1fcbfe3dd4a7c7b6c2dd67f13dd2eb98a4b" and "898add567d3a7d406d16371a502f7a1451c5acff" have entirely different histories.
4f45e1fcbf
...
898add567d
@ -1,6 +1,5 @@
|
|||||||
package com.zhyc.module.base.controller;
|
package com.zhyc.module.base.controller;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
@ -25,16 +24,20 @@ import com.zhyc.common.core.page.TableDataInfo;
|
|||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/sheep/sheep")
|
@RequestMapping("/sheep/sheep")
|
||||||
public class BasSheepController extends BaseController {
|
public class BasSheepController extends BaseController
|
||||||
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
private IBasSheepService basSheepService;
|
private IBasSheepService basSheepService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private BasSheepMapper basSheepMapper;
|
||||||
/**
|
/**
|
||||||
* 查询羊只基本信息列表
|
* 查询羊只基本信息列表
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('sheep:sheep:list')")
|
@PreAuthorize("@ss.hasPermi('sheep:sheep:list')")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo list(BasSheep basSheep) {
|
public TableDataInfo list(BasSheep basSheep)
|
||||||
|
{
|
||||||
startPage();
|
startPage();
|
||||||
List<BasSheep> list = basSheepService.selectBasSheepList(basSheep);
|
List<BasSheep> list = basSheepService.selectBasSheepList(basSheep);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
@ -46,7 +49,8 @@ public class BasSheepController extends BaseController {
|
|||||||
@PreAuthorize("@ss.hasPermi('sheep:sheep:export')")
|
@PreAuthorize("@ss.hasPermi('sheep:sheep:export')")
|
||||||
@Log(title = "羊只基本信息", businessType = BusinessType.EXPORT)
|
@Log(title = "羊只基本信息", businessType = BusinessType.EXPORT)
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
public void export(HttpServletResponse response, BasSheep basSheep) {
|
public void export(HttpServletResponse response, BasSheep basSheep)
|
||||||
|
{
|
||||||
List<BasSheep> list = basSheepService.selectBasSheepList(basSheep);
|
List<BasSheep> list = basSheepService.selectBasSheepList(basSheep);
|
||||||
ExcelUtil<BasSheep> util = new ExcelUtil<BasSheep>(BasSheep.class);
|
ExcelUtil<BasSheep> util = new ExcelUtil<BasSheep>(BasSheep.class);
|
||||||
util.exportExcel(response, list, "羊只基本信息数据");
|
util.exportExcel(response, list, "羊只基本信息数据");
|
||||||
@ -57,7 +61,8 @@ public class BasSheepController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('sheep:sheep:query')")
|
@PreAuthorize("@ss.hasPermi('sheep:sheep:query')")
|
||||||
@GetMapping(value = "/{id}")
|
@GetMapping(value = "/{id}")
|
||||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||||
|
{
|
||||||
return success(basSheepService.selectBasSheepById(id));
|
return success(basSheepService.selectBasSheepById(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,7 +72,8 @@ public class BasSheepController extends BaseController {
|
|||||||
@PreAuthorize("@ss.hasPermi('sheep:sheep:add')")
|
@PreAuthorize("@ss.hasPermi('sheep:sheep:add')")
|
||||||
@Log(title = "羊只基本信息", businessType = BusinessType.INSERT)
|
@Log(title = "羊只基本信息", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody BasSheep basSheep) {
|
public AjaxResult add(@RequestBody BasSheep basSheep)
|
||||||
|
{
|
||||||
return toAjax(basSheepService.insertBasSheep(basSheep));
|
return toAjax(basSheepService.insertBasSheep(basSheep));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,7 +83,8 @@ public class BasSheepController extends BaseController {
|
|||||||
@PreAuthorize("@ss.hasPermi('sheep:sheep:edit')")
|
@PreAuthorize("@ss.hasPermi('sheep:sheep:edit')")
|
||||||
@Log(title = "羊只基本信息", businessType = BusinessType.UPDATE)
|
@Log(title = "羊只基本信息", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@RequestBody BasSheep basSheep) {
|
public AjaxResult edit(@RequestBody BasSheep basSheep)
|
||||||
|
{
|
||||||
return toAjax(basSheepService.updateBasSheep(basSheep));
|
return toAjax(basSheepService.updateBasSheep(basSheep));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,51 +94,18 @@ public class BasSheepController extends BaseController {
|
|||||||
@PreAuthorize("@ss.hasPermi('sheep:sheep:remove')")
|
@PreAuthorize("@ss.hasPermi('sheep:sheep:remove')")
|
||||||
@Log(title = "羊只基本信息", businessType = BusinessType.DELETE)
|
@Log(title = "羊只基本信息", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{ids}")
|
@DeleteMapping("/{ids}")
|
||||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
public AjaxResult remove(@PathVariable Long[] ids)
|
||||||
|
{
|
||||||
return toAjax(basSheepService.deleteBasSheepByIds(ids));
|
return toAjax(basSheepService.deleteBasSheepByIds(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据耳号查询
|
|
||||||
*/
|
|
||||||
@GetMapping("/byManageTags/{manageTags}")
|
@GetMapping("/byManageTags/{manageTags}")
|
||||||
public AjaxResult byManageTags(@PathVariable String manageTags){
|
public AjaxResult byManageTags(@PathVariable String manageTags){
|
||||||
BasSheep sheep = basSheepService.selectBasSheepByManageTags(manageTags.trim());
|
BasSheep sheep = basSheepService.selectBasSheepByManageTags(manageTags.trim());
|
||||||
return success(sheep);
|
return success(sheep);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据羊只类型ID查询羊只列表
|
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('sheep:sheep:query')")
|
|
||||||
@GetMapping("/listByTypeId")
|
|
||||||
public TableDataInfo listByTypeId(Integer typeId) {
|
|
||||||
if (typeId == null) {
|
|
||||||
// Java 8 中返回空列表的方式,替代 List.of()
|
|
||||||
return getDataTable(new ArrayList<>());
|
|
||||||
}
|
|
||||||
BasSheep query = new BasSheep();
|
|
||||||
query.setTypeId(typeId.longValue());
|
|
||||||
startPage();
|
|
||||||
List<BasSheep> list = basSheepService.selectBasSheepList(query);
|
|
||||||
return getDataTable(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据羊舍ID和羊只类型ID组合查询羊只列表
|
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('sheep:sheep:query')")
|
|
||||||
@GetMapping("/listBySheepfoldAndType")
|
|
||||||
public TableDataInfo listBySheepfoldAndType(Integer sheepfoldId, Integer typeId) {
|
|
||||||
if (sheepfoldId == null || typeId == null) {
|
|
||||||
// Java 8 中返回空列表的方式,替代 List.of()
|
|
||||||
return getDataTable(new ArrayList<>());
|
|
||||||
}
|
|
||||||
BasSheep query = new BasSheep();
|
|
||||||
query.setSheepfoldId(sheepfoldId.longValue());
|
|
||||||
query.setTypeId(typeId.longValue());
|
|
||||||
startPage();
|
|
||||||
List<BasSheep> list = basSheepService.selectBasSheepList(query);
|
|
||||||
return getDataTable(list);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,114 +0,0 @@
|
|||||||
package com.zhyc.module.base.controller;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
|
|
||||||
import com.zhyc.module.base.domain.BasSheep;
|
|
||||||
import com.zhyc.module.base.service.IBasSheepService;
|
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
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.core.controller.BaseController;
|
|
||||||
import com.zhyc.common.core.domain.AjaxResult;
|
|
||||||
import com.zhyc.common.enums.BusinessType;
|
|
||||||
import com.zhyc.module.base.domain.BasSheepType;
|
|
||||||
import com.zhyc.module.base.service.IBasSheepTypeService;
|
|
||||||
import com.zhyc.common.utils.poi.ExcelUtil;
|
|
||||||
import com.zhyc.common.core.page.TableDataInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 羊只类型Controller
|
|
||||||
*
|
|
||||||
* @author ruoyi
|
|
||||||
* @date 2025-07-22
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/base/base")
|
|
||||||
public class BasSheepTypeController extends BaseController
|
|
||||||
{
|
|
||||||
@Autowired
|
|
||||||
private IBasSheepTypeService basSheepTypeService;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private IBasSheepService basSheepService;
|
|
||||||
/**
|
|
||||||
* 查询羊只类型列表
|
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('base:base:list')")
|
|
||||||
@GetMapping("/list")
|
|
||||||
public TableDataInfo list(BasSheepType basSheepType)
|
|
||||||
{
|
|
||||||
startPage();
|
|
||||||
List<BasSheepType> list = basSheepTypeService.selectBasSheepTypeList(basSheepType);
|
|
||||||
return getDataTable(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 导出羊只类型列表
|
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('base:base:export')")
|
|
||||||
@Log(title = "羊只类型", businessType = BusinessType.EXPORT)
|
|
||||||
@PostMapping("/export")
|
|
||||||
public void export(HttpServletResponse response, BasSheepType basSheepType)
|
|
||||||
{
|
|
||||||
List<BasSheepType> list = basSheepTypeService.selectBasSheepTypeList(basSheepType);
|
|
||||||
ExcelUtil<BasSheepType> util = new ExcelUtil<BasSheepType>(BasSheepType.class);
|
|
||||||
util.exportExcel(response, list, "羊只类型数据");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取羊只类型详细信息
|
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('base:base:query')")
|
|
||||||
@GetMapping(value = "/{id}")
|
|
||||||
public AjaxResult getInfo(@PathVariable("id") Integer id)
|
|
||||||
{
|
|
||||||
return success(basSheepTypeService.selectBasSheepTypeById(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增羊只类型
|
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('base:base:add')")
|
|
||||||
@Log(title = "羊只类型", businessType = BusinessType.INSERT)
|
|
||||||
@PostMapping
|
|
||||||
public AjaxResult add(@RequestBody BasSheepType basSheepType)
|
|
||||||
{
|
|
||||||
return toAjax(basSheepTypeService.insertBasSheepType(basSheepType));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改羊只类型
|
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('base:base:edit')")
|
|
||||||
@Log(title = "羊只类型", businessType = BusinessType.UPDATE)
|
|
||||||
@PutMapping
|
|
||||||
public AjaxResult edit(@RequestBody BasSheepType basSheepType)
|
|
||||||
{
|
|
||||||
return toAjax(basSheepTypeService.updateBasSheepType(basSheepType));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除羊只类型
|
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('base:base:remove')")
|
|
||||||
@Log(title = "羊只类型", businessType = BusinessType.DELETE)
|
|
||||||
@DeleteMapping("/{ids}")
|
|
||||||
public AjaxResult remove(@PathVariable Integer[] ids)
|
|
||||||
{
|
|
||||||
return toAjax(basSheepTypeService.deleteBasSheepTypeByIds(ids));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,51 +0,0 @@
|
|||||||
package com.zhyc.module.base.domain;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
|
||||||
import com.zhyc.common.annotation.Excel;
|
|
||||||
import com.zhyc.common.core.domain.BaseEntity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 羊只类型对象 bas_sheep_type
|
|
||||||
*
|
|
||||||
* @author ruoyi
|
|
||||||
* @date 2025-07-22
|
|
||||||
*/
|
|
||||||
public class BasSheepType extends BaseEntity
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/** $column.columnComment */
|
|
||||||
private Integer id;
|
|
||||||
|
|
||||||
/** 羊只类型 */
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
public void setId(Integer id)
|
|
||||||
{
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getId()
|
|
||||||
{
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name)
|
|
||||||
{
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName()
|
|
||||||
{
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
|
||||||
.append("id", getId())
|
|
||||||
.append("name", getName())
|
|
||||||
.toString();
|
|
||||||
}
|
|
||||||
}
|
|
@ -68,6 +68,4 @@ public interface BasSheepMapper
|
|||||||
|
|
||||||
|
|
||||||
List<BasSheep> selectBasSheepBySheepfold(String id);
|
List<BasSheep> selectBasSheepBySheepfold(String id);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,61 +0,0 @@
|
|||||||
package com.zhyc.module.base.mapper;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import com.zhyc.module.base.domain.BasSheepType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 羊只类型Mapper接口
|
|
||||||
*
|
|
||||||
* @author ruoyi
|
|
||||||
* @date 2025-07-22
|
|
||||||
*/
|
|
||||||
public interface BasSheepTypeMapper
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* 查询羊只类型
|
|
||||||
*
|
|
||||||
* @param id 羊只类型主键
|
|
||||||
* @return 羊只类型
|
|
||||||
*/
|
|
||||||
public BasSheepType selectBasSheepTypeById(Integer id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询羊只类型列表
|
|
||||||
*
|
|
||||||
* @param basSheepType 羊只类型
|
|
||||||
* @return 羊只类型集合
|
|
||||||
*/
|
|
||||||
public List<BasSheepType> selectBasSheepTypeList(BasSheepType basSheepType);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增羊只类型
|
|
||||||
*
|
|
||||||
* @param basSheepType 羊只类型
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int insertBasSheepType(BasSheepType basSheepType);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改羊只类型
|
|
||||||
*
|
|
||||||
* @param basSheepType 羊只类型
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int updateBasSheepType(BasSheepType basSheepType);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除羊只类型
|
|
||||||
*
|
|
||||||
* @param id 羊只类型主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteBasSheepTypeById(Integer id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除羊只类型
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的数据主键集合
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteBasSheepTypeByIds(Integer[] ids);
|
|
||||||
}
|
|
@ -59,13 +59,4 @@ public interface BasSheepVarietyMapper
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteBasSheepVarietyByIds(Long[] ids);
|
public int deleteBasSheepVarietyByIds(Long[] ids);
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据品种名称查询品种 ID 用于导入羊只
|
|
||||||
*
|
|
||||||
* @param varietyName 品种名称
|
|
||||||
* @return 品种 ID
|
|
||||||
*/
|
|
||||||
Long selectIdByName(String varietyName);
|
|
||||||
}
|
}
|
||||||
|
@ -61,6 +61,4 @@ public interface IBasSheepService
|
|||||||
public int deleteBasSheepById(Long id);
|
public int deleteBasSheepById(Long id);
|
||||||
|
|
||||||
BasSheep selectBasSheepByManageTags(String trim);
|
BasSheep selectBasSheepByManageTags(String trim);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,65 +0,0 @@
|
|||||||
package com.zhyc.module.base.service;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.zhyc.module.base.domain.BasSheep;
|
|
||||||
import com.zhyc.module.base.domain.BasSheepType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 羊只类型Service接口
|
|
||||||
*
|
|
||||||
* @author ruoyi
|
|
||||||
* @date 2025-07-22
|
|
||||||
*/
|
|
||||||
public interface IBasSheepTypeService
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* 查询羊只类型
|
|
||||||
*
|
|
||||||
* @param id 羊只类型主键
|
|
||||||
* @return 羊只类型
|
|
||||||
*/
|
|
||||||
public BasSheepType selectBasSheepTypeById(Integer id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询羊只类型列表
|
|
||||||
*
|
|
||||||
* @param basSheepType 羊只类型
|
|
||||||
* @return 羊只类型集合
|
|
||||||
*/
|
|
||||||
public List<BasSheepType> selectBasSheepTypeList(BasSheepType basSheepType);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增羊只类型
|
|
||||||
*
|
|
||||||
* @param basSheepType 羊只类型
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int insertBasSheepType(BasSheepType basSheepType);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改羊只类型
|
|
||||||
*
|
|
||||||
* @param basSheepType 羊只类型
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int updateBasSheepType(BasSheepType basSheepType);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除羊只类型
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的羊只类型主键集合
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteBasSheepTypeByIds(Integer[] ids);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除羊只类型信息
|
|
||||||
*
|
|
||||||
* @param id 羊只类型主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteBasSheepTypeById(Integer id);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -99,7 +99,4 @@ public class BasSheepServiceImpl implements IBasSheepService
|
|||||||
public BasSheep selectBasSheepByManageTags(String manageTags){
|
public BasSheep selectBasSheepByManageTags(String manageTags){
|
||||||
return basSheepMapper.selectBasSheepByManageTags(manageTags);
|
return basSheepMapper.selectBasSheepByManageTags(manageTags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,89 +0,0 @@
|
|||||||
package com.zhyc.module.base.service.impl;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.zhyc.module.base.domain.BasSheep;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import com.zhyc.module.base.mapper.BasSheepTypeMapper;
|
|
||||||
import com.zhyc.module.base.domain.BasSheepType;
|
|
||||||
import com.zhyc.module.base.service.IBasSheepTypeService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 羊只类型Service业务层处理
|
|
||||||
*
|
|
||||||
* @author ruoyi
|
|
||||||
* @date 2025-07-22
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class BasSheepTypeServiceImpl implements IBasSheepTypeService {
|
|
||||||
@Autowired
|
|
||||||
private BasSheepTypeMapper basSheepTypeMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询羊只类型
|
|
||||||
*
|
|
||||||
* @param id 羊只类型主键
|
|
||||||
* @return 羊只类型
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public BasSheepType selectBasSheepTypeById(Integer id) {
|
|
||||||
return basSheepTypeMapper.selectBasSheepTypeById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询羊只类型列表
|
|
||||||
*
|
|
||||||
* @param basSheepType 羊只类型
|
|
||||||
* @return 羊只类型
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<BasSheepType> selectBasSheepTypeList(BasSheepType basSheepType) {
|
|
||||||
return basSheepTypeMapper.selectBasSheepTypeList(basSheepType);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增羊只类型
|
|
||||||
*
|
|
||||||
* @param basSheepType 羊只类型
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int insertBasSheepType(BasSheepType basSheepType) {
|
|
||||||
return basSheepTypeMapper.insertBasSheepType(basSheepType);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改羊只类型
|
|
||||||
*
|
|
||||||
* @param basSheepType 羊只类型
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int updateBasSheepType(BasSheepType basSheepType) {
|
|
||||||
return basSheepTypeMapper.updateBasSheepType(basSheepType);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除羊只类型
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的羊只类型主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteBasSheepTypeByIds(Integer[] ids) {
|
|
||||||
return basSheepTypeMapper.deleteBasSheepTypeByIds(ids);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除羊只类型信息
|
|
||||||
*
|
|
||||||
* @param id 羊只类型主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteBasSheepTypeById(Integer id) {
|
|
||||||
return basSheepTypeMapper.deleteBasSheepTypeById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -29,11 +29,9 @@ public class ScTransGroup extends BaseEntity {
|
|||||||
/**
|
/**
|
||||||
* 羊只id
|
* 羊只id
|
||||||
*/
|
*/
|
||||||
// @Excel(name = "羊只id")
|
@Excel(name = "羊只id")
|
||||||
private Integer sheepId;
|
private Integer sheepId;
|
||||||
|
|
||||||
@Excel(name = "耳号")
|
|
||||||
private String manageTags;
|
|
||||||
/**
|
/**
|
||||||
* 转入羊舍
|
* 转入羊舍
|
||||||
*/
|
*/
|
||||||
|
@ -2,7 +2,6 @@ package com.zhyc.module.produce.manage_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.mapper.BasSheepVarietyMapper;
|
|
||||||
import com.zhyc.module.produce.manage_sheep.domain.ScAddSheep;
|
import com.zhyc.module.produce.manage_sheep.domain.ScAddSheep;
|
||||||
import com.zhyc.module.produce.manage_sheep.mapper.ScAddSheepMapper;
|
import com.zhyc.module.produce.manage_sheep.mapper.ScAddSheepMapper;
|
||||||
import com.zhyc.module.produce.manage_sheep.service.IScAddSheepService;
|
import com.zhyc.module.produce.manage_sheep.service.IScAddSheepService;
|
||||||
@ -28,8 +27,6 @@ public class ScAddSheepServiceImpl implements IScAddSheepService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IBasSheepService basSheepService;
|
private IBasSheepService basSheepService;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private BasSheepVarietyMapper basSheepVarietyMapper; // 假设你有这个 mapper
|
|
||||||
@Override
|
@Override
|
||||||
public boolean insertScAddSheep(ScAddSheep scAddSheep) {
|
public boolean insertScAddSheep(ScAddSheep scAddSheep) {
|
||||||
// 1. 重复校验
|
// 1. 重复校验
|
||||||
@ -78,7 +75,7 @@ public class ScAddSheepServiceImpl implements IScAddSheepService {
|
|||||||
return scAddSheepMapper.deleteScAddSheepByIds(ids) > 0;
|
return scAddSheepMapper.deleteScAddSheepByIds(ids) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------ 导入 ------------------ */
|
/* ------------------ 导入:羊舍名称 → ID ------------------ */
|
||||||
@Override
|
@Override
|
||||||
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()) {
|
||||||
@ -91,32 +88,12 @@ public class ScAddSheepServiceImpl implements IScAddSheepService {
|
|||||||
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 {
|
||||||
/* 0. 品种名称 → 品种 ID(必须最先处理) */
|
|
||||||
if (StringUtils.isNotBlank(sheep.getVarietyName())) {
|
|
||||||
Long varietyId = basSheepVarietyMapper.selectIdByName(sheep.getVarietyName());
|
|
||||||
if (varietyId == null) {
|
|
||||||
failure++;
|
|
||||||
failureMsg.append("<br/>第")
|
|
||||||
.append(i + 1)
|
|
||||||
.append("行:品种名称不存在【")
|
|
||||||
.append(sheep.getVarietyName())
|
|
||||||
.append("】");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
sheep.setVarietyId(varietyId.intValue());
|
|
||||||
} else {
|
|
||||||
failure++;
|
|
||||||
failureMsg.append("<br/>第")
|
|
||||||
.append(i + 1)
|
|
||||||
.append("行:品种不能为空");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 1. 羊舍名称 → ID */
|
/* 1. 羊舍名称 → ID */
|
||||||
if (StringUtils.isNotBlank(sheep.getSheepfoldNameExcel())) {
|
if (StringUtils.isNotBlank(sheep.getSheepfoldNameExcel())) {
|
||||||
DaSheepfold param = new DaSheepfold();
|
DaSheepfold param = new DaSheepfold();
|
||||||
param.setSheepfoldName(sheep.getSheepfoldNameExcel());
|
param.setSheepfoldName(sheep.getSheepfoldNameExcel());
|
||||||
List<DaSheepfold> foldList = daSheepfoldMapper.selectDaSheepfoldList(param);
|
List<DaSheepfold> foldList = daSheepfoldMapper.selectDaSheepfoldList(param);
|
||||||
|
|
||||||
if (foldList == null || foldList.isEmpty()) {
|
if (foldList == null || foldList.isEmpty()) {
|
||||||
failure++;
|
failure++;
|
||||||
failureMsg.append("<br/>第")
|
failureMsg.append("<br/>第")
|
||||||
@ -138,7 +115,7 @@ public class ScAddSheepServiceImpl implements IScAddSheepService {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 3. 耳号重复校验 */
|
/* 3. 耳号重复校验(增量导入核心) */
|
||||||
ScAddSheep exist = scAddSheepMapper.selectByEarNumber(sheep.getEarNumber());
|
ScAddSheep exist = scAddSheepMapper.selectByEarNumber(sheep.getEarNumber());
|
||||||
if (exist != null) {
|
if (exist != null) {
|
||||||
failure++;
|
failure++;
|
||||||
@ -159,7 +136,6 @@ public class ScAddSheepServiceImpl implements IScAddSheepService {
|
|||||||
insertScAddSheep(sheep);
|
insertScAddSheep(sheep);
|
||||||
}
|
}
|
||||||
success++;
|
success++;
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
failure++;
|
failure++;
|
||||||
failureMsg.append("<br/>第")
|
failureMsg.append("<br/>第")
|
||||||
|
@ -3,12 +3,18 @@ package com.zhyc.module.produce.other.controller;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import com.zhyc.common.utils.StringUtils;
|
|
||||||
import com.zhyc.module.produce.other.domain.ScFixHoof;
|
import com.zhyc.module.produce.other.domain.ScFixHoof;
|
||||||
import com.zhyc.module.produce.other.service.IScFixHoofService;
|
import com.zhyc.module.produce.other.service.IScFixHoofService;
|
||||||
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.*;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
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;
|
||||||
@ -66,26 +72,14 @@ public class ScFixHoofController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增修蹄记录(支持批量)
|
* 新增修蹄
|
||||||
* @return 结果
|
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('produce:fixHoof:add')")
|
@PreAuthorize("@ss.hasPermi('produce:fixHoof:add')")
|
||||||
@Log(title = "修蹄", businessType = BusinessType.INSERT)
|
@Log(title = "修蹄", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody List<ScFixHoof> dtos) {
|
public AjaxResult add(@RequestBody ScFixHoof dto){
|
||||||
// 处理多条修蹄记录
|
dto.setSheepId(scFixHoofService.findIdByManageTags(dto.getManageTags()).intValue());
|
||||||
for (ScFixHoof dto : dtos) {
|
return toAjax(scFixHoofService.insertScFixHoof(dto));
|
||||||
// 验证羊只ID
|
|
||||||
if (dto.getSheepId() == null && StringUtils.isNotBlank(dto.getManageTags())) {
|
|
||||||
// 通过管理耳号查找羊只ID
|
|
||||||
Long sheepId = scFixHoofService.findIdByManageTags(dto.getManageTags());
|
|
||||||
dto.setSheepId(sheepId.intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
// 保存修蹄记录
|
|
||||||
scFixHoofService.insertScFixHoof(dto);
|
|
||||||
}
|
|
||||||
return toAjax(dtos.size());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -111,6 +105,4 @@ public class ScFixHoofController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,11 +28,8 @@ public class ScCastrate extends BaseEntity {
|
|||||||
/**
|
/**
|
||||||
* 羊只id
|
* 羊只id
|
||||||
*/
|
*/
|
||||||
// @Excel(name = "羊只id")
|
@Excel(name = "羊只id")
|
||||||
private String sheepId;
|
private String sheepId;
|
||||||
/** 耳号(非数据库字段,用于前端) */
|
|
||||||
@Excel(name = "耳号")
|
|
||||||
private String manageTags; // 新增
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 羊舍id
|
* 羊舍id
|
||||||
|
@ -28,6 +28,7 @@ public class ScFixHoof extends BaseEntity
|
|||||||
private Integer sheepId;
|
private Integer sheepId;
|
||||||
/** 管理耳号(仅用于接收参数/返回视图,不存库) */
|
/** 管理耳号(仅用于接收参数/返回视图,不存库) */
|
||||||
@Excel(name = "管理耳号")
|
@Excel(name = "管理耳号")
|
||||||
|
// @TableField(exist = false) // ← 非数据库字段
|
||||||
private String manageTags;
|
private String manageTags;
|
||||||
|
|
||||||
/** 羊舍id */
|
/** 羊舍id */
|
||||||
|
@ -3,7 +3,6 @@ package com.zhyc.module.produce.other.mapper;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.zhyc.module.produce.other.domain.ScFixHoof;
|
import com.zhyc.module.produce.other.domain.ScFixHoof;
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修蹄Mapper接口
|
* 修蹄Mapper接口
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.zhyc.module.produce.other.service;
|
package com.zhyc.module.produce.other.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.zhyc.module.produce.other.domain.ScFixHoof;
|
import com.zhyc.module.produce.other.domain.ScFixHoof;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -5,15 +5,13 @@ import java.util.List;
|
|||||||
import com.zhyc.common.exception.ServiceException;
|
import com.zhyc.common.exception.ServiceException;
|
||||||
import com.zhyc.common.utils.DateUtils;
|
import com.zhyc.common.utils.DateUtils;
|
||||||
import com.zhyc.common.utils.StringUtils;
|
import com.zhyc.common.utils.StringUtils;
|
||||||
import com.zhyc.module.base.domain.BasSheep;
|
|
||||||
import com.zhyc.module.base.mapper.BasSheepMapper;
|
|
||||||
import com.zhyc.module.base.service.IDaSheepfoldService;
|
|
||||||
import com.zhyc.module.produce.other.domain.ScFixHoof;
|
import com.zhyc.module.produce.other.domain.ScFixHoof;
|
||||||
import com.zhyc.module.produce.other.mapper.ScFixHoofMapper;
|
import com.zhyc.module.produce.other.mapper.ScFixHoofMapper;
|
||||||
import com.zhyc.module.produce.other.service.IScFixHoofService;
|
import com.zhyc.module.base.domain.BasSheep;
|
||||||
|
import com.zhyc.module.base.mapper.BasSheepMapper;
|
||||||
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 com.zhyc.module.produce.other.service.IScFixHoofService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修蹄Service业务层处理
|
* 修蹄Service业务层处理
|
||||||
@ -29,8 +27,6 @@ public class ScFixHoofServiceImpl implements IScFixHoofService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private BasSheepMapper basSheepMapper;
|
private BasSheepMapper basSheepMapper;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private IDaSheepfoldService daSheepfoldService;
|
|
||||||
/**
|
/**
|
||||||
* 查询修蹄
|
* 查询修蹄
|
||||||
*
|
*
|
||||||
|
@ -92,7 +92,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectBasSheepById" parameterType="java.lang.Long" resultType="com.zhyc.module.base.domain.BasSheep">
|
<select id="selectBasSheepById" parameterType="java.lang.Long" resultType="BasSheep">
|
||||||
SELECT s.id,
|
SELECT s.id,
|
||||||
s.sheepfold_id AS sheepfoldId,
|
s.sheepfold_id AS sheepfoldId,
|
||||||
sf.sheepfold_name AS sheepfoldName,
|
sf.sheepfold_name AS sheepfoldName,
|
||||||
@ -119,7 +119,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
<insert id="insertBasSheep" parameterType="BasSheep" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertBasSheep" parameterType="BasSheep" useGeneratedKeys="true" keyProperty="id">
|
||||||
insert into bas_sheep
|
insert into bas_sheep
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
@ -1,56 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<!DOCTYPE mapper
|
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.zhyc.module.base.mapper.BasSheepTypeMapper">
|
|
||||||
|
|
||||||
<resultMap type="BasSheepType" id="BasSheepTypeResult">
|
|
||||||
<result property="id" column="id" />
|
|
||||||
<result property="name" column="name" />
|
|
||||||
</resultMap>
|
|
||||||
|
|
||||||
<sql id="selectBasSheepTypeVo">
|
|
||||||
select id, name from bas_sheep_type
|
|
||||||
</sql>
|
|
||||||
|
|
||||||
<select id="selectBasSheepTypeList" parameterType="BasSheepType" resultMap="BasSheepTypeResult">
|
|
||||||
<include refid="selectBasSheepTypeVo"/>
|
|
||||||
<where>
|
|
||||||
<if test="name != null and name != ''"> and name = #{name}</if>
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="selectBasSheepTypeById" parameterType="Integer" resultMap="BasSheepTypeResult">
|
|
||||||
<include refid="selectBasSheepTypeVo"/>
|
|
||||||
where id = #{id}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<insert id="insertBasSheepType" parameterType="BasSheepType" useGeneratedKeys="true" keyProperty="id">
|
|
||||||
insert into bas_sheep_type
|
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
||||||
<if test="name != null">name,</if>
|
|
||||||
</trim>
|
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
||||||
<if test="name != null">#{name},</if>
|
|
||||||
</trim>
|
|
||||||
</insert>
|
|
||||||
|
|
||||||
<update id="updateBasSheepType" parameterType="BasSheepType">
|
|
||||||
update bas_sheep_type
|
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
|
||||||
<if test="name != null">name = #{name},</if>
|
|
||||||
</trim>
|
|
||||||
where id = #{id}
|
|
||||||
</update>
|
|
||||||
|
|
||||||
<delete id="deleteBasSheepTypeById" parameterType="Integer">
|
|
||||||
delete from bas_sheep_type where id = #{id}
|
|
||||||
</delete>
|
|
||||||
|
|
||||||
<delete id="deleteBasSheepTypeByIds" parameterType="String">
|
|
||||||
delete from bas_sheep_type where id in
|
|
||||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
||||||
#{id}
|
|
||||||
</foreach>
|
|
||||||
</delete>
|
|
||||||
</mapper>
|
|
@ -53,11 +53,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<select id="selectIdByName" parameterType="string" resultType="java.lang.Long">
|
|
||||||
SELECT id
|
|
||||||
FROM bas_sheep_variety
|
|
||||||
WHERE variety = #{varietyName}
|
|
||||||
LIMIT 1
|
|
||||||
</select>
|
|
||||||
</mapper>
|
</mapper>
|
@ -7,7 +7,6 @@
|
|||||||
<resultMap type="ScTransGroup" id="ScTransGroupResult">
|
<resultMap type="ScTransGroup" id="ScTransGroupResult">
|
||||||
<result property="id" column="id"/>
|
<result property="id" column="id"/>
|
||||||
<result property="sheepId" column="sheep_id"/>
|
<result property="sheepId" column="sheep_id"/>
|
||||||
<result property="manageTags" column="manageTags"/>
|
|
||||||
<result property="foldTo" column="fold_to"/>
|
<result property="foldTo" column="fold_to"/>
|
||||||
<result property="foldFrom" column="fold_from"/>
|
<result property="foldFrom" column="fold_from"/>
|
||||||
<result property="reason" column="reason"/>
|
<result property="reason" column="reason"/>
|
||||||
@ -23,7 +22,6 @@
|
|||||||
<sql id="selectScTransGroupVo">
|
<sql id="selectScTransGroupVo">
|
||||||
SELECT tg.id,
|
SELECT tg.id,
|
||||||
tg.sheep_id,
|
tg.sheep_id,
|
||||||
s.manage_tags AS manageTags,
|
|
||||||
tg.fold_to,
|
tg.fold_to,
|
||||||
tg.fold_from,
|
tg.fold_from,
|
||||||
tg.reason,
|
tg.reason,
|
||||||
@ -37,7 +35,6 @@
|
|||||||
sf_from.sheepfold_name AS foldFromName,
|
sf_from.sheepfold_name AS foldFromName,
|
||||||
sf_to.sheepfold_name AS foldToName
|
sf_to.sheepfold_name AS foldToName
|
||||||
FROM sc_trans_group tg
|
FROM sc_trans_group tg
|
||||||
LEFT JOIN bas_sheep s ON tg.sheep_id = s.id
|
|
||||||
LEFT JOIN da_sheepfold sf_from ON tg.fold_from = sf_from.id
|
LEFT JOIN da_sheepfold sf_from ON tg.fold_from = sf_from.id
|
||||||
LEFT JOIN da_sheepfold sf_to ON tg.fold_to = sf_to.id
|
LEFT JOIN da_sheepfold sf_to ON tg.fold_to = sf_to.id
|
||||||
LEFT JOIN bas_sheep_variety bv ON tg.variety_id = bv.id
|
LEFT JOIN bas_sheep_variety bv ON tg.variety_id = bv.id
|
||||||
@ -47,9 +44,6 @@
|
|||||||
<include refid="selectScTransGroupVo"/>
|
<include refid="selectScTransGroupVo"/>
|
||||||
<where>
|
<where>
|
||||||
<if test="sheepId != null">and sheep_id = #{sheepId}</if>
|
<if test="sheepId != null">and sheep_id = #{sheepId}</if>
|
||||||
<if test="manageTags != null and manageTags != ''">
|
|
||||||
and s.manage_tags like concat('%', #{manageTags}, '%')
|
|
||||||
</if>
|
|
||||||
<if test="foldTo != null and foldTo != ''">and fold_to = #{foldTo}</if>
|
<if test="foldTo != null and foldTo != ''">and fold_to = #{foldTo}</if>
|
||||||
<if test="foldFrom != null and foldFrom != ''">and fold_from = #{foldFrom}</if>
|
<if test="foldFrom != null and foldFrom != ''">and fold_from = #{foldFrom}</if>
|
||||||
<if test="status != null">and status = #{status}</if>
|
<if test="status != null">and status = #{status}</if>
|
||||||
|
@ -7,12 +7,9 @@
|
|||||||
<resultMap type="ScCastrate" id="ScCastrateResult">
|
<resultMap type="ScCastrate" id="ScCastrateResult">
|
||||||
<result property="id" column="id"/>
|
<result property="id" column="id"/>
|
||||||
<result property="sheepId" column="sheep_id"/>
|
<result property="sheepId" column="sheep_id"/>
|
||||||
<result property="manageTags" column="manageTags"/> <!-- 新增耳号映射 -->
|
|
||||||
<result property="sheepfold" column="sheepfold"/>
|
<result property="sheepfold" column="sheepfold"/>
|
||||||
<result property="sheepfoldName" column="sheepfoldName"/>
|
|
||||||
<result property="varietyId" column="variety_id"/>
|
|
||||||
<result property="varietyName" column="varietyName"/>
|
|
||||||
<result property="comment" column="comment"/>
|
<result property="comment" column="comment"/>
|
||||||
|
<result property="varietyId" column="variety_id"/>
|
||||||
<result property="technician" column="technician"/>
|
<result property="technician" column="technician"/>
|
||||||
<result property="createBy" column="create_by"/>
|
<result property="createBy" column="create_by"/>
|
||||||
<result property="createTime" column="create_time"/>
|
<result property="createTime" column="create_time"/>
|
||||||
@ -21,7 +18,6 @@
|
|||||||
<sql id="selectScCastrateVo">
|
<sql id="selectScCastrateVo">
|
||||||
select sc.id,
|
select sc.id,
|
||||||
sc.sheep_id,
|
sc.sheep_id,
|
||||||
bs.manage_tags as manageTags, -- 关联羊只表的耳号
|
|
||||||
sc.sheepfold,
|
sc.sheepfold,
|
||||||
sf.sheepfold_name as sheepfoldName,
|
sf.sheepfold_name as sheepfoldName,
|
||||||
sc.variety_id,
|
sc.variety_id,
|
||||||
@ -31,7 +27,6 @@
|
|||||||
sc.create_by,
|
sc.create_by,
|
||||||
sc.create_time
|
sc.create_time
|
||||||
from sc_castrate sc
|
from sc_castrate sc
|
||||||
left join bas_sheep bs on sc.sheep_id = bs.id -- 关联羊只表获取耳号
|
|
||||||
left join da_sheepfold sf on sc.sheepfold = sf.id
|
left join da_sheepfold sf on sc.sheepfold = sf.id
|
||||||
left join bas_sheep_variety bv on sc.variety_id = bv.id
|
left join bas_sheep_variety bv on sc.variety_id = bv.id
|
||||||
</sql>
|
</sql>
|
||||||
@ -39,16 +34,16 @@
|
|||||||
<select id="selectScCastrateList" parameterType="ScCastrate" resultMap="ScCastrateResult">
|
<select id="selectScCastrateList" parameterType="ScCastrate" resultMap="ScCastrateResult">
|
||||||
<include refid="selectScCastrateVo"/>
|
<include refid="selectScCastrateVo"/>
|
||||||
<where>
|
<where>
|
||||||
<!-- 替换原sheepId条件为耳号条件 -->
|
<if test="sheepId != null and sheepId != ''">and sheep_id like concat('%', #{sheepId}, '%')</if>
|
||||||
<if test="manageTags != null and manageTags != ''">
|
<if test="sheepfold != null ">and sheepfold like concat('%', #{sheepfold}, '%')</if>
|
||||||
and bs.manage_tags like concat('%', #{manageTags}, '%')
|
<if test="varietyId != null">
|
||||||
|
and sc.variety_id = #{varietyId}
|
||||||
</if>
|
</if>
|
||||||
<if test="sheepfold != null ">and sc.sheepfold = #{sheepfold}</if>
|
<if test="technician != null and technician != ''">and technician like concat('%', #{technician}, '%')</if>
|
||||||
<if test="varietyId != null">and sc.variety_id = #{varietyId}</if>
|
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">
|
||||||
<if test="technician != null and technician != ''">and sc.technician like concat('%', #{technician}, '%')</if>
|
and create_time between #{params.beginCreateTime} and #{params.endCreateTime}
|
||||||
<if test="params.beginCreateTime != null and params.endCreateTime != null">
|
|
||||||
and sc.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
|
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
@ -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