冻精冻胚的非空校验,模糊查询,唯一性校验
This commit is contained in:
parent
68cc26d239
commit
a49a4a0359
@ -6,6 +6,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.zhyc.common.utils.SecurityUtils;
|
||||
import com.zhyc.common.utils.StringUtils;
|
||||
import com.zhyc.module.frozen.mapper.DdFeMapper;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -26,18 +27,18 @@ import com.zhyc.common.core.page.TableDataInfo;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/frozen/embryo")
|
||||
public class DdFeController extends BaseController
|
||||
{
|
||||
public class DdFeController extends BaseController {
|
||||
@Autowired
|
||||
private IDdFeService ddFeService;
|
||||
@Autowired
|
||||
private DdFeMapper ddFeMapper;
|
||||
|
||||
/**
|
||||
* 查询冻胚库存列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('frozen:embryo:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(DdFe ddFe)
|
||||
{
|
||||
public TableDataInfo list(DdFe ddFe) {
|
||||
startPage();
|
||||
List<DdFe> list = ddFeService.selectDdFeList(ddFe);
|
||||
return getDataTable(list);
|
||||
@ -49,8 +50,7 @@ public class DdFeController extends BaseController
|
||||
@PreAuthorize("@ss.hasPermi('frozen:embryo:export')")
|
||||
@Log(title = "冻胚库存", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, DdFe ddFe)
|
||||
{
|
||||
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, "冻胚库存数据");
|
||||
@ -61,8 +61,7 @@ public class DdFeController extends BaseController
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('frozen:embryo:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return success(ddFeService.selectDdFeById(id));
|
||||
}
|
||||
|
||||
@ -72,8 +71,7 @@ public class DdFeController extends BaseController
|
||||
@PreAuthorize("@ss.hasPermi('frozen:embryo:add')")
|
||||
@Log(title = "冻胚库存", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody DdFe ddFe)
|
||||
{
|
||||
public AjaxResult add(@RequestBody DdFe ddFe) {
|
||||
ddFe.setCreateBy(SecurityUtils.getUsername());
|
||||
return toAjax(ddFeService.insertDdFe(ddFe));
|
||||
}
|
||||
@ -84,8 +82,7 @@ public class DdFeController extends BaseController
|
||||
@PreAuthorize("@ss.hasPermi('frozen:embryo:edit')")
|
||||
@Log(title = "冻胚库存", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody DdFe ddFe)
|
||||
{
|
||||
public AjaxResult edit(@RequestBody DdFe ddFe) {
|
||||
return toAjax(ddFeService.updateDdFe(ddFe));
|
||||
}
|
||||
|
||||
@ -94,9 +91,8 @@ public class DdFeController extends BaseController
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('frozen:embryo:remove')")
|
||||
@Log(title = "冻胚库存", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(ddFeService.deleteDdFeByIds(ids));
|
||||
}
|
||||
|
||||
@ -126,13 +122,26 @@ public class DdFeController extends BaseController
|
||||
|
||||
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;
|
||||
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);
|
||||
}
|
||||
@ -153,4 +162,10 @@ public class DdFeController extends BaseController
|
||||
});
|
||||
return success();
|
||||
}
|
||||
|
||||
// 唯一性校验
|
||||
@GetMapping("/checkCode")
|
||||
public AjaxResult exist(@RequestParam String code) {
|
||||
return success(ddFeMapper.existsByCode(code) > 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -72,4 +72,6 @@ public interface DdFeMapper
|
||||
* 废弃更新(只改状态、出库日期、废弃原因、更新人)
|
||||
*/
|
||||
int updateDiscard(DdFe dto);
|
||||
// 唯一性校验
|
||||
int existsByCode(@Param("code") String code);
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.zhyc.common.exception.ServiceException;
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
import com.zhyc.common.utils.StringUtils;
|
||||
import com.zhyc.module.produce.breed.domain.ScEmbryoFlush;
|
||||
@ -65,6 +66,9 @@ public class DdFeServiceImpl implements IDdFeService
|
||||
@Override
|
||||
public int insertDdFe(DdFe ddFe)
|
||||
{
|
||||
if (ddFeMapper.existsByCode(ddFe.getCode()) > 0) {
|
||||
throw new ServiceException("胚胎编号已存在,请勿重复录入");
|
||||
}
|
||||
ddFe.setCreateTime(DateUtils.getNowDate());
|
||||
return ddFeMapper.insertDdFe(ddFe);
|
||||
}
|
||||
|
||||
@ -59,8 +59,10 @@
|
||||
<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="tech != null and tech != ''">
|
||||
AND tech LIKE CONCAT('%', #{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>
|
||||
@ -164,23 +166,26 @@
|
||||
</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
|
||||
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
|
||||
ORDER BY flush_time DESC LIMIT 1
|
||||
</select>
|
||||
|
||||
<update id="updateDiscard" parameterType="DdFe">
|
||||
UPDATE dd_fe
|
||||
SET status = #{status},
|
||||
SET status = #{status},
|
||||
discard_txt = #{discardTxt}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<select id="existsByCode" resultType="int">
|
||||
SELECT COUNT(*) FROM dd_fe WHERE code = #{code}
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
x
Reference in New Issue
Block a user