Merge remote-tracking branch 'origin/main'

This commit is contained in:
wyt 2025-12-08 10:12:04 +08:00
commit 68cc26d239
45 changed files with 4236 additions and 129 deletions

View File

@ -51,7 +51,7 @@ public class SysLoginController
AjaxResult ajax = AjaxResult.success(); AjaxResult ajax = AjaxResult.success();
// 生成令牌 // 生成令牌
String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(), String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
loginBody.getUuid()); loginBody.getUuid(),loginBody.getFlag());
ajax.put(Constants.TOKEN, token); ajax.put(Constants.TOKEN, token);
return ajax; return ajax;
} }

View File

@ -99,7 +99,7 @@ token:
# 令牌密钥 # 令牌密钥
secret: abcdefghijklmnopqrstuvwxyz secret: abcdefghijklmnopqrstuvwxyz
# 令牌有效期默认30分钟 # 令牌有效期默认30分钟
expireTime: 30 expireTime: 120
# MyBatis配置 # MyBatis配置
mybatis: mybatis:

View File

@ -26,6 +26,10 @@ public class LoginBody
* 唯一标识 * 唯一标识
*/ */
private String uuid; private String uuid;
/**
* 登录参数
*/
private boolean flag;
public String getUsername() public String getUsername()
{ {
@ -66,4 +70,12 @@ public class LoginBody
{ {
this.uuid = uuid; this.uuid = uuid;
} }
public boolean getFlag() {
return flag;
}
public void setFlag(boolean flag) {
this.flag = flag;
}
} }

View File

