Compare commits

..

No commits in common. "e7b5a97e0dbfa780a5d73405fccee421e1aa6123" and "465246929949f0d751f54c817631931757579a8c" have entirely different histories.

18 changed files with 141 additions and 299 deletions

View File

@ -31,7 +31,8 @@ import com.zhyc.common.core.page.TableDataInfo;
*/ */
@RestController @RestController
@RequestMapping("produce/manage_sheep/trans_group") @RequestMapping("produce/manage_sheep/trans_group")
public class ScTransGroupController extends BaseController { public class ScTransGroupController extends BaseController
{
@Autowired @Autowired
private IScTransGroupService scTransGroupService; private IScTransGroupService scTransGroupService;
@ -40,7 +41,8 @@ public class ScTransGroupController extends BaseController {
*/ */
@PreAuthorize("@ss.hasPermi('produce:trans_group:list')") @PreAuthorize("@ss.hasPermi('produce:trans_group:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(ScTransGroup scTransGroup) { public TableDataInfo list(ScTransGroup scTransGroup)
{
startPage(); startPage();
List<ScTransGroup> list = scTransGroupService.selectScTransGroupList(scTransGroup); List<ScTransGroup> list = scTransGroupService.selectScTransGroupList(scTransGroup);
return getDataTable(list); return getDataTable(list);
@ -63,7 +65,8 @@ public class ScTransGroupController extends BaseController {
*/ */
@PreAuthorize("@ss.hasPermi('produce:trans_group:query')") @PreAuthorize("@ss.hasPermi('produce:trans_group:query')")
@GetMapping(value = "/{id}") @GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Integer id) { public AjaxResult getInfo(@PathVariable("id") Integer id)
{
return success(scTransGroupService.selectScTransGroupById(id)); return success(scTransGroupService.selectScTransGroupById(id));
} }
@ -73,7 +76,8 @@ public class ScTransGroupController extends BaseController {
@PreAuthorize("@ss.hasPermi('produce:trans_group:add')") @PreAuthorize("@ss.hasPermi('produce:trans_group:add')")
@Log(title = "转群记录", businessType = BusinessType.INSERT) @Log(title = "转群记录", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody ScTransGroup scTransGroup) { public AjaxResult add(@RequestBody ScTransGroup scTransGroup)
{
return toAjax(scTransGroupService.insertScTransGroup(scTransGroup)); return toAjax(scTransGroupService.insertScTransGroup(scTransGroup));
} }
@ -83,7 +87,8 @@ public class ScTransGroupController extends BaseController {
@PreAuthorize("@ss.hasPermi('produce:trans_group:edit')") @PreAuthorize("@ss.hasPermi('produce:trans_group:edit')")
@Log(title = "转群记录", businessType = BusinessType.UPDATE) @Log(title = "转群记录", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody ScTransGroup scTransGroup) { public AjaxResult edit(@RequestBody ScTransGroup scTransGroup)
{
return toAjax(scTransGroupService.updateScTransGroup(scTransGroup)); return toAjax(scTransGroupService.updateScTransGroup(scTransGroup));
} }
@ -93,7 +98,8 @@ public class ScTransGroupController extends BaseController {
@PreAuthorize("@ss.hasPermi('produce:trans_group:remove')") @PreAuthorize("@ss.hasPermi('produce:trans_group:remove')")
@Log(title = "转群记录", businessType = BusinessType.DELETE) @Log(title = "转群记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}") @DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Integer[] ids) { public AjaxResult remove(@PathVariable Integer[] ids)
{
return toAjax(scTransGroupService.deleteScTransGroupByIds(ids)); return toAjax(scTransGroupService.deleteScTransGroupByIds(ids));
} }
} }

View File

@ -18,83 +18,59 @@ import org.springframework.beans.factory.annotation.Autowired;
@Data @Data
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
public class ScTransGroup extends BaseEntity { public class ScTransGroup extends BaseEntity
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /** $column.columnComment */
* $column.columnComment
*/
private Integer id; private Integer id;
/** /** 羊只id */
* 羊只id
*/
@Excel(name = "羊只id") @Excel(name = "羊只id")
private Integer sheepId; private Integer sheepId;
/** /** 转入羊舍 */
* 转入羊舍
*/
private String foldTo; private String foldTo;
/** /** 转出羊舍 */
* 转出羊舍
*/
private String foldFrom; private String foldFrom;
/** /** 转出羊舍名称 */
* 转出羊舍名称
*/
@Excel(name = "转出羊舍") @Excel(name = "转出羊舍")
private String foldFromName; private String foldFromName;
/** /** 转入羊舍名称 */
* 转入羊舍名称
*/
@Excel(name = "转入羊舍") @Excel(name = "转入羊舍")
private String foldToName; private String foldToName;
/** 转群原因 */ /** 转群原因 */
/** /** 品种id */
* 品种id
*/
private Long varietyId; private Long varietyId;
/** /** 品种名称(联表查询返回,非数据库字段) */
* 品种名称联表查询返回非数据库字段
*/
@Excel(name = "品种") @Excel(name = "品种")
private String varietyName; private String varietyName;
private Integer reason; private Integer reason;
/** /** 转群原因描述 用于导出*/
* 转群原因描述 用于导出
*/
@Excel(name = "转群原因") @Excel(name = "转群原因")
private String reasonText; private String reasonText;
/** /** 技术员 */
* 技术员
*/
@Excel(name = "技术员") @Excel(name = "技术员")
private String technician; private String technician;
/** /** 状态 */
* 状态
*/
private Integer status; private Integer status;
/** /** 状态描述 用于导出*/
* 状态描述 用于导出
*/
@Excel(name = "状态") @Excel(name = "状态")
private String statusText; private String statusText;
/** /** 备注 */
* 备注
*/
@Excel(name = "备注") @Excel(name = "备注")
private String comment; private String comment;
} }

View File

@ -1,7 +1,6 @@
package com.zhyc.module.produce.manage_sheep.trans_group.mapper; package com.zhyc.module.produce.manage_sheep.trans_group.mapper;
import java.util.List; import java.util.List;
import com.zhyc.module.produce.manage_sheep.trans_group.domain.ScTransGroup; import com.zhyc.module.produce.manage_sheep.trans_group.domain.ScTransGroup;
/** /**
@ -10,7 +9,8 @@ import com.zhyc.module.produce.manage_sheep.trans_group.domain.ScTransGroup;
* @author ruoyi * @author ruoyi
* @date 2025-07-10 * @date 2025-07-10
*/ */
public interface ScTransGroupMapper { public interface ScTransGroupMapper
{
/** /**
* 查询转群记录 * 查询转群记录
* *

View File

@ -1,7 +1,6 @@
package com.zhyc.module.produce.manage_sheep.trans_group.service; package com.zhyc.module.produce.manage_sheep.trans_group.service;
import java.util.List; import java.util.List;
import com.zhyc.module.produce.manage_sheep.trans_group.domain.ScTransGroup; import com.zhyc.module.produce.manage_sheep.trans_group.domain.ScTransGroup;
/** /**
@ -10,7 +9,8 @@ import com.zhyc.module.produce.manage_sheep.trans_group.domain.ScTransGroup;
* @author ruoyi * @author ruoyi
* @date 2025-07-10 * @date 2025-07-10
*/ */
public interface IScTransGroupService { public interface IScTransGroupService
{
/** /**
* 查询转群记录 * 查询转群记录
* *

View File

@ -17,69 +17,38 @@ import com.zhyc.common.core.domain.BaseEntity;
@Data @Data
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
public class ScTransitionInfo extends BaseEntity { public class ScTransitionInfo extends BaseEntity
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /** */
*
*/
private Integer id; private Integer id;
/** /** 羊只id */
* 羊只id
*/
@Excel(name = "羊只id") @Excel(name = "羊只id")
private Integer sheepId; private Integer sheepId;
/** /** 转入牧场 */
* 品种id
*/
private Long varietyId;
/**
* 品种名称联表返回非数据库字段
*/
@Excel(name = "品种")
private String varietyName;
/**
* 转入牧场
*/
@Excel(name = "转入牧场") @Excel(name = "转入牧场")
private String transTo; private String transTo;
/** /** 当前牧场 */
* 当前牧场
*/
@Excel(name = "当前牧场") @Excel(name = "当前牧场")
private String transFrom; private String transFrom;
/** /** 转场类型 */
* 转场类型 @Excel(name = "转场类型")
*/
private Integer transType; private Integer transType;
/** /** 技术员 */
* 转场类型名称 只用于导出
*/
@Excel(name = "转场类型")
private String transTypeText;
/**
* 技术员
*/
@Excel(name = "技术员") @Excel(name = "技术员")
private String technician; private String technician;
/** /** 状态 */
* 状态
*/
@Excel(name = "状态") @Excel(name = "状态")
private Integer status; private Integer status;
/** /** 备注 */
* 备注
*/
@Excel(name = "备注") @Excel(name = "备注")
private String comment; private String comment;

View File

@ -77,9 +77,9 @@ public class ScFixHoofController extends BaseController
@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 ScFixHoof dto){ public AjaxResult add(@RequestBody ScFixHoof scFixHoof)
dto.setSheepId(scFixHoofService.findIdByManageTags(dto.getManageTags()).intValue()); {
return toAjax(scFixHoofService.insertScFixHoof(dto)); return toAjax(scFixHoofService.insertScFixHoof(scFixHoof));
} }
/** /**
@ -88,9 +88,9 @@ public class ScFixHoofController extends BaseController
@PreAuthorize("@ss.hasPermi('produce:fixHoof:edit')") @PreAuthorize("@ss.hasPermi('produce:fixHoof:edit')")
@Log(title = "修蹄", businessType = BusinessType.UPDATE) @Log(title = "修蹄", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody ScFixHoof dto){ public AjaxResult edit(@RequestBody ScFixHoof scFixHoof)
dto.setSheepId(scFixHoofService.findIdByManageTags(dto.getManageTags()).intValue()); {
return toAjax(scFixHoofService.updateScFixHoof(dto)); return toAjax(scFixHoofService.updateScFixHoof(scFixHoof));
} }
/** /**

View File

@ -25,11 +25,8 @@ public class ScFixHoof extends BaseEntity
private Integer id; private Integer id;
/** 羊只id */ /** 羊只id */
@Excel(name = "羊只id")
private Integer sheepId; private Integer sheepId;
/** 管理耳号(仅用于接收参数/返回视图,不存库) */
@Excel(name = "管理耳号")
// @TableField(exist = false) // 非数据库字段
private String manageTags;
/** 羊舍id */ /** 羊舍id */
private Integer sheepfold; private Integer sheepfold;

View File

@ -1,10 +1,7 @@
package com.zhyc.module.produce.other.fixHoof.mapper; package com.zhyc.module.produce.other.fixHoof.mapper;
import java.util.List; import java.util.List;
import com.zhyc.module.produce.other.fixHoof.domain.ScFixHoof; import com.zhyc.module.produce.other.fixHoof.domain.ScFixHoof;
import com.zhyc.module.produce.sheep.domain.BasSheep;
import org.apache.ibatis.annotations.Param;
/** /**
* 修蹄Mapper接口 * 修蹄Mapper接口
@ -12,7 +9,8 @@ import org.apache.ibatis.annotations.Param;
* @author ruoyi * @author ruoyi
* @date 2025-07-10 * @date 2025-07-10
*/ */
public interface ScFixHoofMapper { public interface ScFixHoofMapper
{
/** /**
* 查询修蹄 * 查询修蹄
* *
@ -60,6 +58,4 @@ public interface ScFixHoofMapper {
* @return 结果 * @return 结果
*/ */
public int deleteScFixHoofByIds(Integer[] ids); public int deleteScFixHoofByIds(Integer[] ids);
} }

View File

@ -58,13 +58,4 @@ public interface IScFixHoofService
* @return 结果 * @return 结果
*/ */
public int deleteScFixHoofById(Integer id); public int deleteScFixHoofById(Integer id);
/**
* 根据管理耳号查询
* @param manageTags
* @return
*/
Long findIdByManageTags(String manageTags);
} }

View File

@ -1,18 +1,12 @@
package com.zhyc.module.produce.other.fixHoof.service.impl; package com.zhyc.module.produce.other.fixHoof.service.impl;
import java.util.List; import java.util.List;
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.module.produce.other.fixHoof.domain.ScFixHoof; import com.zhyc.module.produce.other.fixHoof.domain.ScFixHoof;
import com.zhyc.module.produce.other.fixHoof.mapper.ScFixHoofMapper; import com.zhyc.module.produce.other.fixHoof.mapper.ScFixHoofMapper;
import com.zhyc.module.produce.sheep.domain.BasSheep;
import com.zhyc.module.produce.sheep.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 com.zhyc.module.produce.other.fixHoof.service.IScFixHoofService; import com.zhyc.module.produce.other.fixHoof.service.IScFixHoofService;
import org.springframework.transaction.annotation.Transactional;
/** /**
* 修蹄Service业务层处理 * 修蹄Service业务层处理
@ -21,13 +15,11 @@ import org.springframework.transaction.annotation.Transactional;
* @date 2025-07-10 * @date 2025-07-10
*/ */
@Service @Service
public class ScFixHoofServiceImpl implements IScFixHoofService { public class ScFixHoofServiceImpl implements IScFixHoofService
{
@Autowired @Autowired
private ScFixHoofMapper scFixHoofMapper; private ScFixHoofMapper scFixHoofMapper;
@Autowired
private BasSheepMapper basSheepMapper;
/** /**
* 查询修蹄 * 查询修蹄
* *
@ -35,7 +27,8 @@ public class ScFixHoofServiceImpl implements IScFixHoofService {
* @return 修蹄 * @return 修蹄
*/ */
@Override @Override
public ScFixHoof selectScFixHoofById(Integer id) { public ScFixHoof selectScFixHoofById(Integer id)
{
return scFixHoofMapper.selectScFixHoofById(id); return scFixHoofMapper.selectScFixHoofById(id);
} }
@ -46,7 +39,8 @@ public class ScFixHoofServiceImpl implements IScFixHoofService {
* @return 修蹄 * @return 修蹄
*/ */
@Override @Override
public List<ScFixHoof> selectScFixHoofList(ScFixHoof scFixHoof) { public List<ScFixHoof> selectScFixHoofList(ScFixHoof scFixHoof)
{
return scFixHoofMapper.selectScFixHoofList(scFixHoof); return scFixHoofMapper.selectScFixHoofList(scFixHoof);
} }
@ -57,12 +51,8 @@ public class ScFixHoofServiceImpl implements IScFixHoofService {
* @return 结果 * @return 结果
*/ */
@Override @Override
public int insertScFixHoof(ScFixHoof scFixHoof) { public int insertScFixHoof(ScFixHoof scFixHoof)
// 校验羊只是否存在 {
BasSheep sheep = basSheepMapper.selectBasSheepById(scFixHoof.getSheepId().longValue());
if (sheep == null) {
throw new ServiceException("该羊只ID不存在请检查后再添加");
}
scFixHoof.setCreateTime(DateUtils.getNowDate()); scFixHoof.setCreateTime(DateUtils.getNowDate());
return scFixHoofMapper.insertScFixHoof(scFixHoof); return scFixHoofMapper.insertScFixHoof(scFixHoof);
} }
@ -74,7 +64,8 @@ public class ScFixHoofServiceImpl implements IScFixHoofService {
* @return 结果 * @return 结果
*/ */
@Override @Override
public int updateScFixHoof(ScFixHoof scFixHoof) { public int updateScFixHoof(ScFixHoof scFixHoof)
{
return scFixHoofMapper.updateScFixHoof(scFixHoof); return scFixHoofMapper.updateScFixHoof(scFixHoof);
} }
@ -85,7 +76,8 @@ public class ScFixHoofServiceImpl implements IScFixHoofService {
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteScFixHoofByIds(Integer[] ids) { public int deleteScFixHoofByIds(Integer[] ids)
{
return scFixHoofMapper.deleteScFixHoofByIds(ids); return scFixHoofMapper.deleteScFixHoofByIds(ids);
} }
@ -96,24 +88,8 @@ public class ScFixHoofServiceImpl implements IScFixHoofService {
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteScFixHoofById(Integer id) { public int deleteScFixHoofById(Integer id)
{
return scFixHoofMapper.deleteScFixHoofById(id); return scFixHoofMapper.deleteScFixHoofById(id);
} }
/**
* 根据管理耳号查询
*/
@Override
public Long findIdByManageTags(String manageTags){
if(StringUtils.isBlank(manageTags))
throw new ServiceException("管理耳号不能为空");
BasSheep sheep = basSheepMapper.selectBasSheepByManageTags(manageTags.trim());
if(sheep == null)
throw new ServiceException("管理耳号不存在:" + manageTags);
return sheep.getId();
}
} }

View File

@ -1,17 +1,20 @@
package com.zhyc.module.produce.sheep.controller; package com.zhyc.module.produce.sheep.controller;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
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 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;
@ -32,8 +35,6 @@ public class BasSheepController extends BaseController
@Autowired @Autowired
private IBasSheepService basSheepService; private IBasSheepService basSheepService;
@Autowired
private BasSheepMapper basSheepMapper;
/** /**
* 查询羊只基本信息列表 * 查询羊只基本信息列表
*/ */
@ -101,14 +102,4 @@ public class BasSheepController extends BaseController
{ {
return toAjax(basSheepService.deleteBasSheepByIds(ids)); return toAjax(basSheepService.deleteBasSheepByIds(ids));
} }
@GetMapping("/byManageTags/{manageTags}")
public AjaxResult byManageTags(@PathVariable String manageTags){
BasSheep sheep = basSheepService.selectBasSheepByManageTags(manageTags.trim());
return success(sheep);
}
} }

View File

@ -38,7 +38,6 @@ public class BasSheep extends BaseEntity
/** 羊舍id */ /** 羊舍id */
@Excel(name = "羊舍id") @Excel(name = "羊舍id")
private Long sheepfoldId; private Long sheepfoldId;
private String sheepfoldName;
/** 电子耳号 */ /** 电子耳号 */
@Excel(name = "电子耳号") @Excel(name = "电子耳号")

View File

@ -2,7 +2,6 @@ package com.zhyc.module.produce.sheep.mapper;
import java.util.List; import java.util.List;
import com.zhyc.module.produce.sheep.domain.BasSheep; import com.zhyc.module.produce.sheep.domain.BasSheep;
import org.apache.ibatis.annotations.Param;
/** /**
* 羊只基本信息Mapper接口 * 羊只基本信息Mapper接口
@ -59,12 +58,4 @@ public interface BasSheepMapper
* @return 结果 * @return 结果
*/ */
public int deleteBasSheepByIds(Long[] ids); public int deleteBasSheepByIds(Long[] ids);
/**
* 根据管理耳号查询
*/
BasSheep selectBasSheepByManageTags(String manageTags);
} }

View File

@ -58,6 +58,4 @@ public interface IBasSheepService
* @return 结果 * @return 结果
*/ */
public int deleteBasSheepById(Long id); public int deleteBasSheepById(Long id);
BasSheep selectBasSheepByManageTags(String trim);
} }

View File

@ -93,10 +93,4 @@ public class BasSheepServiceImpl implements IBasSheepService
{ {
return basSheepMapper.deleteBasSheepById(id); return basSheepMapper.deleteBasSheepById(id);
} }
@Override
public BasSheep selectBasSheepByManageTags(String manageTags){
return basSheepMapper.selectBasSheepByManageTags(manageTags);
}
} }

View File

@ -1,60 +1,45 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhyc.module.produce.manage_sheep.transition_info.mapper.ScTransitionInfoMapper"> <mapper namespace="com.zhyc.module.produce.manage_sheep.transition_info.mapper.ScTransitionInfoMapper">
<resultMap type="ScTransitionInfo" id="ScTransitionInfoResult"> <resultMap type="ScTransitionInfo" id="ScTransitionInfoResult">
<result property="id" column="id"/> <result property="id" column="id" />
<result property="sheepId" column="sheep_id"/> <result property="sheepId" column="sheep_id" />
<result property="varietyId" column="variety_id"/> <result property="transTo" column="trans_to" />
<result property="varietyName" column="varietyName"/> <result property="transFrom" column="trans_from" />
<result property="transTo" column="trans_to"/> <result property="transType" column="trans_type" />
<result property="transFrom" column="trans_from"/> <result property="technician" column="technician" />
<result property="transType" column="trans_type"/> <result property="status" column="status" />
<result property="transTypeText" column="trans_type_text"/> <result property="comment" column="comment" />
<result property="technician" column="technician"/> <result property="createBy" column="create_by" />
<result property="status" column="status"/> <result property="createTime" column="create_time" />
<result property="comment" column="comment"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
</resultMap> </resultMap>
<sql id="selectScTransitionInfoVo"> <sql id="selectScTransitionInfoVo">
SELECT t.*, bv.variety AS varietyName, select id, sheep_id, trans_to, trans_from, trans_type, technician, status, comment, create_by, create_time from sc_transition_info
CASE t.trans_type
WHEN 0 THEN '内部转场'
WHEN 1 THEN '跨场转场'
WHEN 2 THEN '销售转场'
ELSE '未知'
END AS trans_type_text
FROM sc_transition_info t
LEFT JOIN bas_sheep_variety bv ON t.variety_id = bv.id
</sql> </sql>
<select id="selectScTransitionInfoList" parameterType="ScTransitionInfo" resultMap="ScTransitionInfoResult"> <select id="selectScTransitionInfoList" parameterType="ScTransitionInfo" resultMap="ScTransitionInfoResult">
<include refid="selectScTransitionInfoVo"/> <include refid="selectScTransitionInfoVo"/>
<where> <where>
<if test="sheepId != null ">and sheep_id = #{sheepId}</if> <if test="sheepId != null "> and sheep_id = #{sheepId}</if>
<if test="varietyId != null">and t.variety_id = #{varietyId}</if> <if test="transTo != null and transTo != ''"> and trans_to = #{transTo}</if>
<if test="transTo != null and transTo != ''">and trans_to = #{transTo}</if> <if test="transFrom != null and transFrom != ''"> and trans_from = #{transFrom}</if>
<if test="transFrom != null and transFrom != ''">and trans_from = #{transFrom}</if> <if test="status != null "> and status = #{status}</if>
<if test="status != null ">and status = #{status}</if> <if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">
and create_time between #{params.beginCreateTime} and #{params.endCreateTime}
</if>
</where> </where>
</select> </select>
<select id="selectScTransitionInfoById" parameterType="Integer" resultMap="ScTransitionInfoResult"> <select id="selectScTransitionInfoById" parameterType="Integer" resultMap="ScTransitionInfoResult">
<include refid="selectScTransitionInfoVo"/> <include refid="selectScTransitionInfoVo"/>
WHERE t.id = #{id} where id = #{id}
</select> </select>
<insert id="insertScTransitionInfo" parameterType="ScTransitionInfo" useGeneratedKeys="true" keyProperty="id"> <insert id="insertScTransitionInfo" parameterType="ScTransitionInfo" useGeneratedKeys="true" keyProperty="id">
insert into sc_transition_info insert into sc_transition_info
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="sheepId != null">sheep_id,</if> <if test="sheepId != null">sheep_id,</if>
<if test="varietyId != null">variety_id,</if>
<if test="transTo != null and transTo != ''">trans_to,</if> <if test="transTo != null and transTo != ''">trans_to,</if>
<if test="transFrom != null and transFrom != ''">trans_from,</if> <if test="transFrom != null and transFrom != ''">trans_from,</if>
<if test="transType != null">trans_type,</if> <if test="transType != null">trans_type,</if>
@ -66,7 +51,6 @@
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="sheepId != null">#{sheepId},</if> <if test="sheepId != null">#{sheepId},</if>
<if test="varietyId != null">#{varietyId},</if>
<if test="transTo != null and transTo != ''">#{transTo},</if> <if test="transTo != null and transTo != ''">#{transTo},</if>
<if test="transFrom != null and transFrom != ''">#{transFrom},</if> <if test="transFrom != null and transFrom != ''">#{transFrom},</if>
<if test="transType != null">#{transType},</if> <if test="transType != null">#{transType},</if>
@ -82,7 +66,6 @@
update sc_transition_info update sc_transition_info
<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="varietyId != null">variety_id = #{varietyId},</if>
<if test="transTo != null and transTo != ''">trans_to = #{transTo},</if> <if test="transTo != null and transTo != ''">trans_to = #{transTo},</if>
<if test="transFrom != null and transFrom != ''">trans_from = #{transFrom},</if> <if test="transFrom != null and transFrom != ''">trans_from = #{transFrom},</if>
<if test="transType != null">trans_type = #{transType},</if> <if test="transType != null">trans_type = #{transType},</if>
@ -96,9 +79,7 @@
</update> </update>
<delete id="deleteScTransitionInfoById" parameterType="Integer"> <delete id="deleteScTransitionInfoById" parameterType="Integer">
delete delete from sc_transition_info where id = #{id}
from sc_transition_info
where id = #{id}
</delete> </delete>
<delete id="deleteScTransitionInfoByIds" parameterType="String"> <delete id="deleteScTransitionInfoByIds" parameterType="String">

View File

@ -6,7 +6,7 @@
<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="varietyId" column="variety_id"/>
<result property="sheepfoldName" column="sheepfoldName"/> <result property="sheepfoldName" column="sheepfoldName"/>
@ -18,17 +18,16 @@
<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, fh.variety_id,
bv.variety AS varietyName, 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 left join bas_sheep_variety bv on fh.variety_id = bv.id
</sql> </sql>
@ -44,9 +43,6 @@
<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>
@ -101,6 +97,4 @@
#{id} #{id}
</foreach> </foreach>
</delete> </delete>
</mapper> </mapper>

View File

@ -92,24 +92,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where> </where>
</select> </select>
<select id="selectBasSheepById" parameterType="java.lang.Long" resultType="BasSheep"> <select id="selectBasSheepById" parameterType="Long" resultMap="BasSheepResult">
SELECT s.id, <include refid="selectBasSheepVo"/>
s.sheepfold_id AS sheepfoldId, where id = #{id}
sf.sheepfold_name AS sheepfoldName,
s.variety_id AS varietyId,
bv.variety AS varietyName
FROM bas_sheep s
LEFT JOIN da_sheepfold sf ON s.sheepfold_id = sf.id
LEFT JOIN bas_sheep_variety bv ON s.variety_id = bv.id
WHERE s.id = #{id}
</select>
<select id="selectBasSheepByManageTags" parameterType="string" resultType="com.zhyc.module.produce.sheep.domain.BasSheep">
SELECT id, sheepfold_id AS sheepfoldId, variety_id AS varietyId
FROM bas_sheep
WHERE LOWER(TRIM(manage_tags)) = LOWER(TRIM(#{manageTags}))
AND is_delete = 0
LIMIT 1
</select> </select>
<insert id="insertBasSheep" parameterType="BasSheep" useGeneratedKeys="true" keyProperty="id"> <insert id="insertBasSheep" parameterType="BasSheep" useGeneratedKeys="true" keyProperty="id">
@ -254,6 +239,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id} #{id}
</foreach> </foreach>
</delete> </delete>
</mapper> </mapper>