@ -0,0 +1,170 @@
<?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.produce.embryo.mapper.ScEmbryoFlushMapper">
<resultMap type="ScEmbryoFlush" id="ScEmbryoFlushResult">
<result property="id" column="id" />
<result property="flushTime" column="flush_time" />
<result property="donorFemaleNo" column="donor_female_no" />
<result property="donorMaleNo" column="donor_male_no" />
<result property="gradeAPlus" column="grade_a_plus" />
<result property="gradeA" column="grade_a" />
<result property="gradeB" column="grade_b" />
<result property="gradeC" column="grade_c" />
<result property="gradeD" column="grade_d" />
<result property="cell24" column="cell_2_4" />
<result property="cell8" column="cell_8" />
<result property="cell16" column="cell_16" />
<result property="unfertilized" column="unfertilized" />
<result property="degenerated" column="degenerated" />
<result property="transferred" column="transferred" />
<result property="recipientCnt" column="recipient_cnt" />
<result property="embryoType" column="embryo_type" />
<result property="embryoSource" column="embryo_source" />
<result property="destination" column="destination" />
<result property="storageMethod" column="storage_method" />
<result property="flushOperator" column="flush_operator" />
<result property="collectOperator" column="collect_operator" />
<result property="remark" column="remark" />
<result property="createdBy" column="created_by" />
<result property="createdAt" column="created_at" />
</resultMap>
<sql id="selectScEmbryoFlushVo">
select id, flush_time, donor_female_no, donor_male_no, grade_a_plus, grade_a, grade_b, grade_c, grade_d, cell_2_4, cell_8, cell_16, unfertilized, degenerated, transferred, recipient_cnt, embryo_type, embryo_source, destination, storage_method, flush_operator, collect_operator, remark, created_by, created_at from sc_embryo_flush
</sql>
<select id="selectScEmbryoFlushList" parameterType="ScEmbryoFlush" resultMap="ScEmbryoFlushResult">
<include refid="selectScEmbryoFlushVo"/>
<where>
<if test="flushTime != null "> and flush_time = #{flushTime}</if>
<if test="donorFemaleNo != null and donorFemaleNo != ''"> and donor_female_no = #{donorFemaleNo}</if>
<if test="donorMaleNo != null and donorMaleNo != ''"> and donor_male_no = #{donorMaleNo}</if>
<if test="gradeAPlus != null "> and grade_a_plus = #{gradeAPlus}</if>
<if test="gradeA != null "> and grade_a = #{gradeA}</if>
<if test="gradeB != null "> and grade_b = #{gradeB}</if>
<if test="gradeC != null "> and grade_c = #{gradeC}</if>
<if test="gradeD != null "> and grade_d = #{gradeD}</if>
<if test="cell24 != null "> and cell_2_4 = #{cell24}</if>
<if test="cell8 != null "> and cell_8 = #{cell8}</if>
<if test="cell16 != null "> and cell_16 = #{cell16}</if>
<if test="unfertilized != null "> and unfertilized = #{unfertilized}</if>
<if test="degenerated != null "> and degenerated = #{degenerated}</if>
<if test="transferred != null "> and transferred = #{transferred}</if>
<if test="recipientCnt != null "> and recipient_cnt = #{recipientCnt}</if>
<if test="embryoType != null and embryoType != ''"> and embryo_type = #{embryoType}</if>
<if test="embryoSource != null and embryoSource != ''"> and embryo_source = #{embryoSource}</if>
<if test="destination != null and destination != ''"> and destination = #{destination}</if>
<if test="storageMethod != null and storageMethod != ''"> and storage_method = #{storageMethod}</if>
<if test="flushOperator != null and flushOperator != ''"> and flush_operator = #{flushOperator}</if>
<if test="collectOperator != null and collectOperator != ''"> and collect_operator = #{collectOperator}</if>
<if test="createdBy != null and createdBy != ''"> and created_by = #{createdBy}</if>
<if test="createdAt != null "> and created_at = #{createdAt}</if>
</where>
</select>
<select id="selectScEmbryoFlushById" parameterType="Long" resultMap="ScEmbryoFlushResult">
<include refid="selectScEmbryoFlushVo"/>
where id = #{id}
</select>
<insert id="insertScEmbryoFlush" parameterType="ScEmbryoFlush" useGeneratedKeys="true" keyProperty="id">
insert into sc_embryo_flush
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="flushTime != null">flush_time,</if>
<if test="donorFemaleNo != null and donorFemaleNo != ''">donor_female_no,</if>
<if test="donorMaleNo != null and donorMaleNo != ''">donor_male_no,</if>
<if test="gradeAPlus != null">grade_a_plus,</if>
<if test="gradeA != null">grade_a,</if>
<if test="gradeB != null">grade_b,</if>
<if test="gradeC != null">grade_c,</if>
<if test="gradeD != null">grade_d,</if>
<if test="cell24 != null">cell_2_4,</if>
<if test="cell8 != null">cell_8,</if>
<if test="cell16 != null">cell_16,</if>
<if test="unfertilized != null">unfertilized,</if>
<if test="degenerated != null">degenerated,</if>
<if test="transferred != null">transferred,</if>
<if test="recipientCnt != null">recipient_cnt,</if>
<if test="embryoType != null and embryoType != ''">embryo_type,</if>
<if test="embryoSource != null and embryoSource != ''">embryo_source,</if>
<if test="destination != null">destination,</if>
<if test="storageMethod != null">storage_method,</if>
<if test="flushOperator != null and flushOperator != ''">flush_operator,</if>
<if test="collectOperator != null and collectOperator != ''">collect_operator,</if>
<if test="remark != null">remark,</if>
<if test="createdBy != null and createdBy != ''">created_by,</if>
<if test="createdAt != null">created_at,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="flushTime != null">#{flushTime},</if>
<if test="donorFemaleNo != null and donorFemaleNo != ''">#{donorFemaleNo},</if>
<if test="donorMaleNo != null and donorMaleNo != ''">#{donorMaleNo},</if>
<if test="gradeAPlus != null">#{gradeAPlus},</if>
<if test="gradeA != null">#{gradeA},</if>
<if test="gradeB != null">#{gradeB},</if>
<if test="gradeC != null">#{gradeC},</if>
<if test="gradeD != null">#{gradeD},</if>
<if test="cell24 != null">#{cell24},</if>
<if test="cell8 != null">#{cell8},</if>
<if test="cell16 != null">#{cell16},</if>
<if test="unfertilized != null">#{unfertilized},</if>
<if test="degenerated != null">#{degenerated},</if>
<if test="transferred != null">#{transferred},</if>
<if test="recipientCnt != null">#{recipientCnt},</if>
<if test="embryoType != null and embryoType != ''">#{embryoType},</if>
<if test="embryoSource != null and embryoSource != ''">#{embryoSource},</if>
<if test="destination != null">#{destination},</if>
<if test="storageMethod != null">#{storageMethod},</if>
<if test="flushOperator != null and flushOperator != ''">#{flushOperator},</if>
<if test="collectOperator != null and collectOperator != ''">#{collectOperator},</if>
<if test="remark != null">#{remark},</if>
<if test="createdBy != null and createdBy != ''">#{createdBy},</if>
<if test="createdAt != null">#{createdAt},</if>
</trim>
</insert>
<update id="updateScEmbryoFlush" parameterType="ScEmbryoFlush">
update sc_embryo_flush
<trim prefix="SET" suffixOverrides=",">
<if test="flushTime != null">flush_time = #{flushTime},</if>
<if test="donorFemaleNo != null and donorFemaleNo != ''">donor_female_no = #{donorFemaleNo},</if>
<if test="donorMaleNo != null and donorMaleNo != ''">donor_male_no = #{donorMaleNo},</if>
<if test="gradeAPlus != null">grade_a_plus = #{gradeAPlus},</if>
<if test="gradeA != null">grade_a = #{gradeA},</if>
<if test="gradeB != null">grade_b = #{gradeB},</if>
<if test="gradeC != null">grade_c = #{gradeC},</if>
<if test="gradeD != null">grade_d = #{gradeD},</if>
<if test="cell24 != null">cell_2_4 = #{cell24},</if>
<if test="cell8 != null">cell_8 = #{cell8},</if>
<if test="cell16 != null">cell_16 = #{cell16},</if>
<if test="unfertilized != null">unfertilized = #{unfertilized},</if>
<if test="degenerated != null">degenerated = #{degenerated},</if>
<if test="transferred != null">transferred = #{transferred},</if>
<if test="recipientCnt != null">recipient_cnt = #{recipientCnt},</if>
<if test="embryoType != null and embryoType != ''">embryo_type = #{embryoType},</if>
<if test="embryoSource != null and embryoSource != ''">embryo_source = #{embryoSource},</if>
<if test="destination != null">destination = #{destination},</if>
<if test="storageMethod != null">storage_method = #{storageMethod},</if>
<if test="flushOperator != null and flushOperator != ''">flush_operator = #{flushOperator},</if>
<if test="collectOperator != null and collectOperator != ''">collect_operator = #{collectOperator},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createdBy != null and createdBy != ''">created_by = #{createdBy},</if>
<if test="createdAt != null">created_at = #{createdAt},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteScEmbryoFlushById" parameterType="Long">
delete from sc_embryo_flush where id = #{id}
</delete>
<delete id="deleteScEmbryoFlushByIds" parameterType="String">
delete from sc_embryo_flush where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -57,14 +57,15 @@ public class SysLoginService
* *
* @param username 用户名 * @param username 用户名
* @param password 密码 * @param password 密码
* @param code 验证码 * @param code 验证码
* @param uuid 唯一标识 * @param uuid 唯一标识
* @param flag 是否开启验证
* @return 结果 * @return 结果
*/ */
public String login(String username, String password, String code, String uuid) public String login(String username, String password, String code, String uuid, boolean flag)
{ {
// 验证码校验 // 验证码校验
validateCaptcha(username, code, uuid); validateCaptcha(username, code, uuid,flag);
// 登录前置校验 // 登录前置校验
loginPreCheck(username, password); loginPreCheck(username, password);
// 用户验证 // 用户验证
@ -106,12 +107,13 @@ public class SysLoginService
* @param username 用户名 * @param username 用户名
* @param code 验证码 * @param code 验证码
* @param uuid 唯一标识 * @param uuid 唯一标识
* @param flag 是否进行验证码校验
* @return 结果 * @return 结果
*/ */
public void validateCaptcha(String username, String code, String uuid) public void validateCaptcha(String username, String code, String uuid,boolean flag)
{ {
boolean captchaEnabled = configService.selectCaptchaEnabled(); boolean captchaEnabled = configService.selectCaptchaEnabled();
if (captchaEnabled) if (captchaEnabled && !flag)
{ {
String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + StringUtils.nvl(uuid, ""); String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + StringUtils.nvl(uuid, "");
String captcha = redisCache.getCacheObject(verifyKey); String captcha = redisCache.getCacheObject(verifyKey);

View File

@ -4,9 +4,11 @@ import lombok.Data;
@Data @Data
public class UserPost { public class UserPost {
// 用户id
private String userId;
// 用户名 // 用户名
private String nickName; private String nickName;
// 用户 // 岗位名称
private String postName; private String postName;
// 岗位编码 // 岗位编码
private String postCode; private String postCode;

View File

@ -0,0 +1,156 @@
package com.zhyc.module.frozen.controller;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import com.zhyc.common.utils.SecurityUtils;
import com.zhyc.common.utils.StringUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
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.frozen.domain.DdFe;
import com.zhyc.module.frozen.service.IDdFeService;
import com.zhyc.common.utils.poi.ExcelUtil;
import com.zhyc.common.core.page.TableDataInfo;
/**
* 冻胚库存Controller
*
* @author ruoyi
* @date 2025-11-29
*/
@RestController
@RequestMapping("/frozen/embryo")
public class DdFeController extends BaseController
{
@Autowired
private IDdFeService ddFeService;
/**
* 查询冻胚库存列表
*/
@PreAuthorize("@ss.hasPermi('frozen:embryo:list')")
@GetMapping("/list")
public TableDataInfo list(DdFe ddFe)
{
startPage();
List<DdFe> list = ddFeService.selectDdFeList(ddFe);
return getDataTable(list);
}
/**
* 导出冻胚库存列表
*/
@PreAuthorize("@ss.hasPermi('frozen:embryo:export')")
@Log(title = "冻胚库存", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DdFe ddFe)
{
List<DdFe> list = ddFeService.selectDdFeList(ddFe);
ExcelUtil<DdFe> util = new ExcelUtil<DdFe>(DdFe.class);
util.exportExcel(response, list, "冻胚库存数据");
}
/**
* 获取冻胚库存详细信息
*/
@PreAuthorize("@ss.hasPermi('frozen:embryo:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(ddFeService.selectDdFeById(id));
}
/**
* 新增冻胚库存
*/
@PreAuthorize("@ss.hasPermi('frozen:embryo:add')")
@Log(title = "冻胚库存", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody DdFe ddFe)
{
ddFe.setCreateBy(SecurityUtils.getUsername());
return toAjax(ddFeService.insertDdFe(ddFe));
}
/**
* 修改冻胚库存
*/
@PreAuthorize("@ss.hasPermi('frozen:embryo:edit')")
@Log(title = "冻胚库存", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DdFe ddFe)
{
return toAjax(ddFeService.updateDdFe(ddFe));
}
/**
* 删除冻胚库存
*/
@PreAuthorize("@ss.hasPermi('frozen:embryo:remove')")
@Log(title = "冻胚库存", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(ddFeService.deleteDdFeByIds(ids));
}
/**
* 根据供体母羊耳号获取最近一次冲胚信息
*/
@PreAuthorize("@ss.hasPermi('frozen:embryo:add')")
@GetMapping("/getFlushInfoByEwe/{eweNo}")
public AjaxResult getFlushInfoByEwe(@PathVariable("eweNo") String eweNo) {
if (StringUtils.isBlank(eweNo)) {
return error("耳号不能为空");
}
Map<String, Object> echo = ddFeService.getLastFlushInfoByEwe(eweNo.trim());
return echo == null ? error("该母羊无冲胚记录,请先录入冲胚记录") : success(echo);
}
/**
* 根据母羊耳号 + 胚胎等级 返回该等级数量
* 无记录返回 0
*/
@PreAuthorize("@ss.hasPermi('frozen:embryo:add')")
@GetMapping("/getQtyByGrade")
public AjaxResult getQtyByGrade(@RequestParam String eweNo,
@RequestParam String grade) {
Map<String, Object> flush = ddFeService.getLastFlushInfoByEwe(eweNo);
if (flush == null) return success(0);
Integer qty;
switch (grade) {
case "A": qty = (Integer) flush.getOrDefault("gradeA", 0); break;
case "B": qty = (Integer) flush.getOrDefault("gradeB", 0); break;
case "C": qty = (Integer) flush.getOrDefault("gradeC", 0); break;
case "D": qty = (Integer) flush.getOrDefault("gradeD", 0); break;
case "囊胚": qty = (Integer) flush.getOrDefault("cell24", 0); break;
case "桑椹胚": qty = (Integer) flush.getOrDefault("cell8", 0); break;
default: qty = 0;
}
return success(qty);
}
/**
* 批量废弃
*/
@PreAuthorize("@ss.hasPermi('frozen:embryo:discard')")
@Log(title = "冻胚库存", businessType = BusinessType.UPDATE)
@PutMapping("/batchDiscard")
public AjaxResult batchDiscard(@RequestBody List<DdFe> list) {
if (list == null || list.isEmpty()) {
return error("请选择要废弃的记录");
}
list.forEach(dto -> {
dto.setStatus("废弃");
ddFeService.discard(dto);
});
return success();
}
}

View File

@ -0,0 +1,114 @@
package com.zhyc.module.frozen.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
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.frozen.domain.DdFs;
import com.zhyc.module.frozen.service.IDdFsService;
import com.zhyc.common.utils.poi.ExcelUtil;
import com.zhyc.common.core.page.TableDataInfo;
/**
* 冻精库存Controller
*
* @author ruoyi
* @date 2025-11-29
*/
@RestController
@RequestMapping("/sperm/sperm")
public class DdFsController extends BaseController
{
@Autowired
private IDdFsService ddFsService;
/**
* 查询冻精库存列表
*/
@PreAuthorize("@ss.hasPermi('sperm:sperm:list')")
@GetMapping("/list")
public TableDataInfo list(DdFs ddFs)
{
startPage();
List<DdFs> list = ddFsService.selectDdFsList(ddFs);
return getDataTable(list);
}
/**
* 导出冻精库存列表
*/
@PreAuthorize("@ss.hasPermi('sperm:sperm:export')")
@Log(title = "冻精库存", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DdFs ddFs)
{
List<DdFs> list = ddFsService.selectDdFsList(ddFs);
ExcelUtil<DdFs> util = new ExcelUtil<DdFs>(DdFs.class);
util.exportExcel(response, list, "冻精库存数据");
}
/**
* 获取冻精库存详细信息
*/
@PreAuthorize("@ss.hasPermi('sperm:sperm:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(ddFsService.selectDdFsById(id));
}
/**
* 新增冻精库存
*/
@PreAuthorize("@ss.hasPermi('sperm:sperm:add')")
@Log(title = "冻精库存", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody DdFs ddFs)
{
return toAjax(ddFsService.insertDdFs(ddFs));
}
/**
* 修改冻精库存
*/
@PreAuthorize("@ss.hasPermi('sperm:sperm:edit')")
@Log(title = "冻精库存", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DdFs ddFs)
{
return toAjax(ddFsService.updateDdFs(ddFs));
}
/**
* 删除冻精库存
*/
@PreAuthorize("@ss.hasPermi('sperm:sperm:remove')")
@Log(title = "冻精库存", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(ddFsService.deleteDdFsByIds(ids));
}
/**
* 批量废弃
*/
@PreAuthorize("@ss.hasPermi('sperm:sperm:discard')")
@Log(title = "冻精库存", businessType = BusinessType.UPDATE)
@PutMapping("/discard")
public AjaxResult discard(@RequestBody List<DdFs> list) {
return AjaxResult.success(ddFsService.discard(list));
}
}

View File

@ -0,0 +1,104 @@
package com.zhyc.module.frozen.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
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.frozen.domain.DdSale;
import com.zhyc.module.frozen.service.IDdSaleService;
import com.zhyc.common.utils.poi.ExcelUtil;
import com.zhyc.common.core.page.TableDataInfo;
/**
* 销售主单Controller
*
* @author HashMap
* @date 2025-12-01
*/
@RestController
@RequestMapping("/sale/sale")
public class DdSaleController extends BaseController
{
@Autowired
private IDdSaleService ddSaleService;
/**
* 查询销售主单列表
*/
@PreAuthorize("@ss.hasPermi('sale:sale:list')")
@GetMapping("/list")
public TableDataInfo list(DdSale ddSale)
{
startPage();
List<DdSale> list = ddSaleService.selectDdSaleList(ddSale);
return getDataTable(list);
}
/**
* 导出销售主单列表
*/
@PreAuthorize("@ss.hasPermi('sale:sale:export')")
@Log(title = "销售主单", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DdSale ddSale)
{
List<DdSale> list = ddSaleService.selectDdSaleList(ddSale);
ExcelUtil<DdSale> util = new ExcelUtil<DdSale>(DdSale.class);
util.exportExcel(response, list, "销售主单数据");
}
/**
* 获取销售主单详细信息
*/
@PreAuthorize("@ss.hasPermi('sale:sale:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(ddSaleService.selectDdSaleById(id));
}
/**
* 新增销售主单
*/
@PreAuthorize("@ss.hasPermi('sale:sale:add')")
@Log(title = "销售主单", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody DdSale ddSale)
{
return toAjax(ddSaleService.insertDdSale(ddSale));
}
/**
* 修改销售主单
*/
@PreAuthorize("@ss.hasPermi('sale:sale:edit')")
@Log(title = "销售主单", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DdSale ddSale)
{
return toAjax(ddSaleService.updateDdSale(ddSale));
}
/**
* 删除销售主单
*/
@PreAuthorize("@ss.hasPermi('sale:sale:remove')")
@Log(title = "销售主单", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(ddSaleService.deleteDdSaleByIds(ids));
}
}

View File

@ -0,0 +1,299 @@
package com.zhyc.module.frozen.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
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;
/**
* 冻胚库存对象 dd_fe
*
* @author ruoyi
* @date 2025-11-29
*/
public class DdFe extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long id;
/** 胚胎编号 YS+日期+序号 */
@Excel(name = "胚胎编号")
private String code;
/** 冻胚日期(事件录入日) */
@Excel(name = "冻胚日期", dateFormat = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date freezeDate;
/** 供体公羊耳号 */
@Excel(name = "供体公羊耳号")
private String drId;
/** 供体公羊品种 */
@Excel(name = "供体公羊品种")
private String drBreed;
/** 供体母羊耳号 */
@Excel(name = "供体母羊耳号")
private String deId;
/** 供体母羊品种 */
@Excel(name = "供体母羊品种")
private String deBreed;
/** 胚胎品种(自动生成) */
@Excel(name = "胚胎品种")
private String embBreed;
/** 胚胎阶段等级('A', 'B', 'C', 'D', '囊胚', '桑椹胚') */
@Excel(name = "胚胎阶段等级")
private String grade;
/** 胚胎数量 */
@Excel(name = "胚胎数量")
private Long qty;
/** 是否性控 1是 0否 */
@Excel(name = "是否性控",readConverterExp = "1=是,0=否")
private Integer sexCtl;
/** 状态(0正常1销售 2自用3废弃) */
@Excel(name = "状态")
private String status;
/** 技术员 */
@Excel(name = "技术员")
private String tech;
/** 液氮罐ID */
@Excel(name = "液氮罐ID")
private Long tankId;
/** 提桶ID */
@Excel(name = "提桶ID")
private Long bucketId;
/** 冷冻架ID */
@Excel(name = "冷冻架ID")
private Long rackId;
/** 出库日期(出库后回写) */
@Excel(name = "出库日期", dateFormat = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date outDate;
/** 废弃原因(废弃时填写) */
@Excel(name = "废弃原因")
private String discardTxt;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setCode(String code)
{
this.code = code;
}
public String getCode()
{
return code;
}
public void setFreezeDate(Date freezeDate)
{
this.freezeDate = freezeDate;
}
public Date getFreezeDate()
{
return freezeDate;
}
public void setDrId(String drId)
{
this.drId = drId;
}
public String getDrId()
{
return drId;
}
public void setDrBreed(String drBreed)
{
this.drBreed = drBreed;
}
public String getDrBreed()
{
return drBreed;
}
public void setDeId(String deId)
{
this.deId = deId;
}
public String getDeId()
{
return deId;
}
public void setDeBreed(String deBreed)
{
this.deBreed = deBreed;
}
public String getDeBreed()
{
return deBreed;
}
public void setEmbBreed(String embBreed)
{
this.embBreed = embBreed;
}
public String getEmbBreed()
{
return embBreed;
}
public void setGrade(String grade)
{
this.grade = grade;
}
public String getGrade()
{
return grade;
}
public void setQty(Long qty)
{
this.qty = qty;
}
public Long getQty()
{
return qty;
}
public void setSexCtl(Integer sexCtl)
{
this.sexCtl = sexCtl;
}
public Integer getSexCtl()
{
return sexCtl;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
public void setTech(String tech)
{
this.tech = tech;
}
public String getTech()
{
return tech;
}
public void setTankId(Long tankId)
{
this.tankId = tankId;
}
public Long getTankId()
{
return tankId;
}
public void setBucketId(Long bucketId)
{
this.bucketId = bucketId;
}
public Long getBucketId()
{
return bucketId;
}
public void setRackId(Long rackId)
{
this.rackId = rackId;
}
public Long getRackId()
{
return rackId;
}
public void setOutDate(Date outDate)
{
this.outDate = outDate;
}
public Date getOutDate()
{
return outDate;
}
public void setDiscardTxt(String discardTxt)
{
this.discardTxt = discardTxt;
}
public String getDiscardTxt()
{
return discardTxt;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("code", getCode())
.append("freezeDate", getFreezeDate())
.append("drId", getDrId())
.append("drBreed", getDrBreed())
.append("deId", getDeId())
.append("deBreed", getDeBreed())
.append("embBreed", getEmbBreed())
.append("grade", getGrade())
.append("qty", getQty())
.append("sexCtl", getSexCtl())
.append("status", getStatus())
.append("tech", getTech())
.append("tankId", getTankId())
.append("bucketId", getBucketId())
.append("rackId", getRackId())
.append("outDate", getOutDate())
.append("discardTxt", getDiscardTxt())
.append("remark", getRemark())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.toString();
}
}

View File

@ -0,0 +1,254 @@
package com.zhyc.module.frozen.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
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;
/**
* 冻精库存对象 dd_fs
*
* @author ruoyi
* @date 2025-11-29
*/
public class DdFs extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private Long id;
/**
* 冻精号/公羊耳号
*/
@Excel(name = "冻精号")
private String code;
/**
* 冻精日期事件录入日
*/
@Excel(name = "冻精日期", dateFormat = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date freezeDt;
/**
* 冻精品种同公羊品种
*/
@Excel(name = "冻精品种")
private String breed;
/**
* 生产批次日期格式
*/
@Excel(name = "生产批次")
private String batch;
/**
* 规格(0.25mL,0.5mL)
*/
@Excel(name = "规格")
private String spec;
/**
* 数量
*/
@Excel(name = "数量")
private Long qty;
/**
* 是否性控 1是 0否
*/
@Excel(name = "是否性控", readConverterExp = "1=是,0=否")
private Integer sexCtl;
/**
* 状态0正常1销售2自用3废弃
*/
@Excel(name = "状态")
private String stat;
/**
* 技术员
*/
@Excel(name = "技术员")
private String tech;
/**
* 液氮罐ID
*/
@Excel(name = "液氮罐ID")
private Long tankId;
/**
* 提桶ID
*/
@Excel(name = "提桶ID")
private Long bucketId;
/**
* 冷冻架ID
*/
@Excel(name = "冷冻架ID")
private Long rackId;
/**
* 出库日期出库后回写
*/
@Excel(name = "出库日期", dateFormat = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date outDt;
/**
* 废弃原因
*/
@Excel(name = "废弃原因")
private String discardTxt;
public void setId(Long id) {
this.id = id;
}
public Long getId() {
return id;
}
public void setCode(String code) {
this.code = code;
}
public String getCode() {
return code;
}
public void setFreezeDt(Date freezeDt) {
this.freezeDt = freezeDt;
}
public Date getFreezeDt() {
return freezeDt;
}
public void setBreed(String breed) {
this.breed = breed;
}
public String getBreed() {
return breed;
}
public void setBatch(String batch) {
this.batch = batch;
}
public String getBatch() {
return batch;
}
public void setSpec(String spec) {
this.spec = spec;
}
public String getSpec() {
return spec;
}
public void setQty(Long qty) {
this.qty = qty;
}
public Long getQty() {
return qty;
}
public void setSexCtl(Integer sexCtl) {
this.sexCtl = sexCtl;
}
public Integer getSexCtl() {
return sexCtl;
}
public void setStat(String stat) {
this.stat = stat;
}
public String getStat() {
return stat;
}
public void setTech(String tech) {
this.tech = tech;
}
public String getTech() {
return tech;
}
public void setTankId(Long tankId) {
this.tankId = tankId;
}
public Long getTankId() {
return tankId;
}
public void setBucketId(Long bucketId) {
this.bucketId = bucketId;
}
public Long getBucketId() {
return bucketId;
}
public void setRackId(Long rackId) {
this.rackId = rackId;
}
public Long getRackId() {
return rackId;
}
public void setOutDt(Date outDt) {
this.outDt = outDt;
}
public Date getOutDt() {
return outDt;
}
public void setDiscardTxt(String discardTxt) {
this.discardTxt = discardTxt;
}
public String getDiscardTxt() {
return discardTxt;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("code", getCode())
.append("freezeDt", getFreezeDt())
.append("breed", getBreed())
.append("batch", getBatch())
.append("spec", getSpec())
.append("qty", getQty())
.append("sexCtl", getSexCtl())
.append("stat", getStat())
.append("tech", getTech())
.append("tankId", getTankId())
.append("bucketId", getBucketId())
.append("rackId", getRackId())
.append("outDt", getOutDt())
.append("discardTxt", getDiscardTxt())
.append("remark", getRemark())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.toString();
}
}

View File

@ -0,0 +1,194 @@
package com.zhyc.module.frozen.domain;
import java.math.BigDecimal;
import java.util.List;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
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;
/**
* 销售主单对象 dd_sl
*
* @author HashMap
* @date 2025-12-01
*/
public class DdSale extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long id;
/** 销售日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "销售日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date saleDate;
/** 客户名称 */
@Excel(name = "客户名称")
private String custName;
/** 客户电话 */
@Excel(name = "客户电话")
private String custPhone;
/** 客户地址 */
@Excel(name = "客户地址")
private String custAddr;
/** 销售人员 */
@Excel(name = "销售人员")
private String salesper;
/** 检疫证号(可选) */
@Excel(name = "检疫证号", readConverterExp = "可=选")
private String quaranNo;
/** 审批编号(可选) */
@Excel(name = "审批编号", readConverterExp = "可=选")
private String apprNo;
/** 总价 */
@Excel(name = "总价")
private BigDecimal price;
/** 技术员 */
@Excel(name = "技术员")
private String tech;
/** 销售明细信息 */
private List<DdSaleItem> ddSaleItemList;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setSaleDate(Date saleDate)
{
this.saleDate = saleDate;
}
public Date getSaleDate()
{
return saleDate;
}
public void setCustName(String custName)
{
this.custName = custName;
}
public String getCustName()
{
return custName;
}
public void setCustPhone(String custPhone)
{
this.custPhone = custPhone;
}
public String getCustPhone()
{
return custPhone;
}
public void setCustAddr(String custAddr)
{
this.custAddr = custAddr;
}
public String getCustAddr()
{
return custAddr;
}
public void setSalesper(String salesper)
{
this.salesper = salesper;
}
public String getSalesper()
{
return salesper;
}
public void setQuaranNo(String quaranNo)
{
this.quaranNo = quaranNo;
}
public String getQuaranNo()
{
return quaranNo;
}
public void setApprNo(String apprNo)
{
this.apprNo = apprNo;
}
public String getApprNo()
{
return apprNo;
}
public void setPrice(BigDecimal price)
{
this.price = price;
}
public BigDecimal getPrice()
{
return price;
}
public void setTech(String tech)
{
this.tech = tech;
}
public String getTech()
{
return tech;
}
public List<DdSaleItem> getDdSaleItemList()
{
return ddSaleItemList;
}
public void setDdSaleItemList(List<DdSaleItem> ddSaleItemList)
{
this.ddSaleItemList = ddSaleItemList;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("saleDate", getSaleDate())
.append("custName", getCustName())
.append("custPhone", getCustPhone())
.append("custAddr", getCustAddr())
.append("salesper", getSalesper())
.append("quaranNo", getQuaranNo())
.append("apprNo", getApprNo())
.append("price", getPrice())
.append("tech", getTech())
.append("remark", getRemark())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("ddSaleItemList", getDdSaleItemList())
.toString();
}
}

View File

@ -0,0 +1,151 @@
package com.zhyc.module.frozen.domain;
import java.math.BigDecimal;
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;
/**
* 销售明细对象 dd_sl_item
*
* @author HashMap
* @date 2025-12-01
*/
public class DdSaleItem extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long id;
/** 销售主单ID */
@Excel(name = "销售主单ID")
private Long saleId;
/** 明细类型冻胚embryo冻精semen */
@Excel(name = "明细类型", readConverterExp = "冻=胚embryo冻精semen")
private String itemType;
/** 胚胎编号或冻精号 */
@Excel(name = "胚胎编号或冻精号")
private String itemCode;
/** 数量 */
@Excel(name = "数量")
private Long qty;
/** 单价(元) */
@Excel(name = "单价", readConverterExp = "元=")
private BigDecimal unitPrice;
/** 所在液氮罐ID */
@Excel(name = "所在液氮罐ID")
private Long tankId;
/** 所在提桶ID */
@Excel(name = "所在提桶ID")
private Long bucketId;
/** 所在冷冻架ID */
@Excel(name = "所在冷冻架ID")
private Long rackId;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setSaleId(Long saleId)
{
this.saleId = saleId;
}
public Long getSaleId()
{
return saleId;
}
public void setItemType(String itemType)
{
this.itemType = itemType;
}
public String getItemType()
{
return itemType;
}
public void setItemCode(String itemCode)
{
this.itemCode = itemCode;
}
public String getItemCode()
{
return itemCode;
}
public void setQty(Long qty)
{
this.qty = qty;
}
public Long getQty()
{
return qty;
}
public void setUnitPrice(BigDecimal unitPrice)
{
this.unitPrice = unitPrice;
}
public BigDecimal getUnitPrice()
{
return unitPrice;
}
public void setTankId(Long tankId)
{
this.tankId = tankId;
}
public Long getTankId()
{
return tankId;
}
public void setBucketId(Long bucketId)
{
this.bucketId = bucketId;
}
public Long getBucketId()
{
return bucketId;
}
public void setRackId(Long rackId)
{
this.rackId = rackId;
}
public Long getRackId()
{
return rackId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("saleId", getSaleId())
.append("itemType", getItemType())
.append("itemCode", getItemCode())
.append("qty", getQty())
.append("unitPrice", getUnitPrice())
.append("tankId", getTankId())
.append("bucketId", getBucketId())
.append("rackId", getRackId())
.append("createTime", getCreateTime())
.toString();
}
}

View File

@ -0,0 +1,75 @@
package com.zhyc.module.frozen.mapper;
import java.util.List;
import java.util.Map;
import com.zhyc.module.frozen.domain.DdFe;
import com.zhyc.module.produce.breed.domain.ScEmbryoFlush;
import org.apache.ibatis.annotations.Param;
/**
* 冻胚库存Mapper接口
*
* @author ruoyi
* @date 2025-11-29
*/
public interface DdFeMapper
{
/**
* 查询冻胚库存
*
* @param id 冻胚库存主键
* @return 冻胚库存
*/
public DdFe selectDdFeById(Long id);
/**
* 查询冻胚库存列表
*
* @param ddFe 冻胚库存
* @return 冻胚库存集合
*/
public List<DdFe> selectDdFeList(DdFe ddFe);
/**
* 新增冻胚库存
*
* @param ddFe 冻胚库存
* @return 结果
*/
public int insertDdFe(DdFe ddFe);
/**
* 修改冻胚库存
*
* @param ddFe 冻胚库存
* @return 结果
*/
public int updateDdFe(DdFe ddFe);
/**
* 删除冻胚库存
*
* @param id 冻胚库存主键
* @return 结果
*/
public int deleteDdFeById(Long id);
/**
* 批量删除冻胚库存
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteDdFeByIds(Long[] ids);
/**
* 按母羊耳号取最新一条冲胚记录只读
*/
Map<String,Object> selectFlushByEwe(@Param("eweNo") String eweNo);
/**
* 废弃更新只改状态出库日期废弃原因更新人
*/
int updateDiscard(DdFe dto);
}

View File

@ -0,0 +1,61 @@
package com.zhyc.module.frozen.mapper;
import java.util.List;
import com.zhyc.module.frozen.domain.DdFs;
/**
* 冻精库存Mapper接口
*
* @author ruoyi
* @date 2025-11-29
*/
public interface DdFsMapper
{
/**
* 查询冻精库存
*
* @param id 冻精库存主键
* @return 冻精库存
*/
public DdFs selectDdFsById(Long id);
/**
* 查询冻精库存列表
*
* @param ddFs 冻精库存
* @return 冻精库存集合
*/
public List<DdFs> selectDdFsList(DdFs ddFs);
/**
* 新增冻精库存
*
* @param ddFs 冻精库存
* @return 结果
*/
public int insertDdFs(DdFs ddFs);
/**
* 修改冻精库存
*
* @param ddFs 冻精库存
* @return 结果
*/
public int updateDdFs(DdFs ddFs);
/**
* 删除冻精库存
*
* @param id 冻精库存主键
* @return 结果
*/
public int deleteDdFsById(Long id);
/**
* 批量删除冻精库存
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteDdFsByIds(Long[] ids);
}

View File

@ -0,0 +1,87 @@
package com.zhyc.module.frozen.mapper;
import java.util.List;
import com.zhyc.module.frozen.domain.DdSale;
import com.zhyc.module.frozen.domain.DdSaleItem;
/**
* 销售主单Mapper接口
*
* @author HashMap
* @date 2025-12-01
*/
public interface DdSaleMapper
{
/**
* 查询销售主单
*
* @param id 销售主单主键
* @return 销售主单
*/
public DdSale selectDdSaleById(Long id);
/**
* 查询销售主单列表
*
* @param ddSale 销售主单
* @return 销售主单集合
*/
public List<DdSale> selectDdSaleList(DdSale ddSale);
/**
* 新增销售主单
*
* @param ddSale 销售主单
* @return 结果
*/
public int insertDdSale(DdSale ddSale);
/**
* 修改销售主单
*
* @param ddSale 销售主单
* @return 结果
*/
public int updateDdSale(DdSale ddSale);
/**
* 删除销售主单
*
* @param id 销售主单主键
* @return 结果
*/
public int deleteDdSaleById(Long id);
/**
* 批量删除销售主单
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteDdSaleByIds(Long[] ids);
/**
* 批量删除销售明细
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteDdSaleItemBySaleIds(Long[] ids);
/**
* 批量新增销售明细
*
* @param ddSaleItemList 销售明细列表
* @return 结果
*/
public int batchDdSaleItem(List<DdSaleItem> ddSaleItemList);
/**
* 通过销售主单主键删除销售明细信息
*
* @param id 销售主单ID
* @return 结果
*/
public int deleteDdSaleItemBySaleId(Long id);
}

View File

@ -0,0 +1,70 @@
package com.zhyc.module.frozen.service;
import java.util.List;
import java.util.Map;
import com.zhyc.module.frozen.domain.DdFe;
/**
* 冻胚库存Service接口
*
* @author ruoyi
* @date 2025-11-29
*/
public interface IDdFeService {
/**
* 查询冻胚库存
*
* @param id 冻胚库存主键
* @return 冻胚库存
*/
public DdFe selectDdFeById(Long id);
/**
* 查询冻胚库存列表
*
* @param ddFe 冻胚库存
* @return 冻胚库存集合
*/
public List<DdFe> selectDdFeList(DdFe ddFe);
/**
* 新增冻胚库存
*
* @param ddFe 冻胚库存
* @return 结果
*/
public int insertDdFe(DdFe ddFe);
/**
* 修改冻胚库存
*
* @param ddFe 冻胚库存
* @return 结果
*/
public int updateDdFe(DdFe ddFe);
/**
* 批量删除冻胚库存
*
* @param ids 需要删除的冻胚库存主键集合
* @return 结果
*/
public int deleteDdFeByIds(Long[] ids);
/**
* 删除冻胚库存信息
*
* @param id 冻胚库存主键
* @return 结果
*/
public int deleteDdFeById(Long id);
/**
* 根据母羊耳号取最近一次冲胚信息
*/
Map<String, Object> getLastFlushInfoByEwe(String eweNo);
// 废弃
int discard(DdFe dto);
}

View File

@ -0,0 +1,64 @@
package com.zhyc.module.frozen.service;
import java.util.List;
import com.zhyc.module.frozen.domain.DdFs;
/**
* 冻精库存Service接口
*
* @author ruoyi
* @date 2025-11-29
*/
public interface IDdFsService {
/**
* 查询冻精库存
*
* @param id 冻精库存主键
* @return 冻精库存
*/
public DdFs selectDdFsById(Long id);
/**
* 查询冻精库存列表
*
* @param ddFs 冻精库存
* @return 冻精库存集合
*/
public List<DdFs> selectDdFsList(DdFs ddFs);
/**
* 新增冻精库存
*
* @param ddFs 冻精库存
* @return 结果
*/
public int insertDdFs(DdFs ddFs);
/**
* 修改冻精库存
*
* @param ddFs 冻精库存
* @return 结果
*/
public int updateDdFs(DdFs ddFs);
/**
* 批量删除冻精库存
*
* @param ids 需要删除的冻精库存主键集合
* @return 结果
*/
public int deleteDdFsByIds(Long[] ids);
/**
* 删除冻精库存信息
*
* @param id 冻精库存主键
* @return 结果
*/
public int deleteDdFsById(Long id);
//废弃
int discard(List<DdFs> list);
}

View File

@ -0,0 +1,61 @@
package com.zhyc.module.frozen.service;
import java.util.List;
import com.zhyc.module.frozen.domain.DdSale;
/**
* 销售主单Service接口
*
* @author HashMap
* @date 2025-12-01
*/
public interface IDdSaleService
{
/**
* 查询销售主单
*
* @param id 销售主单主键
* @return 销售主单
*/
public DdSale selectDdSaleById(Long id);
/**
* 查询销售主单列表
*
* @param ddSale 销售主单
* @return 销售主单集合
*/
public List<DdSale> selectDdSaleList(DdSale ddSale);
/**
* 新增销售主单
*
* @param ddSale 销售主单
* @return 结果
*/
public int insertDdSale(DdSale ddSale);
/**
* 修改销售主单
*
* @param ddSale 销售主单
* @return 结果
*/
public int updateDdSale(DdSale ddSale);
/**
* 批量删除销售主单
*
* @param ids 需要删除的销售主单主键集合
* @return 结果
*/
public int deleteDdSaleByIds(Long[] ids);
/**
* 删除销售主单信息
*
* @param id 销售主单主键
* @return 结果
*/
public int deleteDdSaleById(Long id);
}

View File

@ -0,0 +1,147 @@
package com.zhyc.module.frozen.service.impl;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.zhyc.common.utils.DateUtils;
import com.zhyc.common.utils.StringUtils;
import com.zhyc.module.produce.breed.domain.ScEmbryoFlush;
import com.zhyc.module.produce.breed.mapper.ScEmbryoFlushMapper;
import com.zhyc.module.produce.breed.service.IScEmbryoFlushService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zhyc.module.frozen.mapper.DdFeMapper;
import com.zhyc.module.frozen.domain.DdFe;
import com.zhyc.module.frozen.service.IDdFeService;
import javax.annotation.Resource;
/**
* 冻胚库存Service业务层处理
*
* @author ruoyi
* @date 2025-11-29
*/
@Service
public class DdFeServiceImpl implements IDdFeService
{
@Autowired
private DdFeMapper ddFeMapper;
@Autowired
private ScEmbryoFlushMapper scEmbryoFlushMapper;
@Autowired
private IScEmbryoFlushService scEmbryoFlushService;
/**
* 查询冻胚库存
*
* @param id 冻胚库存主键
* @return 冻胚库存
*/
@Override
public DdFe selectDdFeById(Long id)
{
return ddFeMapper.selectDdFeById(id);
}
/**
* 查询冻胚库存列表
*
* @param ddFe 冻胚库存
* @return 冻胚库存
*/
@Override
public List<DdFe> selectDdFeList(DdFe ddFe)
{
return ddFeMapper.selectDdFeList(ddFe);
}
/**
* 新增冻胚库存
*
* @param ddFe 冻胚库存
* @return 结果
*/
@Override
public int insertDdFe(DdFe ddFe)
{
ddFe.setCreateTime(DateUtils.getNowDate());
return ddFeMapper.insertDdFe(ddFe);
}
/**
* 修改冻胚库存
*
* @param ddFe 冻胚库存
* @return 结果
*/
@Override
public int updateDdFe(DdFe ddFe)
{
return ddFeMapper.updateDdFe(ddFe);
}
/**
* 批量删除冻胚库存
*
* @param ids 需要删除的冻胚库存主键
* @return 结果
*/
@Override
public int deleteDdFeByIds(Long[] ids)
{
return ddFeMapper.deleteDdFeByIds(ids);
}
/**
* 删除冻胚库存信息
*
* @param id 冻胚库存主键
* @return 结果
*/
@Override
public int deleteDdFeById(Long id)
{
return ddFeMapper.deleteDdFeById(id);
}
@Override
public Map<String, Object> getLastFlushInfoByEwe(String eweNo) {
// 1. 冲胚数据冻胚自己的 SQL
Map<String, Object> flush = ddFeMapper.selectFlushByEwe(eweNo);
if (flush == null) return null;
String ramId = (String) flush.get("ramId");
if (StringUtils.isBlank(ramId)) return null;
// 2. 公羊品种
Map<String, Object> ram = scEmbryoFlushMapper.selectSheepInfoByManageTag(ramId);
String ramBreed = (String) ram.get("variety");
// 3. 母羊品种
Map<String, Object> ewe = scEmbryoFlushMapper.selectSheepInfoByManageTag(eweNo);
String eweBreed = (String) ewe.get("variety");
// 4. 胚胎品种
String embryoBreed = scEmbryoFlushService.calculateEmbryoVariety(ramBreed, eweBreed);
// 5. 封装 4 字段
Map<String, Object> rsp = new HashMap<>(8);
rsp.put("drId", ramId);
rsp.put("drBreed", ramBreed);
rsp.put("deBreed", eweBreed);
rsp.put("embBreed", embryoBreed);
// 如果以后需要等级数量也从这个 flush map 里取
rsp.put("gradeA", flush.get("gradeA"));
rsp.put("gradeB", flush.get("gradeB"));
rsp.put("gradeC", flush.get("gradeC"));
rsp.put("gradeD", flush.get("gradeD"));
return rsp;
}
// 废弃
@Override
public int discard(DdFe dto) {
return ddFeMapper.updateDiscard(dto);
}
}

View File

@ -0,0 +1,129 @@
package com.zhyc.module.frozen.service.impl;
import java.util.List;
import com.zhyc.common.exception.ServiceException;
import com.zhyc.common.utils.DateUtils;
import com.zhyc.module.base.domain.BasSheep;
import com.zhyc.module.base.domain.BasSheepVariety;
import com.zhyc.module.base.mapper.BasSheepMapper;
import com.zhyc.module.base.mapper.BasSheepVarietyMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zhyc.module.frozen.mapper.DdFsMapper;
import com.zhyc.module.frozen.domain.DdFs;
import com.zhyc.module.frozen.service.IDdFsService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* 冻精库存Service业务层处理
*
* @author ruoyi
* @date 2025-11-29
*/
@Service
public class DdFsServiceImpl implements IDdFsService {
@Autowired
private DdFsMapper ddFsMapper;
@Autowired
private BasSheepMapper basSheepMapper;
@Autowired
private BasSheepVarietyMapper basSheepVarietyMapper;
/**
* 查询冻精库存
*
* @param id 冻精库存主键
* @return 冻精库存
*/
@Override
public DdFs selectDdFsById(Long id) {
return ddFsMapper.selectDdFsById(id);
}
/**
* 查询冻精库存列表
*
* @param ddFs 冻精库存
* @return 冻精库存
*/
@Override
public List<DdFs> selectDdFsList(DdFs ddFs) {
return ddFsMapper.selectDdFsList(ddFs);
}
/**
* 新增冻精库存
*
* @param ddFs 冻精库存
* @return 结果
*/
@Override
public int insertDdFs(DdFs ddFs) {
BasSheep ram = basSheepMapper.selectBasSheepByManageTags(ddFs.getCode());
if (ram == null) {
throw new ServiceException("公羊不存在");
}
if (ram.getStatusId() == null || !ram.getStatusId().equals(1L)) {
throw new ServiceException("羊只不在群");
}
if (ram.getGender() == null || !ram.getGender().equals(2L)) {
throw new ServiceException("该耳号对应不是公羊");
}
if (ddFs.getBreed() == null || ddFs.getBreed().trim().isEmpty()) {
BasSheepVariety variety = basSheepVarietyMapper.selectBasSheepVarietyById(ram.getVarietyId());
ddFs.setBreed(variety == null ? "" : variety.getVariety());
}
ddFs.setCreateTime(DateUtils.getNowDate());
return ddFsMapper.insertDdFs(ddFs);
}
/**
* 修改冻精库存
*
* @param ddFs 冻精库存
* @return 结果
*/
@Override
public int updateDdFs(DdFs ddFs) {
return ddFsMapper.updateDdFs(ddFs);
}
/**
* 批量删除冻精库存
*
* @param ids 需要删除的冻精库存主键
* @return 结果
*/
@Override
public int deleteDdFsByIds(Long[] ids) {
return ddFsMapper.deleteDdFsByIds(ids);
}
/**
* 删除冻精库存信息
*
* @param id 冻精库存主键
* @return 结果
*/
@Override
public int deleteDdFsById(Long id) {
return ddFsMapper.deleteDdFsById(id);
}
// 废弃
@Override
public int discard(List<DdFs> list) {
return list.stream()
.mapToInt(item -> {
DdFs update = new DdFs();
update.setId(item.getId());
update.setStat("废弃");
update.setDiscardTxt(item.getDiscardTxt());
return ddFsMapper.updateDdFs(update);
})
.sum();
}
}

View File

@ -0,0 +1,133 @@
package com.zhyc.module.frozen.service.impl;
import java.util.List;
import com.zhyc.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import com.zhyc.common.utils.StringUtils;
import org.springframework.transaction.annotation.Transactional;
import com.zhyc.module.frozen.domain.DdSaleItem;
import com.zhyc.module.frozen.mapper.DdSaleMapper;
import com.zhyc.module.frozen.domain.DdSale;
import com.zhyc.module.frozen.service.IDdSaleService;
/**
* 销售主单Service业务层处理
*
* @author HashMap
* @date 2025-12-01
*/
@Service
public class DdSaleServiceImpl implements IDdSaleService
{
@Autowired
private DdSaleMapper ddSaleMapper;
/**
* 查询销售主单
*
* @param id 销售主单主键
* @return 销售主单
*/
@Override
public DdSale selectDdSaleById(Long id)
{
return ddSaleMapper.selectDdSaleById(id);
}
/**
* 查询销售主单列表
*
* @param ddSale 销售主单
* @return 销售主单
*/
@Override
public List<DdSale> selectDdSaleList(DdSale ddSale)
{
return ddSaleMapper.selectDdSaleList(ddSale);
}
/**
* 新增销售主单
*
* @param ddSale 销售主单
* @return 结果
*/
@Transactional
@Override
public int insertDdSale(DdSale ddSale)
{
ddSale.setCreateTime(DateUtils.getNowDate());
int rows = ddSaleMapper.insertDdSale(ddSale);
insertDdSaleItem(ddSale);
return rows;
}
/**
* 修改销售主单
*
* @param ddSale 销售主单
* @return 结果
*/
@Transactional
@Override
public int updateDdSale(DdSale ddSale)
{
ddSaleMapper.deleteDdSaleItemBySaleId(ddSale.getId());
insertDdSaleItem(ddSale);
return ddSaleMapper.updateDdSale(ddSale);
}
/**
* 批量删除销售主单
*
* @param ids 需要删除的销售主单主键
* @return 结果
*/
@Transactional
@Override
public int deleteDdSaleByIds(Long[] ids)
{
ddSaleMapper.deleteDdSaleItemBySaleIds(ids);
return ddSaleMapper.deleteDdSaleByIds(ids);
}
/**
* 删除销售主单信息
*
* @param id 销售主单主键
* @return 结果
*/
@Transactional
@Override
public int deleteDdSaleById(Long id)
{
ddSaleMapper.deleteDdSaleItemBySaleId(id);
return ddSaleMapper.deleteDdSaleById(id);
}
/**
* 新增销售明细信息
*
* @param ddSale 销售主单对象
*/
public void insertDdSaleItem(DdSale ddSale)
{
List<DdSaleItem> ddSaleItemList = ddSale.getDdSaleItemList();
Long id = ddSale.getId();
if (StringUtils.isNotNull(ddSaleItemList))
{
List<DdSaleItem> list = new ArrayList<DdSaleItem>();
for (DdSaleItem ddSaleItem : ddSaleItemList)
{
ddSaleItem.setSaleId(id);
list.add(ddSaleItem);
}
if (list.size() > 0)
{
ddSaleMapper.batchDdSaleItem(list);
}
}
}
}

View File

@ -99,7 +99,7 @@ public class ScBreedRecordController extends BaseController
} }
/** /**
* 根据母羊耳号获取最新配种计划信息优先从配种计划生成表获取 * 根据母羊耳号获取最新配种计划信息(优先从配种计划生成表获取)
*/ */
@PreAuthorize("@ss.hasPermi('Breeding_records:Breeding_records:query')") @PreAuthorize("@ss.hasPermi('Breeding_records:Breeding_records:query')")
@GetMapping(value = "/getLatestBreedPlan/{manageTags}") @GetMapping(value = "/getLatestBreedPlan/{manageTags}")
@ -139,12 +139,12 @@ public class ScBreedRecordController extends BaseController
scBreedRecord.setRamId(ramId.toString()); scBreedRecord.setRamId(ramId.toString());
} }
// 验证配种方式 // 修改验证配种方式 - 增加3-冲胚 4-自然发情人工授精
if (scBreedRecord.getBreedType() == null) { if (scBreedRecord.getBreedType() == null) {
return error("配种方式不能为空"); return error("配种方式不能为空");
} }
if (scBreedRecord.getBreedType() != 1 && scBreedRecord.getBreedType() != 2) { if (scBreedRecord.getBreedType() < 1 || scBreedRecord.getBreedType() > 4) {
return error("配种方式只能是1-同期发情 或 2-本交"); return error("配种方式只能是1-同期发情、2-本交、3-冲胚、4-自然发情人工授精");
} }
// 验证技术员 // 验证技术员
@ -186,10 +186,10 @@ public class ScBreedRecordController extends BaseController
scBreedRecord.setRamId(ramId.toString()); scBreedRecord.setRamId(ramId.toString());
} }
// 验证配种方式 // 修改验证配种方式
if (scBreedRecord.getBreedType() != null) { if (scBreedRecord.getBreedType() != null) {
if (scBreedRecord.getBreedType() != 1 && scBreedRecord.getBreedType() != 2) { if (scBreedRecord.getBreedType() < 1 || scBreedRecord.getBreedType() > 4) {
return error("配种方式只能是1-同期发情 或 2-本交"); return error("配种方式只能是1-同期发情、2-本交、3-冲胚、4-自然发情人工授精");
} }
} }
@ -223,7 +223,7 @@ public class ScBreedRecordController extends BaseController
if (result > 0) { if (result > 0) {
return success("孕检结果同步成功"); return success("孕检结果同步成功");
} else { } else {
return error("孕检结果同步失败可能未找到对应的配种记录"); return error("孕检结果同步失败,可能未找到对应的配种记录");
} }
} }

View File

@ -0,0 +1,129 @@
package com.zhyc.module.produce.breed.controller;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
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.RequestParam;
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.produce.breed.domain.ScEmbryoFlush;
import com.zhyc.module.produce.breed.service.IScEmbryoFlushService;
import com.zhyc.common.utils.poi.ExcelUtil;
import com.zhyc.common.core.page.TableDataInfo;
/**
* 冲胚记录Controller
*
* @author ruoyi
* @date 2025-11-28
*/
@RestController
@RequestMapping("/embryo/flush")
public class ScEmbryoFlushController extends BaseController
{
@Autowired
private IScEmbryoFlushService scEmbryoFlushService;
/**
* 查询冲胚记录列表
*/
@PreAuthorize("@ss.hasPermi('embryo:flush:list')")
@GetMapping("/list")
public TableDataInfo list(ScEmbryoFlush scEmbryoFlush)
{
startPage();
List<ScEmbryoFlush> list = scEmbryoFlushService.selectScEmbryoFlushList(scEmbryoFlush);
return getDataTable(list);
}
/**
* 导出冲胚记录列表
*/
@PreAuthorize("@ss.hasPermi('embryo:flush:export')")
@Log(title = "冲胚记录", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ScEmbryoFlush scEmbryoFlush)
{
List<ScEmbryoFlush> list = scEmbryoFlushService.selectScEmbryoFlushList(scEmbryoFlush);
ExcelUtil<ScEmbryoFlush> util = new ExcelUtil<ScEmbryoFlush>(ScEmbryoFlush.class);
util.exportExcel(response, list, "冲胚记录数据");
}
/**
* 获取冲胚记录详细信息
*/
@PreAuthorize("@ss.hasPermi('embryo:flush:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(scEmbryoFlushService.selectScEmbryoFlushById(id));
}
/**
* 新增冲胚记录
*/
@PreAuthorize("@ss.hasPermi('embryo:flush:add')")
@Log(title = "冲胚记录", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ScEmbryoFlush scEmbryoFlush)
{
return toAjax(scEmbryoFlushService.insertScEmbryoFlush(scEmbryoFlush));
}
/**
* 修改冲胚记录
*/
@PreAuthorize("@ss.hasPermi('embryo:flush:edit')")
@Log(title = "冲胚记录", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ScEmbryoFlush scEmbryoFlush)
{
return toAjax(scEmbryoFlushService.updateScEmbryoFlush(scEmbryoFlush));
}
/**
* 删除冲胚记录
*/
@PreAuthorize("@ss.hasPermi('embryo:flush:remove')")
@Log(title = "冲胚记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(scEmbryoFlushService.deleteScEmbryoFlushByIds(ids));
}
/**
* 根据供体母羊耳号获取关联信息
* 返回母羊品种父号父号品种胚胎品种牧场信息配种日期等
*/
@PreAuthorize("@ss.hasPermi('embryo:flush:query')")
@GetMapping("/getDonorInfo")
public AjaxResult getDonorRelatedInfo(@RequestParam("donorFemaleNo") String donorFemaleNo)
{
Map<String, Object> info = scEmbryoFlushService.getDonorRelatedInfo(donorFemaleNo);
return success(info);
}
/**
* 获取供体母羊下拉列表
*/
@PreAuthorize("@ss.hasPermi('embryo:flush:query')")
@GetMapping("/donorFemaleList")
public AjaxResult getDonorFemaleList()
{
List<Map<String, Object>> list = scEmbryoFlushService.selectDonorFemaleList();
return success(list);
}
}

View File

@ -0,0 +1,504 @@
package com.zhyc.module.produce.breed.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
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;
/**
* 冲胚记录-用户录入对象 sc_embryo_flush
*
* @author ruoyi
* @date 2025-11-28
*/
public class ScEmbryoFlush extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long id;
/** 冲胚时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "冲胚时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date flushTime;
/** 供体母号 */
@Excel(name = "供体母号")
private String donorFemaleNo;
/** 供体母羊品种 */
@Excel(name = "供体母羊品种")
private String donorFemaleVariety;
/** 供体父号 */
@Excel(name = "供体父号")
private String donorMaleNo;
/** 供体公羊品种 */
@Excel(name = "供体公羊品种")
private String donorMaleVariety;
/** 胚胎品种 */
@Excel(name = "胚胎品种")
private String embryoVariety;
/** 胎龄(天) */
@Excel(name = "胎龄(天)")
private Integer embryoAge;
/** A+级胚胎数 */
@Excel(name = "A+级")
private Integer gradeAPlus;
/** A级胚胎数 */
@Excel(name = "A级")
private Integer gradeA;
/** B级胚胎数 */
@Excel(name = "B级")
private Integer gradeB;
/** C级胚胎数 */
@Excel(name = "C级")
private Integer gradeC;
/** D级胚胎数 */
@Excel(name = "D级")
private Integer gradeD;
/** 2/4细胞期 */
@Excel(name = "2/4细胞")
private Integer cell24;
/** 8细胞期 */
@Excel(name = "8细胞")
private Integer cell8;
/** 16细胞期 */
@Excel(name = "16细胞")
private Integer cell16;
/** 未受精数 */
@Excel(name = "未受精")
private Integer unfertilized;
/** 退化数 */
@Excel(name = "退化")
private Integer degenerated;
/** 冲胚数(总和) */
@Excel(name = "冲胚数")
private Integer totalEmbryo;
/** 有效胚(A+到D级总和) */
@Excel(name = "有效胚")
private Integer validEmbryo;
/** 移胚数 */
@Excel(name = "移胚数")
private Integer transferred;
/** 移植受体数 */
@Excel(name = "移植受体数")
private Integer recipientCnt;
/** 胚胎类型 */
@Excel(name = "胚胎类型")
private String embryoType;
/** 胚胎来源 */
@Excel(name = "胚胎来源")
private String embryoSource;
/** 去向 */
@Excel(name = "去向")
private String destination;
/** 存储方式 */
@Excel(name = "存储方式")
private String storageMethod;
/** 冲胚人 */
@Excel(name = "冲胚人")
private String flushOperator;
/** 捡胚人 */
@Excel(name = "捡胚人")
private String collectOperator;
/** 所在牧场ID */
private Long ranchId;
/** 所在牧场名称 */
@Excel(name = "所在牧场")
private String ranchName;
/** 创建人 */
private String createdBy;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createdAt;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setFlushTime(Date flushTime)
{
this.flushTime = flushTime;
}
public Date getFlushTime()
{
return flushTime;
}
public void setDonorFemaleNo(String donorFemaleNo)
{
this.donorFemaleNo = donorFemaleNo;
}
public String getDonorFemaleNo()
{
return donorFemaleNo;
}
public void setDonorFemaleVariety(String donorFemaleVariety)
{
this.donorFemaleVariety = donorFemaleVariety;
}
public String getDonorFemaleVariety()
{
return donorFemaleVariety;
}
public void setDonorMaleNo(String donorMaleNo)
{
this.donorMaleNo = donorMaleNo;
}
public String getDonorMaleNo()
{
return donorMaleNo;
}
public void setDonorMaleVariety(String donorMaleVariety)
{
this.donorMaleVariety = donorMaleVariety;
}
public String getDonorMaleVariety()
{
return donorMaleVariety;
}
public void setEmbryoVariety(String embryoVariety)
{
this.embryoVariety = embryoVariety;
}
public String getEmbryoVariety()
{
return embryoVariety;
}
public void setEmbryoAge(Integer embryoAge)
{
this.embryoAge = embryoAge;
}
public Integer getEmbryoAge()
{
return embryoAge;
}
public void setGradeAPlus(Integer gradeAPlus)
{
this.gradeAPlus = gradeAPlus;
}
public Integer getGradeAPlus()
{
return gradeAPlus;
}
public void setGradeA(Integer gradeA)
{
this.gradeA = gradeA;
}
public Integer getGradeA()
{
return gradeA;
}
public void setGradeB(Integer gradeB)
{
this.gradeB = gradeB;
}
public Integer getGradeB()
{
return gradeB;
}
public void setGradeC(Integer gradeC)
{
this.gradeC = gradeC;
}
public Integer getGradeC()
{
return gradeC;
}
public void setGradeD(Integer gradeD)
{
this.gradeD = gradeD;
}
public Integer getGradeD()
{
return gradeD;
}
public void setCell24(Integer cell24)
{
this.cell24 = cell24;
}
public Integer getCell24()
{
return cell24;
}
public void setCell8(Integer cell8)
{
this.cell8 = cell8;
}
public Integer getCell8()
{
return cell8;
}
public void setCell16(Integer cell16)
{
this.cell16 = cell16;
}
public Integer getCell16()
{
return cell16;
}
public void setUnfertilized(Integer unfertilized)
{
this.unfertilized = unfertilized;
}
public Integer getUnfertilized()
{
return unfertilized;
}
public void setDegenerated(Integer degenerated)
{
this.degenerated = degenerated;
}
public Integer getDegenerated()
{
return degenerated;
}
public void setTotalEmbryo(Integer totalEmbryo)
{
this.totalEmbryo = totalEmbryo;
}
public Integer getTotalEmbryo()
{
return totalEmbryo;
}
public void setValidEmbryo(Integer validEmbryo)
{
this.validEmbryo = validEmbryo;
}
public Integer getValidEmbryo()
{
return validEmbryo;
}
public void setTransferred(Integer transferred)
{
this.transferred = transferred;
}
public Integer getTransferred()
{
return transferred;
}
public void setRecipientCnt(Integer recipientCnt)
{
this.recipientCnt = recipientCnt;
}
public Integer getRecipientCnt()
{
return recipientCnt;
}
public void setEmbryoType(String embryoType)
{
this.embryoType = embryoType;
}
public String getEmbryoType()
{
return embryoType;
}
public void setEmbryoSource(String embryoSource)
{
this.embryoSource = embryoSource;
}
public String getEmbryoSource()
{
return embryoSource;
}
public void setDestination(String destination)
{
this.destination = destination;
}
public String getDestination()
{
return destination;
}
public void setStorageMethod(String storageMethod)
{
this.storageMethod = storageMethod;
}
public String getStorageMethod()
{
return storageMethod;
}
public void setFlushOperator(String flushOperator)
{
this.flushOperator = flushOperator;
}
public String getFlushOperator()
{
return flushOperator;
}
public void setCollectOperator(String collectOperator)
{
this.collectOperator = collectOperator;
}
public String getCollectOperator()
{
return collectOperator;
}
public void setRanchId(Long ranchId)
{
this.ranchId = ranchId;
}
public Long getRanchId()
{
return ranchId;
}
public void setRanchName(String ranchName)
{
this.ranchName = ranchName;
}
public String getRanchName()
{
return ranchName;
}
public void setCreatedBy(String createdBy)
{
this.createdBy = createdBy;
}
public String getCreatedBy()
{
return createdBy;
}
public void setCreatedAt(Date createdAt)
{
this.createdAt = createdAt;
}
public Date getCreatedAt()
{
return createdAt;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("flushTime", getFlushTime())
.append("donorFemaleNo", getDonorFemaleNo())
.append("donorFemaleVariety", getDonorFemaleVariety())
.append("donorMaleNo", getDonorMaleNo())
.append("donorMaleVariety", getDonorMaleVariety())
.append("embryoVariety", getEmbryoVariety())
.append("embryoAge", getEmbryoAge())
.append("gradeAPlus", getGradeAPlus())
.append("gradeA", getGradeA())
.append("gradeB", getGradeB())
.append("gradeC", getGradeC())
.append("gradeD", getGradeD())
.append("cell24", getCell24())
.append("cell8", getCell8())
.append("cell16", getCell16())
.append("unfertilized", getUnfertilized())
.append("degenerated", getDegenerated())
.append("totalEmbryo", getTotalEmbryo())
.append("validEmbryo", getValidEmbryo())
.append("transferred", getTransferred())
.append("recipientCnt", getRecipientCnt())
.append("embryoType", getEmbryoType())
.append("embryoSource", getEmbryoSource())
.append("destination", getDestination())
.append("storageMethod", getStorageMethod())
.append("flushOperator", getFlushOperator())
.append("collectOperator", getCollectOperator())
.append("ranchId", getRanchId())
.append("ranchName", getRanchName())
.append("remark", getRemark())
.append("createdBy", getCreatedBy())
.append("createdAt", getCreatedAt())
.toString();
}
}

View File

@ -0,0 +1,86 @@
package com.zhyc.module.produce.breed.mapper;
import java.util.List;
import java.util.Map;
import com.zhyc.module.produce.breed.domain.ScEmbryoFlush;
import org.apache.ibatis.annotations.Param;
/**
* 冲胚记录-用户录入Mapper接口
*
* @author ruoyi
* @date 2025-11-28
*/
public interface ScEmbryoFlushMapper
{
/**
* 查询冲胚记录-用户录入
*
* @param id 冲胚记录-用户录入主键
* @return 冲胚记录-用户录入
*/
public ScEmbryoFlush selectScEmbryoFlushById(Long id);
/**
* 查询冲胚记录-用户录入列表
*
* @param scEmbryoFlush 冲胚记录-用户录入
* @return 冲胚记录-用户录入集合
*/
public List<ScEmbryoFlush> selectScEmbryoFlushList(ScEmbryoFlush scEmbryoFlush);
/**
* 新增冲胚记录-用户录入
*
* @param scEmbryoFlush 冲胚记录-用户录入
* @return 结果
*/
public int insertScEmbryoFlush(ScEmbryoFlush scEmbryoFlush);
/**
* 修改冲胚记录-用户录入
*
* @param scEmbryoFlush 冲胚记录-用户录入
* @return 结果
*/
public int updateScEmbryoFlush(ScEmbryoFlush scEmbryoFlush);
/**
* 删除冲胚记录-用户录入
*
* @param id 冲胚记录-用户录入主键
* @return 结果
*/
public int deleteScEmbryoFlushById(Long id);
/**
* 批量删除冲胚记录-用户录入
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteScEmbryoFlushByIds(Long[] ids);
/**
* 根据耳号查询羊只信息(从sheep_file视图)
*
* @param manageTag 管理耳号
* @return 羊只信息Map(variety品种, varietyId品种ID, ranchId牧场ID, ranchName牧场名称)
*/
public Map<String, Object> selectSheepInfoByManageTag(@Param("manageTag") String manageTag);
/**
* 根据母羊耳号查询最近一条配种记录
*
* @param eweManageTag 母羊耳号
* @return 配种记录(ramId公羊耳号, matingDate配种日期)
*/
public Map<String, Object> selectBreedRecordByEwe(@Param("eweManageTag") String eweManageTag);
/**
* 查询所有母羊列表(用于下拉选择)
*
* @return 母羊列表
*/
public List<Map<String, Object>> selectDonorFemaleList();
}

View File

@ -0,0 +1,86 @@
package com.zhyc.module.produce.breed.service;
import java.util.List;
import java.util.Map;
import com.zhyc.module.produce.breed.domain.ScEmbryoFlush;
/**
* 冲胚记录-用户录入Service接口
*
* @author ruoyi
* @date 2025-11-28
*/
public interface IScEmbryoFlushService
{
/**
* 查询冲胚记录-用户录入
*
* @param id 冲胚记录-用户录入主键
* @return 冲胚记录-用户录入
*/
public ScEmbryoFlush selectScEmbryoFlushById(Long id);
/**
* 查询冲胚记录-用户录入列表
*
* @param scEmbryoFlush 冲胚记录-用户录入
* @return 冲胚记录-用户录入集合
*/
public List<ScEmbryoFlush> selectScEmbryoFlushList(ScEmbryoFlush scEmbryoFlush);
/**
* 新增冲胚记录-用户录入
*
* @param scEmbryoFlush 冲胚记录-用户录入
* @return 结果
*/
public int insertScEmbryoFlush(ScEmbryoFlush scEmbryoFlush);
/**
* 修改冲胚记录-用户录入
*
* @param scEmbryoFlush 冲胚记录-用户录入
* @return 结果
*/
public int updateScEmbryoFlush(ScEmbryoFlush scEmbryoFlush);
/**
* 批量删除冲胚记录-用户录入
*
* @param ids 需要删除的冲胚记录-用户录入主键集合
* @return 结果
*/
public int deleteScEmbryoFlushByIds(Long[] ids);
/**
* 删除冲胚记录-用户录入信息
*
* @param id 冲胚记录-用户录入主键
* @return 结果
*/
public int deleteScEmbryoFlushById(Long id);
/**
* 根据供体母羊耳号获取关联信息
*
* @param donorFemaleNo 供体母羊耳号
* @return 关联信息(母羊品种父号父号品种牧场信息配种日期等)
*/
public Map<String, Object> getDonorRelatedInfo(String donorFemaleNo);
/**
* 根据父母品种计算胚胎品种
*
* @param maleVariety 公羊品种
* @param femaleVariety 母羊品种
* @return 胚胎品种
*/
public String calculateEmbryoVariety(String maleVariety, String femaleVariety);
/**
* 查询所有供体母羊列表(用于下拉选择)
*
* @return 母羊列表
*/
public List<Map<String, Object>> selectDonorFemaleList();
}

View File

@ -0,0 +1,326 @@
package com.zhyc.module.produce.breed.service.impl;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zhyc.module.produce.breed.mapper.ScEmbryoFlushMapper;
import com.zhyc.module.produce.breed.domain.ScEmbryoFlush;
import com.zhyc.module.produce.breed.service.IScEmbryoFlushService;
/**
* 冲胚记录Service业务层处理
*
* @author ruoyi
* @date 2025-11-28
*/
@Service
public class ScEmbryoFlushServiceImpl implements IScEmbryoFlushService
{
@Autowired
private ScEmbryoFlushMapper scEmbryoFlushMapper;
/**
* 品种ID常量
* 1-湖羊, 2-东佛里生, 3-回交, 4-级杂一代, 5-级杂二代, 6-级杂三代, 7-1世代, 8-2世代, 9-3世代, 10-4世代
*/
private static final int VARIETY_HUYANG = 1; // 湖羊
private static final int VARIETY_DONGFULISHENG = 2; // 东佛里生
private static final int VARIETY_HUIJIAO = 3; // 回交
private static final int VARIETY_JIZA_1 = 4; // 级杂一代
private static final int VARIETY_JIZA_2 = 5; // 级杂二代
private static final int VARIETY_JIZA_3 = 6; // 级杂三代
private static final int VARIETY_SHIDAI_1 = 7; // 1世代
private static final int VARIETY_SHIDAI_2 = 8; // 2世代
private static final int VARIETY_SHIDAI_3 = 9; // 3世代
private static final int VARIETY_SHIDAI_4 = 10; // 4世代
/** 品种ID到名称的映射 */
private static final Map<Integer, String> VARIETY_NAME_MAP = new HashMap<>();
static {
VARIETY_NAME_MAP.put(1, "湖羊");
VARIETY_NAME_MAP.put(2, "东佛里生");
VARIETY_NAME_MAP.put(3, "回交");
VARIETY_NAME_MAP.put(4, "级杂一代");
VARIETY_NAME_MAP.put(5, "级杂二代");
VARIETY_NAME_MAP.put(6, "级杂三代");
VARIETY_NAME_MAP.put(7, "1世代");
VARIETY_NAME_MAP.put(8, "2世代");
VARIETY_NAME_MAP.put(9, "3世代");
VARIETY_NAME_MAP.put(10, "4世代");
}
@Override
public ScEmbryoFlush selectScEmbryoFlushById(Long id)
{
return scEmbryoFlushMapper.selectScEmbryoFlushById(id);
}
@Override
public List<ScEmbryoFlush> selectScEmbryoFlushList(ScEmbryoFlush scEmbryoFlush)
{
return scEmbryoFlushMapper.selectScEmbryoFlushList(scEmbryoFlush);
}
@Override
public int insertScEmbryoFlush(ScEmbryoFlush scEmbryoFlush)
{
calculateEmbryoCount(scEmbryoFlush);
return scEmbryoFlushMapper.insertScEmbryoFlush(scEmbryoFlush);
}
@Override
public int updateScEmbryoFlush(ScEmbryoFlush scEmbryoFlush)
{
calculateEmbryoCount(scEmbryoFlush);
return scEmbryoFlushMapper.updateScEmbryoFlush(scEmbryoFlush);
}
@Override
public int deleteScEmbryoFlushByIds(Long[] ids)
{
return scEmbryoFlushMapper.deleteScEmbryoFlushByIds(ids);
}
@Override
public int deleteScEmbryoFlushById(Long id)
{
return scEmbryoFlushMapper.deleteScEmbryoFlushById(id);
}
/**
* 计算冲胚数和有效胚数量
*/
private void calculateEmbryoCount(ScEmbryoFlush flush)
{
int gradeAPlus = flush.getGradeAPlus() != null ? flush.getGradeAPlus() : 0;
int gradeA = flush.getGradeA() != null ? flush.getGradeA() : 0;
int gradeB = flush.getGradeB() != null ? flush.getGradeB() : 0;
int gradeC = flush.getGradeC() != null ? flush.getGradeC() : 0;
int gradeD = flush.getGradeD() != null ? flush.getGradeD() : 0;
int cell24 = flush.getCell24() != null ? flush.getCell24() : 0;
int cell8 = flush.getCell8() != null ? flush.getCell8() : 0;
int cell16 = flush.getCell16() != null ? flush.getCell16() : 0;
int unfertilized = flush.getUnfertilized() != null ? flush.getUnfertilized() : 0;
int degenerated = flush.getDegenerated() != null ? flush.getDegenerated() : 0;
// 有效胚 = A+ + A + B + C + D
flush.setValidEmbryo(gradeAPlus + gradeA + gradeB + gradeC + gradeD);
// 冲胚数 = 所有数量求和
flush.setTotalEmbryo(gradeAPlus + gradeA + gradeB + gradeC + gradeD
+ cell24 + cell8 + cell16 + unfertilized + degenerated);
}
/**
* 根据供体母羊耳号获取关联信息
*/
@Override
public Map<String, Object> getDonorRelatedInfo(String donorFemaleNo)
{
Map<String, Object> result = new HashMap<>();
if (donorFemaleNo == null || donorFemaleNo.trim().isEmpty()) {
return result;
}
// 1. 查询母羊信息
Map<String, Object> femaleInfo = scEmbryoFlushMapper.selectSheepInfoByManageTag(donorFemaleNo);
if (femaleInfo == null || femaleInfo.isEmpty()) {
return result;
}
String femaleVariety = (String) femaleInfo.get("variety");
Integer femaleVarietyId = getIntValue(femaleInfo.get("varietyId"));
result.put("donorFemaleVariety", femaleVariety);
result.put("donorFemaleVarietyId", femaleVarietyId);
result.put("ranchId", femaleInfo.get("ranchId"));
result.put("ranchName", femaleInfo.get("ranchName"));
// 2. 查询配种记录获取公羊信息
Map<String, Object> breedRecord = scEmbryoFlushMapper.selectBreedRecordByEwe(donorFemaleNo);
if (breedRecord != null && !breedRecord.isEmpty()) {
String ramId = (String) breedRecord.get("ramId");
result.put("donorMaleNo", ramId);
result.put("matingDate", breedRecord.get("matingDate"));
// 3. 查询公羊品种
if (ramId != null && !ramId.trim().isEmpty()) {
Map<String, Object> maleInfo = scEmbryoFlushMapper.selectSheepInfoByManageTag(ramId);
if (maleInfo != null && !maleInfo.isEmpty()) {
String maleVariety = (String) maleInfo.get("variety");
Integer maleVarietyId = getIntValue(maleInfo.get("varietyId"));
result.put("donorMaleVariety", maleVariety);
result.put("donorMaleVarietyId", maleVarietyId);
// 4. 根据品种ID计算胚胎品种
if (maleVarietyId != null && femaleVarietyId != null) {
String embryoVariety = calculateEmbryoVarietyById(maleVarietyId, femaleVarietyId);
result.put("embryoVariety", embryoVariety);
}
}
}
}
return result;
}
/**
* 安全获取Integer值
*/
private Integer getIntValue(Object obj) {
if (obj == null) {
return null;
}
if (obj instanceof Integer) {
return (Integer) obj;
}
if (obj instanceof Long) {
return ((Long) obj).intValue();
}
if (obj instanceof Number) {
return ((Number) obj).intValue();
}
try {
return Integer.parseInt(obj.toString());
} catch (NumberFormatException e) {
return null;
}
}
/**
* 根据品种名称获取ID
*/
private Integer getVarietyIdByName(String name) {
if (name == null) return null;
for (Map.Entry<Integer, String> entry : VARIETY_NAME_MAP.entrySet()) {
if (entry.getValue().equals(name)) {
return entry.getKey();
}
}
return null;
}
/**
* 根据父母品种名称计算胚胎品种接口方法
*/
@Override
public String calculateEmbryoVariety(String maleVariety, String femaleVariety)
{
Integer maleId = getVarietyIdByName(maleVariety);
Integer femaleId = getVarietyIdByName(femaleVariety);
if (maleId == null || femaleId == null) {
return null;
}
return calculateEmbryoVarietyById(maleId, femaleId);
}
/**
* 根据父母品种ID计算胚胎品种核心计算方法
*
* 品种规则:
* 1-湖羊, 2-东佛里生, 3-回交, 4-级杂一代, 5-级杂二代, 6-级杂三代, 7-1世代, 8-2世代, 9-3世代, 10-4世代
*
* 计算规则(根据图片):
* - 湖羊() × 湖羊() 湖羊
* - 东佛里生() × 东佛里生() 东佛里生
* - 东佛里生() × 湖羊() 级杂一代
* - 东佛里生() × 级杂一代() 级杂二代
* - 东佛里生() × 级杂二代() 级杂三代
* - 东佛里生() × 级杂三代() 东佛里生
* - 湖羊() × 级杂三代() 回交
* - 湖羊() × 回交() 回交
* - 世代计算...
*
* @param maleVarietyId 公羊品种ID
* @param femaleVarietyId 母羊品种ID
* @return 胚胎品种名称
*/
public String calculateEmbryoVarietyById(Integer maleVarietyId, Integer femaleVarietyId)
{
if (maleVarietyId == null || femaleVarietyId == null) {
return null;
}
int male = maleVarietyId;
int female = femaleVarietyId;
// 湖羊() × 湖羊() 湖羊
if (male == VARIETY_HUYANG && female == VARIETY_HUYANG) {
return VARIETY_NAME_MAP.get(VARIETY_HUYANG);
}
// 东佛里生() × 东佛里生() 东佛里生
if (male == VARIETY_DONGFULISHENG && female == VARIETY_DONGFULISHENG) {
return VARIETY_NAME_MAP.get(VARIETY_DONGFULISHENG);
}
// 东佛里生() × 湖羊() 级杂一代
if (male == VARIETY_DONGFULISHENG && female == VARIETY_HUYANG) {
return VARIETY_NAME_MAP.get(VARIETY_JIZA_1);
}
// 东佛里生() × 级杂一代() 级杂二代
if (male == VARIETY_DONGFULISHENG && female == VARIETY_JIZA_1) {
return VARIETY_NAME_MAP.get(VARIETY_JIZA_2);
}
// 东佛里生() × 级杂二代() 级杂三代
if (male == VARIETY_DONGFULISHENG && female == VARIETY_JIZA_2) {
return VARIETY_NAME_MAP.get(VARIETY_JIZA_3);
}
// 东佛里生() × 级杂三代() 东佛里生
if (male == VARIETY_DONGFULISHENG && female == VARIETY_JIZA_3) {
return VARIETY_NAME_MAP.get(VARIETY_DONGFULISHENG);
}
// 湖羊() × 级杂三代() 回交
if (male == VARIETY_HUYANG && female == VARIETY_JIZA_3) {
return VARIETY_NAME_MAP.get(VARIETY_HUIJIAO);
}
// 湖羊() × 回交() 回交
if (male == VARIETY_HUYANG && female == VARIETY_HUIJIAO) {
return VARIETY_NAME_MAP.get(VARIETY_HUIJIAO);
}
// ========== 世代计算规则 ==========
// 级杂二代(BM)或n世代(SM) × 级杂一代/级杂二代/级杂三代/回交() 世代
// 判断公羊是否为可产生世代的品种(级杂一代/二代/三代/回交)
boolean isMaleForShidai = (male == VARIETY_JIZA_1 || male == VARIETY_JIZA_2 ||
male == VARIETY_JIZA_3 || male == VARIETY_HUIJIAO);
if (isMaleForShidai) {
// 级杂二代() × 以上公羊 1世代
if (female == VARIETY_JIZA_2) {
return VARIETY_NAME_MAP.get(VARIETY_SHIDAI_1);
}
// 1世代() × 以上公羊 2世代
if (female == VARIETY_SHIDAI_1) {
return VARIETY_NAME_MAP.get(VARIETY_SHIDAI_2);
}
// 2世代() × 以上公羊 3世代
if (female == VARIETY_SHIDAI_2) {
return VARIETY_NAME_MAP.get(VARIETY_SHIDAI_3);
}
// 3世代() × 以上公羊 4世代
if (female == VARIETY_SHIDAI_3) {
return VARIETY_NAME_MAP.get(VARIETY_SHIDAI_4);
}
}
// 默认返回null表示无法计算或规则未覆盖
return null;
}
@Override
public List<Map<String, Object>> selectDonorFemaleList()
{
return scEmbryoFlushMapper.selectDonorFemaleList();
}
}

View File

@ -87,6 +87,7 @@ public class ScAddSheepController {
//导出 //导出
@Log(title = "羊只信息", businessType = BusinessType.EXPORT) @Log(title = "羊只信息", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('produce:add_sheep:export')")
@PostMapping("/exportForm") @PostMapping("/exportForm")
public void exportForm(HttpServletResponse response, @RequestBody ScAddSheep scAddSheep) throws IOException { public void exportForm(HttpServletResponse response, @RequestBody ScAddSheep scAddSheep) throws IOException {
ExcelUtil<ScAddSheep> util = new ExcelUtil<>(ScAddSheep.class); ExcelUtil<ScAddSheep> util = new ExcelUtil<>(ScAddSheep.class);

View File

@ -5,6 +5,8 @@ import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
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.common.exception.ServiceException;
import com.zhyc.module.sale.mapper.SxSheepSaleMapper; import com.zhyc.module.sale.mapper.SxSheepSaleMapper;
import com.zhyc.module.sale.domain.SxSheepSale; import com.zhyc.module.sale.domain.SxSheepSale;
import com.zhyc.module.sale.service.ISxSheepSaleService; import com.zhyc.module.sale.service.ISxSheepSaleService;
@ -49,8 +51,9 @@ public class SxSheepSaleServiceImpl implements ISxSheepSaleService {
* @return 结果 * @return 结果
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) // 事务控制
public int insertSxSheepSale(SxSheepSale sxSheepSale) { public int insertSxSheepSale(SxSheepSale sxSheepSale) {
// 1. 业务验证 (例如销售日期不能为空淘汰销售必须填写疾病类型等) // 1. 业务验证
validateSalesFields(sxSheepSale); validateSalesFields(sxSheepSale);
// 2. 自动计算逻辑 // 2. 自动计算逻辑
@ -77,6 +80,7 @@ public class SxSheepSaleServiceImpl implements ISxSheepSaleService {
* @return 结果 * @return 结果
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class)
public int updateSxSheepSale(SxSheepSale sxSheepSale) { public int updateSxSheepSale(SxSheepSale sxSheepSale) {
// 1. 业务验证 // 1. 业务验证
validateSalesFields(sxSheepSale); validateSalesFields(sxSheepSale);
@ -84,7 +88,7 @@ public class SxSheepSaleServiceImpl implements ISxSheepSaleService {
// 2. 自动计算逻辑 // 2. 自动计算逻辑
calculateSalesFields(sxSheepSale); calculateSalesFields(sxSheepSale);
// 3. 处理耳号列表多个耳号用逗号分隔 // 3. 处理耳号列表
if (sxSheepSale.getBsManageTagsList() != null && !sxSheepSale.getBsManageTagsList().isEmpty()) { if (sxSheepSale.getBsManageTagsList() != null && !sxSheepSale.getBsManageTagsList().isEmpty()) {
sxSheepSale.setBsManageTags(String.join(",", sxSheepSale.getBsManageTagsList())); sxSheepSale.setBsManageTags(String.join(",", sxSheepSale.getBsManageTagsList()));
} }
@ -116,7 +120,7 @@ public class SxSheepSaleServiceImpl implements ISxSheepSaleService {
} }
/** /**
* 新增根据耳号查询羊只信息 * 根据耳号查询羊只信息
*/ */
@Override @Override
public SxSheepSale selectSheepInfoByTag(String bsManageTags) { public SxSheepSale selectSheepInfoByTag(String bsManageTags) {
@ -124,7 +128,7 @@ public class SxSheepSaleServiceImpl implements ISxSheepSaleService {
} }
/** /**
* 新增自动计算总价平均体重平均单只价格 * 自动计算总价平均体重平均单只价格
*/ */
private void calculateSalesFields(SxSheepSale sxSheepSale) { private void calculateSalesFields(SxSheepSale sxSheepSale) {
String pricingMethod = sxSheepSale.getPricingMethod(); String pricingMethod = sxSheepSale.getPricingMethod();
@ -135,59 +139,48 @@ public class SxSheepSaleServiceImpl implements ISxSheepSaleService {
if (sxSheepSale.getBsManageTagsList() != null && !sxSheepSale.getBsManageTagsList().isEmpty()) { if (sxSheepSale.getBsManageTagsList() != null && !sxSheepSale.getBsManageTagsList().isEmpty()) {
sheepCount = sxSheepSale.getBsManageTagsList().size(); sheepCount = sxSheepSale.getBsManageTagsList().size();
} else if (sxSheepSale.getBsManageTags() != null && !sxSheepSale.getBsManageTags().isEmpty()) { } else if (sxSheepSale.getBsManageTags() != null && !sxSheepSale.getBsManageTags().isEmpty()) {
// 如果前端没有传递列表但有逗号分隔的字符串也计算数量
sheepCount = sxSheepSale.getBsManageTags().split(",").length; sheepCount = sxSheepSale.getBsManageTags().split(",").length;
} }
if ("按个体".equals(pricingMethod)) { if ("按个体".equals(pricingMethod)) {
// 总价 = 单价 * 数量
if (unitPrice != null) { if (unitPrice != null) {
sxSheepSale.setTotalPrice(unitPrice.multiply(new BigDecimal(sheepCount))); sxSheepSale.setTotalPrice(unitPrice.multiply(new BigDecimal(sheepCount)));
} }
// 平均单只价格就是单价
sxSheepSale.setAvgPricePerSheep(unitPrice); sxSheepSale.setAvgPricePerSheep(unitPrice);
} else if ("按体重".equals(pricingMethod)) { } else if ("按体重".equals(pricingMethod)) {
BigDecimal totalWeight = sxSheepSale.getTotalWeight(); BigDecimal totalWeight = sxSheepSale.getTotalWeight();
// 总价 = 单价 * 总重量
if (unitPrice != null && totalWeight != null) { if (unitPrice != null && totalWeight != null) {
sxSheepSale.setTotalPrice(unitPrice.multiply(totalWeight)); sxSheepSale.setTotalPrice(unitPrice.multiply(totalWeight));
} }
// 平均体重 = 总重量 / 数量
if (totalWeight != null && sheepCount > 0) { if (totalWeight != null && sheepCount > 0) {
sxSheepSale.setAvgWeight(totalWeight.divide(new BigDecimal(sheepCount), 2, RoundingMode.HALF_UP)); sxSheepSale.setAvgWeight(totalWeight.divide(new BigDecimal(sheepCount), 2, RoundingMode.HALF_UP));
} }
// 平均单只价格 = 总价 / 数量
if (sxSheepSale.getTotalPrice() != null && sheepCount > 0) { if (sxSheepSale.getTotalPrice() != null && sheepCount > 0) {
sxSheepSale.setAvgPricePerSheep(sxSheepSale.getTotalPrice().divide(new BigDecimal(sheepCount), 2, RoundingMode.HALF_UP)); sxSheepSale.setAvgPricePerSheep(sxSheepSale.getTotalPrice().divide(new BigDecimal(sheepCount), 2, RoundingMode.HALF_UP));
} }
} }
// 可以添加其他计价方式的逻辑
} }
/** /**
* 新增业务字段验证 * 业务字段验证 (使用 ServiceException)
*/ */
private void validateSalesFields(SxSheepSale sxSheepSale) { private void validateSalesFields(SxSheepSale sxSheepSale) {
// 验证销售日期不能为空
if (sxSheepSale.getSaleDate() == null) { if (sxSheepSale.getSaleDate() == null) {
throw new RuntimeException("销售日期不能为空!"); throw new ServiceException("销售日期不能为空!");
} }
String saleType = sxSheepSale.getSaleType(); String saleType = sxSheepSale.getSaleType();
// 如果销售类别是"淘汰销售""淘汰屠宰"则疾病类型和班组不能为空
if ("淘汰销售".equals(saleType) || "淘汰屠宰".equals(saleType)) { if ("淘汰销售".equals(saleType) || "淘汰屠宰".equals(saleType)) {
if (sxSheepSale.getDiseaseType() == null) { if (sxSheepSale.getDiseaseType() == null) {
throw new RuntimeException("淘汰销售或淘汰屠宰必须选择疾病类型!"); throw new ServiceException("淘汰销售或淘汰屠宰必须选择疾病类型!");
} }
if (sxSheepSale.getGroupCode() == null) { if (sxSheepSale.getGroupCode() == null) {
throw new RuntimeException("淘汰销售或淘汰屠宰必须选择班组!"); throw new ServiceException("淘汰销售或淘汰屠宰必须选择班组!");
} }
} }
// 如果疾病类型是"病残羊"则次要原因不能为空
if ("病残羊".equals(sxSheepSale.getDiseaseType())) { if ("病残羊".equals(sxSheepSale.getDiseaseType())) {
if (sxSheepSale.getSecondaryReason() == null || sxSheepSale.getSecondaryReason().trim().isEmpty()) { if (sxSheepSale.getSecondaryReason() == null || sxSheepSale.getSecondaryReason().trim().isEmpty()) {
throw new RuntimeException("疾病类型为病残羊时,必须填写次要原因!"); throw new ServiceException("疾病类型为病残羊时,必须填写次要原因!");
} }
} }
} }

View File

@ -5,14 +5,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<mapper namespace="com.zhyc.module.common.mapper.UserPostMapper"> <mapper namespace="com.zhyc.module.common.mapper.UserPostMapper">
<resultMap type="UserPost" id="UserPostResult"> <resultMap type="UserPost" id="UserPostResult">
<result property="userId" column="user_id" />
<result property="nickName" column="nick_name" /> <result property="nickName" column="nick_name" />
<result property="postName" column="post_name"/> <result property="postName" column="post_name"/>
<result property="postCode" column="post_code" /> <result property="postCode" column="post_code" />
</resultMap> </resultMap>
<select id="getUserPostListByCode" resultMap="UserPostResult"> <select id="getUserPostListByCode" resultMap="UserPostResult">
SELECT u.user_id, nick_name , post_name , post_code
FROM sys_role r
JOIN sys_user_role ur ON r.role_id = ur.role_id
JOIN sys_user u ON ur.user_id = u.user_id
JOIN sys_user_post up ON u.user_id = up.user_id
JOIN sys_post p ON up.post_id = p.post_id
WHERE p.post_code LIKE CONCAT('%', #{postCode}, '%')
AND r.status = 0 and r.del_flag = 0;
</select> </select>
</mapper> </mapper>

View File

@ -34,26 +34,26 @@
FROM np_fresh_milk_insp FROM np_fresh_milk_insp
</sql> </sql>
<!-- 查询列表(已修改为只按来源和日期查询) -->
<select id="selectNpFreshMilkInspList" parameterType="NpFreshMilkInsp" resultMap="NpFreshMilkInspResult"> <select id="selectNpFreshMilkInspList" parameterType="NpFreshMilkInsp" resultMap="NpFreshMilkInspResult">
<include refid="selectNpFreshMilkInspVo"/> <include refid="selectNpFreshMilkInspVo"/>
<where> <where>
<if test="source != null and source != ''"> <if test="source != null and source != ''">
AND source LIKE CONCAT('%', #{source}, '%') AND source LIKE CONCAT('%', #{source}, '%')
</if> </if>
<if test="datetime != null"> <if test="params.beginTime != null and params.beginTime != ''">
AND datetime = #{datetime} AND datetime &gt;= #{params.beginTime}
</if>
<if test="params.endTime != null and params.endTime != ''">
AND datetime &lt;= #{params.endTime}
</if> </if>
</where> </where>
</select> </select>
<!-- 根据ID查询 -->
<select id="selectNpFreshMilkInspById" parameterType="Long" resultMap="NpFreshMilkInspResult"> <select id="selectNpFreshMilkInspById" parameterType="Long" resultMap="NpFreshMilkInspResult">
<include refid="selectNpFreshMilkInspVo"/> <include refid="selectNpFreshMilkInspVo"/>
WHERE id = #{id} WHERE id = #{id}
</select> </select>
<!-- 新增 -->
<insert id="insertNpFreshMilkInsp" parameterType="NpFreshMilkInsp" useGeneratedKeys="true" keyProperty="id"> <insert id="insertNpFreshMilkInsp" parameterType="NpFreshMilkInsp" useGeneratedKeys="true" keyProperty="id">
INSERT INTO np_fresh_milk_insp INSERT INTO np_fresh_milk_insp
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
@ -96,7 +96,6 @@
</trim> </trim>
</insert> </insert>
<!-- 修改 -->
<update id="updateNpFreshMilkInsp" parameterType="NpFreshMilkInsp"> <update id="updateNpFreshMilkInsp" parameterType="NpFreshMilkInsp">
UPDATE np_fresh_milk_insp UPDATE np_fresh_milk_insp
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
@ -119,12 +118,10 @@
WHERE id = #{id} WHERE id = #{id}
</update> </update>
<!-- 单个删除 -->
<delete id="deleteNpFreshMilkInspById" parameterType="Long"> <delete id="deleteNpFreshMilkInspById" parameterType="Long">
DELETE FROM np_fresh_milk_insp WHERE id = #{id} DELETE FROM np_fresh_milk_insp WHERE id = #{id}
</delete> </delete>
<!-- 批量删除 -->
<delete id="deleteNpFreshMilkInspByIds" parameterType="String"> <delete id="deleteNpFreshMilkInspByIds" parameterType="String">
DELETE FROM np_fresh_milk_insp WHERE id IN DELETE FROM np_fresh_milk_insp WHERE id IN
<foreach item="id" collection="array" open="(" separator="," close=")"> <foreach item="id" collection="array" open="(" separator="," close=")">

View File

@ -40,7 +40,12 @@
<select id="selectNpRawMilkInspeList" parameterType="NpRawMilkInspe" resultMap="NpRawMilkInspeResult"> <select id="selectNpRawMilkInspeList" parameterType="NpRawMilkInspe" resultMap="NpRawMilkInspeResult">
<include refid="selectNpRawMilkInspeVo"/> <include refid="selectNpRawMilkInspeVo"/>
<where> <where>
<if test="datetime != null "> and datetime = #{datetime}</if> <if test="params.beginTime != null and params.beginTime != ''">
and datetime &gt;= #{params.beginTime}
</if>
<if test="params.endTime != null and params.endTime != ''">
and datetime &lt;= #{params.endTime}
</if>
<if test="source != null and source != ''"> and source like concat('%', #{source}, '%')</if> <if test="source != null and source != ''"> and source like concat('%', #{source}, '%')</if>
</where> </where>
</select> </select>

View File

@ -39,8 +39,11 @@
<if test="source != null and source != ''"> <if test="source != null and source != ''">
and source like concat('%', #{source}, '%') and source like concat('%', #{source}, '%')
</if> </if>
<if test="datetime != null "> <if test="params.beginTime != null and params.beginTime != ''">
and datetime = #{datetime} and datetime &gt;= #{params.beginTime}
</if>
<if test="params.endTime != null and params.endTime != ''">
and datetime &lt;= #{params.endTime}
</if> </if>
</where> </where>
</select> </select>
@ -70,7 +73,7 @@
<if test="comment != null">comment,</if> <if test="comment != null">comment,</if>
<if test="createBy != null">create_by,</if> <if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if> <if test="createTime != null">create_time,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="source != null">#{source},</if> <if test="source != null">#{source},</if>
<if test="datetime != null">#{datetime},</if> <if test="datetime != null">#{datetime},</if>
@ -89,7 +92,7 @@
<if test="comment != null">#{comment},</if> <if test="comment != null">#{comment},</if>
<if test="createBy != null">#{createBy},</if> <if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if> <if test="createTime != null">#{createTime},</if>
</trim> </trim>
</insert> </insert>
<update id="updateNpYogurtInsp" parameterType="NpYogurtInsp"> <update id="updateNpYogurtInsp" parameterType="NpYogurtInsp">

View File

@ -13,26 +13,28 @@
<result property="coefficient" column="coefficient"/> <result property="coefficient" column="coefficient"/>
</resultMap> </resultMap>
<!-- 修改SQL片段系数保留两位小数 -->
<sql id="selectXzDryMatterCorrectionVo"> <sql id="selectXzDryMatterCorrectionVo">
SELECT SELECT
id, id,
datetime, datetime,
factory, factory,
content, content,
COALESCE(standard, 18) as standard, <!-- 设置默认值为18 --> COALESCE(standard, 18) as standard,
CASE CASE
WHEN standard = 0 OR standard IS NULL THEN NULL WHEN standard = 0 OR standard IS NULL THEN NULL
ELSE ROUND(content / standard, 2) <!-- 系数保留两位小数 --> ELSE ROUND(content / standard, 2)
END AS coefficient END AS coefficient
FROM xz_dry_matter_correction FROM xz_dry_matter_correction
</sql> </sql>
<select id="selectXzDryMatterCorrectionList" parameterType="XzDryMatterCorrection" resultMap="XzDryMatterCorrectionResult"> <select id="selectXzDryMatterCorrectionList" parameterType="XzDryMatterCorrection" resultMap="XzDryMatterCorrectionResult">
<include refid="selectXzDryMatterCorrectionVo"/> <include refid="selectXzDryMatterCorrectionVo"/>
<where> <where>
<if test="datetime != null"> <if test="params.beginTime != null and params.beginTime != ''">
AND DATE_FORMAT(datetime, '%Y-%m') = DATE_FORMAT(#{datetime}, '%Y-%m') AND DATE_FORMAT(datetime, '%Y-%m') &gt;= #{params.beginTime}
</if>
<if test="params.endTime != null and params.endTime != ''">
AND DATE_FORMAT(datetime, '%Y-%m') &lt;= #{params.endTime}
</if> </if>
<if test="factory != null and factory != ''"> <if test="factory != null and factory != ''">
AND factory = #{factory} AND factory = #{factory}

View File

@ -30,7 +30,12 @@
<select id="selectXzWegihCorrectionList" parameterType="XzWegihCorrection" resultMap="XzWegihCorrectionResult"> <select id="selectXzWegihCorrectionList" parameterType="XzWegihCorrection" resultMap="XzWegihCorrectionResult">
<include refid="selectXzWegihCorrectionVo"/> <include refid="selectXzWegihCorrectionVo"/>
<where> <where>
<if test="datetime != null "> and datetime = #{datetime}</if> <if test="params.beginTime != null and params.beginTime != ''">
and datetime &gt;= #{params.beginTime}
</if>
<if test="params.endTime != null and params.endTime != ''">
and datetime &lt;= #{params.endTime}
</if>
<if test="factory != null and factory != ''"> and factory = #{factory}</if> <if test="factory != null and factory != ''"> and factory = #{factory}</if>
</where> </where>
</select> </select>

View File

@ -0,0 +1,186 @@
<?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.frozen.mapper.DdFeMapper">
<resultMap type="com.zhyc.module.frozen.domain.DdFe" id="DdFeResult">
<result property="id" column="id"/>
<result property="code" column="code"/>
<result property="freezeDate" column="freeze_date"/>
<result property="drId" column="dr_id"/>
<result property="drBreed" column="dr_breed"/>
<result property="deId" column="de_id"/>
<result property="deBreed" column="de_breed"/>
<result property="embBreed" column="emb_breed"/>
<result property="grade" column="grade"/>
<result property="qty" column="qty"/>
<result property="sexCtl" column="sex_ctl"/>
<result property="status" column="status"/>
<result property="tech" column="tech"/>
<result property="tankId" column="tank_id"/>
<result property="bucketId" column="bucket_id"/>
<result property="rackId" column="rack_id"/>
<result property="outDate" column="out_date"/>
<result property="discardTxt" column="discard_txt"/>
<result property="remark" column="remark"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
</resultMap>
<sql id="selectDdFeVo">
select id,
code,
freeze_date,
dr_id,
dr_breed,
de_id,
de_breed,
emb_breed,
grade,
qty,
sex_ctl,
status,
tech,
tank_id,
bucket_id,
rack_id,
out_date,
discard_txt,
remark,
create_by,
create_time
from dd_fe
</sql>
<select id="selectDdFeList" parameterType="DdFe" resultMap="DdFeResult">
<include refid="selectDdFeVo"/>
<where>
<if test="code != null and code != ''">and code like concat('%', #{code}, '%')</if>
<if test="grade != null and grade != ''">and grade = #{grade}</if>
<if test="status != null and status != ''">and status = #{status}</if>
<if test="tech != null and tech != ''">and tech = #{tech}</if>
<if test="outDate != null "> and out_date = #{outDate}</if>
<if test="params.beginFreezeDate != null and params.endFreezeDate != null">
and freeze_date between #{params.beginFreezeDate} and #{params.endFreezeDate}
</if>
<if test="params.beginOutDate != null and params.endOutDate != null">
and out_date between #{params.beginOutDate} and #{params.endOutDate}
</if>
</where>
</select>
<select id="selectDdFeById" parameterType="Long" resultMap="DdFeResult">
<include refid="selectDdFeVo"/>
where id = #{id}
</select>
<insert id="insertDdFe" parameterType="DdFe" useGeneratedKeys="true" keyProperty="id">
insert into dd_fe
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="code != null">code,</if>
<if test="freezeDate != null">freeze_date,</if>
<if test="drId != null">dr_id,</if>
<if test="drBreed != null">dr_breed,</if>
<if test="deId != null">de_id,</if>
<if test="deBreed != null">de_breed,</if>
<if test="embBreed != null">emb_breed,</if>
<if test="grade != null">grade,</if>
<if test="qty != null">qty,</if>
<if test="sexCtl != null">sex_ctl,</if>
<if test="status != null">status,</if>
<if test="tech != null">tech,</if>
<if test="tankId != null">tank_id,</if>
<if test="bucketId != null">bucket_id,</if>
<if test="rackId != null">rack_id,</if>
<if test="outDate != null">out_date,</if>
<if test="discardTxt != null">discard_txt,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="code != null">#{code},</if>
<if test="freezeDate != null">#{freezeDate},</if>
<if test="drId != null">#{drId},</if>
<if test="drBreed != null">#{drBreed},</if>
<if test="deId != null">#{deId},</if>
<if test="deBreed != null">#{deBreed},</if>
<if test="embBreed != null">#{embBreed},</if>
<if test="grade != null">#{grade},</if>
<if test="qty != null">#{qty},</if>
<if test="sexCtl != null">#{sexCtl},</if>
<if test="status != null">#{status},</if>
<if test="tech != null">#{tech},</if>
<if test="tankId != null">#{tankId},</if>
<if test="bucketId != null">#{bucketId},</if>
<if test="rackId != null">#{rackId},</if>
<if test="outDate != null">#{outDate},</if>
<if test="discardTxt != null">#{discardTxt},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateDdFe" parameterType="DdFe">
update dd_fe
<trim prefix="SET" suffixOverrides=",">
<if test="code != null">code = #{code},</if>
<if test="freezeDate != null">freeze_date = #{freezeDate},</if>
<if test="drId != null">dr_id = #{drId},</if>
<if test="drBreed != null">dr_breed = #{drBreed},</if>
<if test="deId != null">de_id = #{deId},</if>
<if test="deBreed != null">de_breed = #{deBreed},</if>
<if test="embBreed != null">emb_breed = #{embBreed},</if>
<if test="grade != null">grade = #{grade},</if>
<if test="qty != null">qty = #{qty},</if>
<if test="sexCtl != null">sex_ctl = #{sexCtl},</if>
<if test="status != null">status = #{status},</if>
<if test="tech != null">tech = #{tech},</if>
<if test="tankId != null">tank_id = #{tankId},</if>
<if test="bucketId != null">bucket_id = #{bucketId},</if>
<if test="rackId != null">rack_id = #{rackId},</if>
<if test="outDate != null">out_date = #{outDate},</if>
<if test="discardTxt != null">discard_txt = #{discardTxt},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteDdFeById" parameterType="Long">
delete
from dd_fe
where id = #{id}
</delete>
<delete id="deleteDdFeByIds" parameterType="String">
delete from dd_fe where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectFlushByEwe" resultType="map">
SELECT grade_a gradeA,
grade_b gradeB,
grade_c gradeC,
grade_d gradeD,
cell_2_4 cell24,
cell_8 cell8,
donor_male_no ramId
FROM sc_embryo_flush
WHERE donor_female_no = #{eweNo}
ORDER BY flush_time DESC
LIMIT 1
</select>
<update id="updateDiscard" parameterType="DdFe">
UPDATE dd_fe
SET status = #{status},
discard_txt = #{discardTxt}
WHERE id = #{id}
</update>
</mapper>

View File

@ -0,0 +1,127 @@
<?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.frozen.mapper.DdFsMapper">
<resultMap type="com.zhyc.module.frozen.domain.DdFs" id="DdFsResult">
<result property="id" column="id" />
<result property="code" column="code" />
<result property="freezeDt" column="freeze_dt" />
<result property="breed" column="breed" />
<result property="batch" column="batch" />
<result property="spec" column="spec" />
<result property="qty" column="qty" />
<result property="sexCtl" column="sex_ctl" />
<result property="stat" column="stat" />
<result property="tech" column="tech" />
<result property="tankId" column="tank_id" />
<result property="bucketId" column="bucket_id" />
<result property="rackId" column="rack_id" />
<result property="outDt" column="out_dt" />
<result property="discardTxt" column="discard_txt" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectDdFsVo">
select id, code, freeze_dt, breed, batch, spec, qty, sex_ctl, stat, tech, tank_id, bucket_id, rack_id, out_dt, discard_txt, remark, create_by, create_time from dd_fs
</sql>
<select id="selectDdFsList" parameterType="DdFs" resultMap="DdFsResult">
<include refid="selectDdFsVo"/>
<where>
<if test="code != null and code != ''"> and code like concat('%', #{code}, '%')</if>
<if test="tech != null and tech != ''"> and tech like concat('%', #{tech}, '%')</if>
<if test="params.beginFreezeDt != null and params.endFreezeDt != null">
and freeze_dt between #{params.beginFreezeDt} and #{params.endFreezeDt}
</if>
<if test="params.beginOutDt != null and params.endOutDt != null">
and out_dt between #{params.beginOutDt} and #{params.endOutDt}
</if>
</where>
</select>
<select id="selectDdFsById" parameterType="Long" resultMap="DdFsResult">
<include refid="selectDdFsVo"/>
where id = #{id}
</select>
<insert id="insertDdFs" parameterType="DdFs" useGeneratedKeys="true" keyProperty="id">
insert into dd_fs
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="code != null">code,</if>
<if test="freezeDt != null">freeze_dt,</if>
<if test="breed != null">breed,</if>
<if test="batch != null">batch,</if>
<if test="spec != null">spec,</if>
<if test="qty != null">qty,</if>
<if test="sexCtl != null">sex_ctl,</if>
<if test="stat != null">stat,</if>
<if test="tech != null">tech,</if>
<if test="tankId != null">tank_id,</if>
<if test="bucketId != null">bucket_id,</if>
<if test="rackId != null">rack_id,</if>
<if test="outDt != null">out_dt,</if>
<if test="discardTxt != null">discard_txt,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="code != null">#{code},</if>
<if test="freezeDt != null">#{freezeDt},</if>
<if test="breed != null">#{breed},</if>
<if test="batch != null">#{batch},</if>
<if test="spec != null">#{spec},</if>
<if test="qty != null">#{qty},</if>
<if test="sexCtl != null">#{sexCtl},</if>
<if test="stat != null">#{stat},</if>
<if test="tech != null">#{tech},</if>
<if test="tankId != null">#{tankId},</if>
<if test="bucketId != null">#{bucketId},</if>
<if test="rackId != null">#{rackId},</if>
<if test="outDt != null">#{outDt},</if>
<if test="discardTxt != null">#{discardTxt},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateDdFs" parameterType="DdFs">
update dd_fs
<trim prefix="SET" suffixOverrides=",">
<if test="code != null">code = #{code},</if>
<if test="freezeDt != null">freeze_dt = #{freezeDt},</if>
<if test="breed != null">breed = #{breed},</if>
<if test="batch != null">batch = #{batch},</if>
<if test="spec != null">spec = #{spec},</if>
<if test="qty != null">qty = #{qty},</if>
<if test="sexCtl != null">sex_ctl = #{sexCtl},</if>
<if test="stat != null">stat = #{stat},</if>
<if test="tech != null">tech = #{tech},</if>
<if test="tankId != null">tank_id = #{tankId},</if>
<if test="bucketId != null">bucket_id = #{bucketId},</if>
<if test="rackId != null">rack_id = #{rackId},</if>
<if test="outDt != null">out_dt = #{outDt},</if>
<if test="discardTxt != null">discard_txt = #{discardTxt},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteDdFsById" parameterType="Long">
delete from dd_fs where id = #{id}
</delete>
<delete id="deleteDdFsByIds" parameterType="String">
delete from dd_fs where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,150 @@
<?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.frozen.mapper.DdSaleMapper">
<resultMap type="DdSale" id="DdSaleResult">
<result property="id" column="id" />
<result property="saleDate" column="sale_date" />
<result property="custName" column="cust_name" />
<result property="custPhone" column="cust_phone" />
<result property="custAddr" column="cust_addr" />
<result property="salesper" column="salesper" />
<result property="quaranNo" column="quaran_no" />
<result property="apprNo" column="appr_no" />
<result property="price" column="price" />
<result property="tech" column="tech" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
</resultMap>
<resultMap id="DdSaleDdSaleItemResult" type="DdSale" extends="DdSaleResult">
<collection property="ddSaleItemList" ofType="DdSaleItem" column="id" select="selectDdSaleItemList" />
</resultMap>
<resultMap type="DdSaleItem" id="DdSaleItemResult">
<result property="id" column="id" />
<result property="saleId" column="sale_id" />
<result property="itemType" column="item_type" />
<result property="itemCode" column="item_code" />
<result property="qty" column="qty" />
<result property="unitPrice" column="unit_price" />
<result property="tankId" column="tank_id" />
<result property="bucketId" column="bucket_id" />
<result property="rackId" column="rack_id" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectDdSaleVo">
select id, sale_date, cust_name, cust_phone, cust_addr, salesper, quaran_no, appr_no, price, tech, remark, create_by, create_time from dd_sl
</sql>
<select id="selectDdSaleList" parameterType="DdSale" resultMap="DdSaleResult">
<include refid="selectDdSaleVo"/>
<where>
<if test="saleDate != null "> and sale_date = #{saleDate}</if>
<if test="custName != null and custName != ''"> and cust_name like concat('%', #{custName}, '%')</if>
<if test="custPhone != null and custPhone != ''"> and cust_phone = #{custPhone}</if>
<if test="custAddr != null and custAddr != ''"> and cust_addr = #{custAddr}</if>
<if test="salesper != null and salesper != ''"> and salesper = #{salesper}</if>
<if test="quaranNo != null and quaranNo != ''"> and quaran_no = #{quaranNo}</if>
<if test="apprNo != null and apprNo != ''"> and appr_no = #{apprNo}</if>
<if test="price != null "> and price = #{price}</if>
<if test="tech != null and tech != ''"> and tech = #{tech}</if>
</where>
</select>
<select id="selectDdSaleById" parameterType="Long" resultMap="DdSaleDdSaleItemResult">
select id, sale_date, cust_name, cust_phone, cust_addr, salesper, quaran_no, appr_no, price, tech, remark, create_by, create_time
from dd_sl
where id = #{id}
</select>
<select id="selectDdSaleItemList" resultMap="DdSaleItemResult">
select id, sale_id, item_type, item_code, qty, unit_price, tank_id, bucket_id, rack_id, create_time
from dd_sl_item
where sale_id = #{sale_id}
</select>
<insert id="insertDdSale" parameterType="DdSale" useGeneratedKeys="true" keyProperty="id">
insert into dd_sl
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="saleDate != null">sale_date,</if>
<if test="custName != null and custName != ''">cust_name,</if>
<if test="custPhone != null">cust_phone,</if>
<if test="custAddr != null">cust_addr,</if>
<if test="salesper != null">salesper,</if>
<if test="quaranNo != null">quaran_no,</if>
<if test="apprNo != null">appr_no,</if>
<if test="price != null">price,</if>
<if test="tech != null and tech != ''">tech,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="saleDate != null">#{saleDate},</if>
<if test="custName != null and custName != ''">#{custName},</if>
<if test="custPhone != null">#{custPhone},</if>
<if test="custAddr != null">#{custAddr},</if>
<if test="salesper != null">#{salesper},</if>
<if test="quaranNo != null">#{quaranNo},</if>
<if test="apprNo != null">#{apprNo},</if>
<if test="price != null">#{price},</if>
<if test="tech != null and tech != ''">#{tech},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateDdSale" parameterType="DdSale">
update dd_sl
<trim prefix="SET" suffixOverrides=",">
<if test="saleDate != null">sale_date = #{saleDate},</if>
<if test="custName != null and custName != ''">cust_name = #{custName},</if>
<if test="custPhone != null">cust_phone = #{custPhone},</if>
<if test="custAddr != null">cust_addr = #{custAddr},</if>
<if test="salesper != null">salesper = #{salesper},</if>
<if test="quaranNo != null">quaran_no = #{quaranNo},</if>
<if test="apprNo != null">appr_no = #{apprNo},</if>
<if test="price != null">price = #{price},</if>
<if test="tech != null and tech != ''">tech = #{tech},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteDdSaleById" parameterType="Long">
delete from dd_sl where id = #{id}
</delete>
<delete id="deleteDdSaleByIds" parameterType="String">
delete from dd_sl where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<delete id="deleteDdSaleItemBySaleIds" parameterType="String">
delete from dd_sl_item where sale_id in
<foreach item="saleId" collection="array" open="(" separator="," close=")">
#{saleId}
</foreach>
</delete>
<delete id="deleteDdSaleItemBySaleId" parameterType="Long">
delete from dd_sl_item where sale_id = #{saleId}
</delete>
<insert id="batchDdSaleItem">
insert into dd_sl_item( id, sale_id, item_type, item_code, qty, unit_price, tank_id, bucket_id, rack_id, create_time) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.id}, #{item.saleId}, #{item.itemType}, #{item.itemCode}, #{item.qty}, #{item.unitPrice}, #{item.tankId}, #{item.bucketId}, #{item.rackId}, #{item.createTime})
</foreach>
</insert>
</mapper>

View File

@ -102,30 +102,7 @@
and sm.create_time between #{params.beginCreateTime} and #{params.endCreateTime} and sm.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
</if> </if>
</where> </where>
<if test="orderBy != null and orderBy != '' and sortDirection != null and sortDirection != ''"> <if test="true">ORDER BY sm.create_time DESC</if>
ORDER BY
<choose>
<when test="orderBy == 'weaningWeight'">bs.weaning_weight</when>
<when test="orderBy == 'bodyLength'">sm.body_length</when>
<when test="orderBy == 'birthWeight'">bs.birth_weight</when>
<when test="orderBy == 'currentWeight'">bs.current_weight</when>
<when test="orderBy == 'lactationDay'">bs.lactation_day</when>
<when test="orderBy == 'gestationDay'">bs.gestation_day</when>
<when test="orderBy == 'postMatingDay'">post_mating_day</when>
<when test="orderBy == 'parity'">bs.parity</when>
<when test="orderBy == 'height'">sm.height</when>
<when test="orderBy == 'bust'">sm.bust</when>
<when test="orderBy == 'pipeLength'">sm.pipe_length</when>
<when test="orderBy == 'chestDepth'">sm.chest_depth</when>
<when test="orderBy == 'hipHeight'">sm.hip_height</when>
<when test="orderBy == 'rumpWidth'">sm.rump_width</when>
<when test="orderBy == 'rumpHeignt'">sm.rump_heignt</when>
<when test="orderBy == 'hipWidth'">sm.hip_width</when>
<when test="orderBy == 'hipCrossHeight'">sm.hip_cross_height</when>
<otherwise>${orderBy}</otherwise>
</choose>
${sortDirection}
</if>
</select> </select>
<select id="selectScBodyMeasureById" parameterType="Long" resultMap="ScBodyMeasureResult"> <select id="selectScBodyMeasureById" parameterType="Long" resultMap="ScBodyMeasureResult">

View File

@ -58,12 +58,7 @@
and bs.manage_tags like concat('%', #{manageTags}, '%') and bs.manage_tags like concat('%', #{manageTags}, '%')
</if> </if>
</where> </where>
<if test="orderBy != null and orderBy != '' and sortDirection != null and sortDirection != ''"> <if test="true">ORDER BY sbs.create_time DESC</if>
ORDER BY sbs.${orderBy} ${sortDirection}
</if>
<if test="(orderBy == null or orderBy == '') or (sortDirection == null or sortDirection == '')">
ORDER BY sbs.create_time DESC
</if>
</select> </select>
<select id="selectScBodyScoreById" parameterType="Long" resultMap="ScBodyScoreResult"> <select id="selectScBodyScoreById" parameterType="Long" resultMap="ScBodyScoreResult">

View File

@ -56,13 +56,7 @@
and sbr.create_time between #{params.beginCreateTime} and #{params.endCreateTime} and sbr.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
</if> </if>
</where> </where>
<if test="orderBy != null and orderBy != '' and sortDirection != null and sortDirection != ''"> <if test="true">ORDER BY sbr.create_time DESC</if>
ORDER BY sbr.${orderBy} ${sortDirection}
</if>
<if test="(orderBy == null or orderBy == '') or (sortDirection == null or sortDirection == '')">
ORDER BY sbr.create_time DESC
</if>
</select> </select>
<select id="selectScBreastRatingById" parameterType="Long" resultMap="ScBreastRatingResult"> <select id="selectScBreastRatingById" parameterType="Long" resultMap="ScBreastRatingResult">

View File

@ -53,7 +53,7 @@
br.breed_type, br.breed_type,
br.create_by, br.create_by,
br.create_time, br.create_time,
-- 母羊信息(从视图获取) -- 母羊信息(从视图获取)
ewe_view.bs_manage_tags as ewe_manage_tags, ewe_view.bs_manage_tags as ewe_manage_tags,
ewe_view.variety as ewe_variety, ewe_view.variety as ewe_variety,
ewe_view.parity as ewe_parity, ewe_view.parity as ewe_parity,
@ -65,16 +65,18 @@
ewe_view.dr_ranch as ranch_name, ewe_view.dr_ranch as ranch_name,
ewe_view.name as sheep_type, ewe_view.name as sheep_type,
ewe_view.mating_total as mating_count, ewe_view.mating_total as mating_count,
-- 公羊信息(从视图获取) -- 公羊信息(从视图获取)
ram_view.bs_manage_tags as ram_manage_tags, ram_view.bs_manage_tags as ram_manage_tags,
ram_view.variety as ram_variety, ram_view.variety as ram_variety,
-- 配种方式显示 -- 配种方式显示(修改:增加3-冲胚、4-自然发情人工授精)
CASE br.breed_type CASE br.breed_type
WHEN 1 THEN '同期发情' WHEN 1 THEN '同期发情'
WHEN 2 THEN '本交' WHEN 2 THEN '本交'
WHEN 3 THEN '冲胚'
WHEN 4 THEN '自然发情人工授精'
ELSE '未知' ELSE '未知'
END as mating_type, END as mating_type,
-- 发情后配种时间(小时数) -- 发情后配种时间(小时数)
TIMESTAMPDIFF(HOUR, br.create_time, NOW()) as time_since_planning, TIMESTAMPDIFF(HOUR, br.create_time, NOW()) as time_since_planning,
-- 孕检相关信息 -- 孕检相关信息
pr.datetime as pregnancy_check_date, pr.datetime as pregnancy_check_date,
@ -225,6 +227,8 @@
CASE bp.breed_type CASE bp.breed_type
WHEN 1 THEN '同期发情' WHEN 1 THEN '同期发情'
WHEN 2 THEN '本交' WHEN 2 THEN '本交'
WHEN 3 THEN '冲胚'
WHEN 4 THEN '自然发情人工授精'
ELSE '未知' ELSE '未知'
END as breed_type_name, END as breed_type_name,
TIMESTAMPDIFF(HOUR, NOW(), NOW()) as hours_since_plan TIMESTAMPDIFF(HOUR, NOW(), NOW()) as hours_since_plan
@ -236,7 +240,7 @@
limit 1 limit 1
</select> </select>
<!-- 根据母羊耳号获取最新的配种计划信息(从配种计划生成表) --> <!-- 根据母羊耳号获取最新的配种计划信息(从配种计划生成表) -->
<select id="getLatestBreedPlanByEweTags" parameterType="String" resultType="map"> <select id="getLatestBreedPlanByEweTags" parameterType="String" resultType="map">
select select
bpg.id as plan_generate_id, bpg.id as plan_generate_id,
@ -248,6 +252,8 @@
CASE bpt.breed_type CASE bpt.breed_type
WHEN 1 THEN '同期发情' WHEN 1 THEN '同期发情'
WHEN 2 THEN '本交' WHEN 2 THEN '本交'
WHEN 3 THEN '冲胚'
WHEN 4 THEN '自然发情人工授精'
ELSE '未知' ELSE '未知'
END as breed_type_name, END as breed_type_name,
bpg.create_time as plan_create_time bpg.create_time as plan_create_time

View File

@ -0,0 +1,229 @@
<?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.produce.breed.mapper.ScEmbryoFlushMapper">
<resultMap type="ScEmbryoFlush" id="ScEmbryoFlushResult">
<result property="id" column="id" />
<result property="flushTime" column="flush_time" />
<result property="donorFemaleNo" column="donor_female_no" />
<result property="donorFemaleVariety" column="donor_female_variety" />
<result property="donorMaleNo" column="donor_male_no" />
<result property="donorMaleVariety" column="donor_male_variety" />
<result property="embryoVariety" column="embryo_variety" />
<result property="embryoAge" column="embryo_age" />
<result property="gradeAPlus" column="grade_a_plus" />
<result property="gradeA" column="grade_a" />
<result property="gradeB" column="grade_b" />
<result property="gradeC" column="grade_c" />
<result property="gradeD" column="grade_d" />
<result property="cell24" column="cell_2_4" />
<result property="cell8" column="cell_8" />
<result property="cell16" column="cell_16" />
<result property="unfertilized" column="unfertilized" />
<result property="degenerated" column="degenerated" />
<result property="totalEmbryo" column="total_embryo" />
<result property="validEmbryo" column="valid_embryo" />
<result property="transferred" column="transferred" />
<result property="recipientCnt" column="recipient_cnt" />
<result property="embryoType" column="embryo_type" />
<result property="embryoSource" column="embryo_source" />
<result property="destination" column="destination" />
<result property="storageMethod" column="storage_method" />
<result property="flushOperator" column="flush_operator" />
<result property="collectOperator" column="collect_operator" />
<result property="ranchId" column="ranch_id" />
<result property="ranchName" column="ranch_name" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectScEmbryoFlushVo">
select id, flush_time, donor_female_no, donor_female_variety, donor_male_no, donor_male_variety,
embryo_variety, embryo_age, grade_a_plus, grade_a, grade_b, grade_c, grade_d,
cell_2_4, cell_8, cell_16, unfertilized, degenerated, total_embryo, valid_embryo,
transferred, recipient_cnt, embryo_type, embryo_source, destination, storage_method,
flush_operator, collect_operator, ranch_id, ranch_name, remark
from sc_embryo_flush
</sql>
<select id="selectScEmbryoFlushList" parameterType="ScEmbryoFlush" resultMap="ScEmbryoFlushResult">
<include refid="selectScEmbryoFlushVo"/>
<where>
<if test="params.beginFlushTime != null and params.beginFlushTime != '' and params.endFlushTime != null and params.endFlushTime != ''">
and flush_time between #{params.beginFlushTime} and #{params.endFlushTime}
</if>
<if test="donorFemaleNo != null and donorFemaleNo != ''"> and donor_female_no like concat('%', #{donorFemaleNo}, '%')</if>
<if test="donorMaleNo != null and donorMaleNo != ''"> and donor_male_no like concat('%', #{donorMaleNo}, '%')</if>
<if test="embryoVariety != null and embryoVariety != ''"> and embryo_variety = #{embryoVariety}</if>
<if test="embryoType != null and embryoType != ''"> and embryo_type = #{embryoType}</if>
<if test="embryoSource != null and embryoSource != ''"> and embryo_source = #{embryoSource}</if>
<if test="flushOperator != null and flushOperator != ''"> and flush_operator like concat('%', #{flushOperator}, '%')</if>
<if test="collectOperator != null and collectOperator != ''"> and collect_operator like concat('%', #{collectOperator}, '%')</if>
<if test="ranchId != null"> and ranch_id = #{ranchId}</if>
</where>
order by flush_time desc
</select>
<select id="selectScEmbryoFlushById" parameterType="Long" resultMap="ScEmbryoFlushResult">
<include refid="selectScEmbryoFlushVo"/>
where id = #{id}
</select>
<insert id="insertScEmbryoFlush" parameterType="ScEmbryoFlush" useGeneratedKeys="true" keyProperty="id">
insert into sc_embryo_flush
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="flushTime != null">flush_time,</if>
<if test="donorFemaleNo != null and donorFemaleNo != ''">donor_female_no,</if>
<if test="donorFemaleVariety != null and donorFemaleVariety != ''">donor_female_variety,</if>
<if test="donorMaleNo != null and donorMaleNo != ''">donor_male_no,</if>
<if test="donorMaleVariety != null and donorMaleVariety != ''">donor_male_variety,</if>
<if test="embryoVariety != null and embryoVariety != ''">embryo_variety,</if>
<if test="embryoAge != null">embryo_age,</if>
<if test="gradeAPlus != null">grade_a_plus,</if>
<if test="gradeA != null">grade_a,</if>
<if test="gradeB != null">grade_b,</if>
<if test="gradeC != null">grade_c,</if>
<if test="gradeD != null">grade_d,</if>
<if test="cell24 != null">cell_2_4,</if>
<if test="cell8 != null">cell_8,</if>
<if test="cell16 != null">cell_16,</if>
<if test="unfertilized != null">unfertilized,</if>
<if test="degenerated != null">degenerated,</if>
<if test="totalEmbryo != null">total_embryo,</if>
<if test="validEmbryo != null">valid_embryo,</if>
<if test="transferred != null">transferred,</if>
<if test="recipientCnt != null">recipient_cnt,</if>
<if test="embryoType != null and embryoType != ''">embryo_type,</if>
<if test="embryoSource != null and embryoSource != ''">embryo_source,</if>
<if test="destination != null and destination != ''">destination,</if>
<if test="storageMethod != null and storageMethod != ''">storage_method,</if>
<if test="flushOperator != null and flushOperator != ''">flush_operator,</if>
<if test="collectOperator != null and collectOperator != ''">collect_operator,</if>
<if test="ranchId != null">ranch_id,</if>
<if test="ranchName != null and ranchName != ''">ranch_name,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="flushTime != null">#{flushTime},</if>
<if test="donorFemaleNo != null and donorFemaleNo != ''">#{donorFemaleNo},</if>
<if test="donorFemaleVariety != null and donorFemaleVariety != ''">#{donorFemaleVariety},</if>
<if test="donorMaleNo != null and donorMaleNo != ''">#{donorMaleNo},</if>
<if test="donorMaleVariety != null and donorMaleVariety != ''">#{donorMaleVariety},</if>
<if test="embryoVariety != null and embryoVariety != ''">#{embryoVariety},</if>
<if test="embryoAge != null">#{embryoAge},</if>
<if test="gradeAPlus != null">#{gradeAPlus},</if>
<if test="gradeA != null">#{gradeA},</if>
<if test="gradeB != null">#{gradeB},</if>
<if test="gradeC != null">#{gradeC},</if>
<if test="gradeD != null">#{gradeD},</if>
<if test="cell24 != null">#{cell24},</if>
<if test="cell8 != null">#{cell8},</if>
<if test="cell16 != null">#{cell16},</if>
<if test="unfertilized != null">#{unfertilized},</if>
<if test="degenerated != null">#{degenerated},</if>
<if test="totalEmbryo != null">#{totalEmbryo},</if>
<if test="validEmbryo != null">#{validEmbryo},</if>
<if test="transferred != null">#{transferred},</if>
<if test="recipientCnt != null">#{recipientCnt},</if>
<if test="embryoType != null and embryoType != ''">#{embryoType},</if>
<if test="embryoSource != null and embryoSource != ''">#{embryoSource},</if>
<if test="destination != null and destination != ''">#{destination},</if>
<if test="storageMethod != null and storageMethod != ''">#{storageMethod},</if>
<if test="flushOperator != null and flushOperator != ''">#{flushOperator},</if>
<if test="collectOperator != null and collectOperator != ''">#{collectOperator},</if>
<if test="ranchId != null">#{ranchId},</if>
<if test="ranchName != null and ranchName != ''">#{ranchName},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateScEmbryoFlush" parameterType="ScEmbryoFlush">
update sc_embryo_flush
<trim prefix="SET" suffixOverrides=",">
<if test="flushTime != null">flush_time = #{flushTime},</if>
<if test="donorFemaleNo != null and donorFemaleNo != ''">donor_female_no = #{donorFemaleNo},</if>
<if test="donorFemaleVariety != null and donorFemaleVariety != ''">donor_female_variety = #{donorFemaleVariety},</if>
<if test="donorMaleNo != null and donorMaleNo != ''">donor_male_no = #{donorMaleNo},</if>
<if test="donorMaleVariety != null and donorMaleVariety != ''">donor_male_variety = #{donorMaleVariety},</if>
<if test="embryoVariety != null and embryoVariety != ''">embryo_variety = #{embryoVariety},</if>
<if test="embryoAge != null">embryo_age = #{embryoAge},</if>
<if test="gradeAPlus != null">grade_a_plus = #{gradeAPlus},</if>
<if test="gradeA != null">grade_a = #{gradeA},</if>
<if test="gradeB != null">grade_b = #{gradeB},</if>
<if test="gradeC != null">grade_c = #{gradeC},</if>
<if test="gradeD != null">grade_d = #{gradeD},</if>
<if test="cell24 != null">cell_2_4 = #{cell24},</if>
<if test="cell8 != null">cell_8 = #{cell8},</if>
<if test="cell16 != null">cell_16 = #{cell16},</if>
<if test="unfertilized != null">unfertilized = #{unfertilized},</if>
<if test="degenerated != null">degenerated = #{degenerated},</if>
<if test="totalEmbryo != null">total_embryo = #{totalEmbryo},</if>
<if test="validEmbryo != null">valid_embryo = #{validEmbryo},</if>
<if test="transferred != null">transferred = #{transferred},</if>
<if test="recipientCnt != null">recipient_cnt = #{recipientCnt},</if>
<if test="embryoType != null and embryoType != ''">embryo_type = #{embryoType},</if>
<if test="embryoSource != null and embryoSource != ''">embryo_source = #{embryoSource},</if>
<if test="destination != null and destination != ''">destination = #{destination},</if>
<if test="storageMethod != null and storageMethod != ''">storage_method = #{storageMethod},</if>
<if test="flushOperator != null and flushOperator != ''">flush_operator = #{flushOperator},</if>
<if test="collectOperator != null and collectOperator != ''">collect_operator = #{collectOperator},</if>
<if test="ranchId != null">ranch_id = #{ranchId},</if>
<if test="ranchName != null and ranchName != ''">ranch_name = #{ranchName},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteScEmbryoFlushById" parameterType="Long">
delete from sc_embryo_flush where id = #{id}
</delete>
<delete id="deleteScEmbryoFlushByIds" parameterType="String">
delete from sc_embryo_flush where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<!-- 根据耳号查询羊只信息(从sheep_file视图) -->
<select id="selectSheepInfoByManageTag" parameterType="String" resultType="java.util.Map">
SELECT
bs_manage_tags AS manageTag,
variety_id AS varietyId,
variety,
ranch_id AS ranchId,
dr_ranch AS ranchName
FROM sheep_file
WHERE bs_manage_tags = #{manageTag}
LIMIT 1
</select>
<!-- 根据母羊耳号查询最近一条配种记录,获取公羊耳号和配种日期 -->
<!-- ewe_id存的是数字ID需要先根据耳号找到母羊ID再查配种记录再根据公羊ID找到公羊耳号 -->
<select id="selectBreedRecordByEwe" resultType="java.util.Map">
SELECT
ram_sf.bs_manage_tags AS ramId,
br.create_time AS matingDate
FROM sc_breed_record br
INNER JOIN sheep_file ewe_sf ON ewe_sf.id = br.ewe_id
INNER JOIN sheep_file ram_sf ON ram_sf.id = br.ram_id
WHERE ewe_sf.bs_manage_tags = #{eweManageTag}
ORDER BY br.create_time DESC
LIMIT 1
</select>
<!-- 查询所有母羊列表(用于下拉选择) -->
<select id="selectDonorFemaleList" resultType="java.util.Map">
SELECT DISTINCT
sf.bs_manage_tags AS manageTag,
sf.variety,
sf.variety_id AS varietyId,
sf.ranch_id AS ranchId,
sf.dr_ranch AS ranchName
FROM sheep_file sf
WHERE sf.gender = 1
AND (sf.is_delete = 0 OR sf.is_delete IS NULL)
ORDER BY sf.bs_manage_tags
</select>
</mapper>

View File

@ -36,30 +36,36 @@
<result property="createdBy" column="created_by" /> <result property="createdBy" column="created_by" />
<result property="createdAt" column="created_at" /> <result property="createdAt" column="created_at" />
<result property="remark" column="remark" /> <result property="remark" column="remark" />
<result property="customerName" column="customer_name" />
<result property="salesPersonName" column="sales_person_name" />
<result property="customerPhone" column="customer_phone" />
<result property="customerAddress" column="customer_address" />
</resultMap> </resultMap>
<sql id="selectSxSheepSaleVo"> <sql id="selectSxSheepSaleVo">
select id, bs_manage_tags, sheepfold_id, variety, sheep_name, gender, month_age, parity, breed, post_lambing_day, lactation_day, lambing_day, event_type, sale_date, pricing_method, unit_price, total_price, total_weight, avg_weight, avg_price_per_sheep, sale_type, disease_type, secondary_reason, group_code, customer_id, sales_person_id, quarantine_no, approval_no, technician_id, handler_id, created_by, created_at, remark from sx_sheep_sale SELECT
s.id, s.bs_manage_tags, s.sheepfold_id, s.variety, s.sheep_name, s.gender, s.month_age, s.parity, s.breed,
s.post_lambing_day, s.lactation_day, s.lambing_day, s.event_type, s.sale_date, s.pricing_method,
s.unit_price, s.total_price, s.total_weight, s.avg_weight, s.avg_price_per_sheep, s.sale_type,
s.disease_type, s.secondary_reason, s.group_code, s.customer_id, s.sales_person_id,
s.quarantine_no, s.approval_no, s.technician_id, s.handler_id, s.created_by, s.created_at, s.remark,
c.name AS customer_name,
c.phone AS customer_phone,
CONCAT(IFNULL(c.province,''), IFNULL(c.city,''), IFNULL(c.district,''), IFNULL(c.address,'')) AS customer_address,
u.nick_name AS sales_person_name
FROM sx_sheep_sale s
LEFT JOIN sx_customer c ON s.customer_id = c.id
LEFT JOIN sys_user u ON s.sales_person_id = u.user_id
</sql> </sql>
<!-- 【新增】根据耳号查询羊只信息的SQL片段 -->
<sql id="selectSheepFileVo"> <sql id="selectSheepFileVo">
select select
bs_manage_tags, bs_manage_tags, variety, name as sheep_name, gender, month_age, parity, breed,
variety, post_lambing_day, lactation_day, lambing_day, sheepfold_id
name as sheep_name,
gender,
month_age,
parity,
breed,
post_lambing_day,
lactation_day,
lambing_day,
sheepfold_id
from sheep_file from sheep_file
</sql> </sql>
<!-- 【新增】根据耳号查询羊只信息 -->
<select id="selectSheepInfoByTag" parameterType="String" resultMap="SxSheepSaleResult"> <select id="selectSheepInfoByTag" parameterType="String" resultMap="SxSheepSaleResult">
<include refid="selectSheepFileVo"/> <include refid="selectSheepFileVo"/>
where bs_manage_tags = #{bsManageTags} where bs_manage_tags = #{bsManageTags}
@ -68,18 +74,26 @@
<select id="selectSxSheepSaleList" parameterType="SxSheepSale" resultMap="SxSheepSaleResult"> <select id="selectSxSheepSaleList" parameterType="SxSheepSale" resultMap="SxSheepSaleResult">
<include refid="selectSxSheepSaleVo"/> <include refid="selectSxSheepSaleVo"/>
<where> <where>
<if test="bsManageTags != null and bsManageTags != ''"> and bs_manage_tags = #{bsManageTags}</if> <if test="customerName != null and customerName != ''">
<if test="sheepfoldId != null "> and sheepfold_id = #{sheepfoldId}</if> AND c.name LIKE CONCAT('%', #{customerName}, '%')
<if test="variety != null and variety != ''"> and variety = #{variety}</if> </if>
<if test="sheepName != null and sheepName != ''"> and sheep_name = #{sheepName}</if>
<if test="saleDate != null"> and sale_date = #{saleDate}</if> <if test="salesPersonName != null and salesPersonName != ''">
<if test="saleType != null and saleType != ''"> and sale_type = #{saleType}</if> AND u.nick_name LIKE CONCAT('%', #{salesPersonName}, '%')
</if>
<if test="params.beginSaleDate != null and params.beginSaleDate != ''">
AND date_format(s.sale_date,'%y%m%d') &gt;= date_format(#{params.beginSaleDate},'%y%m%d')
</if>
<if test="params.endSaleDate != null and params.endSaleDate != ''">
AND date_format(s.sale_date,'%y%m%d') &lt;= date_format(#{params.endSaleDate},'%y%m%d')
</if>
</where> </where>
</select> </select>
<select id="selectSxSheepSaleById" parameterType="Long" resultMap="SxSheepSaleResult"> <select id="selectSxSheepSaleById" parameterType="Long" resultMap="SxSheepSaleResult">
<include refid="selectSxSheepSaleVo"/> <include refid="selectSxSheepSaleVo"/>
where id = #{id} where s.id = #{id}
</select> </select>
<insert id="insertSxSheepSale" parameterType="SxSheepSale" useGeneratedKeys="true" keyProperty="id"> <insert id="insertSxSheepSale" parameterType="SxSheepSale" useGeneratedKeys="true" keyProperty="id">