Compare commits
2 Commits
7bce9a0774
...
094da396c1
| Author | SHA1 | Date | |
|---|---|---|---|
| 094da396c1 | |||
| d9a621d6a7 |
@@ -68,20 +68,27 @@ public class ScTransitionInfoController extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* 新增转场
|
* 新增转场
|
||||||
*/
|
*/
|
||||||
|
// @PreAuthorize("@ss.hasPermi('produce:transition_info:add')")
|
||||||
|
// @Log(title = "转场", businessType = BusinessType.INSERT)
|
||||||
|
// @PostMapping
|
||||||
|
// public AjaxResult add(@RequestBody ScTransitionInfo scTransitionInfo) {
|
||||||
|
// scTransitionInfo.setUserId(getUserId());
|
||||||
|
// scTransitionInfo.setDeptId(getDeptId());
|
||||||
|
// return toAjax(scTransitionInfoService.insertScTransitionInfo(scTransitionInfo));
|
||||||
|
// }
|
||||||
|
|
||||||
|
//批量添加转场
|
||||||
@PreAuthorize("@ss.hasPermi('produce:transition_info:add')")
|
@PreAuthorize("@ss.hasPermi('produce:transition_info:add')")
|
||||||
@Log(title = "转场", businessType = BusinessType.INSERT)
|
@Log(title = "转场", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
|
||||||
public AjaxResult add(@RequestBody ScTransitionInfo scTransitionInfo) {
|
|
||||||
scTransitionInfo.setUserId(getUserId());
|
|
||||||
scTransitionInfo.setDeptId(getDeptId());
|
|
||||||
return toAjax(scTransitionInfoService.insertScTransitionInfo(scTransitionInfo));
|
|
||||||
}
|
|
||||||
|
|
||||||
//批量添加
|
|
||||||
@PostMapping("/batch")
|
@PostMapping("/batch")
|
||||||
public AjaxResult addBatch(@RequestBody List<ScTransitionInfo> transitionInfoList) {
|
public AjaxResult addBatch(@RequestBody List<ScTransitionInfo> transitionInfoList) {
|
||||||
Long userId = getUserId();
|
Long userId = getUserId();
|
||||||
Long deptId = getDeptId();
|
Long deptId = getDeptId();
|
||||||
|
|
||||||
|
for (ScTransitionInfo info : transitionInfoList) {
|
||||||
|
info.setUserId(userId);
|
||||||
|
info.setDeptId(deptId);
|
||||||
|
}
|
||||||
return toAjax(scTransitionInfoService.insertScTransitionInfoBatch(transitionInfoList));
|
return toAjax(scTransitionInfoService.insertScTransitionInfoBatch(transitionInfoList));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public interface ScTransitionInfoMapper
|
|||||||
* @param scTransitionInfo 转场
|
* @param scTransitionInfo 转场
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int insertScTransitionInfo(ScTransitionInfo scTransitionInfo);
|
// public int insertScTransitionInfo(ScTransitionInfo scTransitionInfo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改转场
|
* 修改转场
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public interface IScTransitionInfoService {
|
|||||||
* @param scTransitionInfo 转场
|
* @param scTransitionInfo 转场
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int insertScTransitionInfo(ScTransitionInfo scTransitionInfo);
|
// public int insertScTransitionInfo(ScTransitionInfo scTransitionInfo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改转场
|
* 修改转场
|
||||||
|
|||||||
@@ -67,26 +67,35 @@ public class ScTransitionInfoServiceImpl implements IScTransitionInfoService
|
|||||||
* @param scTransitionInfo 转场
|
* @param scTransitionInfo 转场
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
// @Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
// @Transactional(rollbackFor = Exception.class)
|
||||||
public int insertScTransitionInfo(ScTransitionInfo scTransitionInfo) {
|
// public int insertScTransitionInfo(ScTransitionInfo scTransitionInfo) {
|
||||||
// 根据耳号查询羊只信息
|
// // 根据耳号查询羊只信息
|
||||||
String manageTags = scTransitionInfo.getManageTags();
|
// String manageTags = scTransitionInfo.getManageTags();
|
||||||
if (StringUtils.isNotBlank(manageTags)) {
|
// if (StringUtils.isNotBlank(manageTags)) {
|
||||||
BasSheep sheep = basSheepService.selectBasSheepByManageTags(manageTags.trim());
|
// BasSheep sheep = basSheepService.selectBasSheepByManageTags(manageTags.trim());
|
||||||
if (sheep == null) {
|
// if (sheep == null) {
|
||||||
throw new RuntimeException("耳号不存在,请检查输入");
|
// throw new RuntimeException("耳号不存在,请检查输入");
|
||||||
}
|
// }
|
||||||
scTransitionInfo.setSheepId(sheep.getId().intValue());
|
// scTransitionInfo.setSheepId(sheep.getId().intValue());
|
||||||
scTransitionInfo.setVarietyId(sheep.getVarietyId());
|
// scTransitionInfo.setVarietyId(sheep.getVarietyId());
|
||||||
} else {
|
// if (scTransitionInfo.getSheepfoldId() == null && sheep.getSheepfoldId() != null) {
|
||||||
throw new RuntimeException("耳号不能为空");
|
// scTransitionInfo.setSheepfoldId(sheep.getSheepfoldId());
|
||||||
}
|
// }
|
||||||
|
// if (StringUtils.isBlank(scTransitionInfo.getTransFrom()) && sheep.getRanchId() != null) {
|
||||||
scTransitionInfo.setStatus(0);
|
// DaRanch ranch = daRanchService.selectDaRanchById(sheep.getRanchId());
|
||||||
scTransitionInfo.setCreateTime(DateUtils.getNowDate());
|
// if (ranch != null) {
|
||||||
return scTransitionInfoMapper.insertScTransitionInfo(scTransitionInfo);
|
// scTransitionInfo.setTransFrom(ranch.getRanch());
|
||||||
}
|
// }
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// throw new RuntimeException("耳号不能为空");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// scTransitionInfo.setStatus(0);
|
||||||
|
// scTransitionInfo.setCreateTime(DateUtils.getNowDate());
|
||||||
|
// return scTransitionInfoMapper.insertScTransitionInfo(scTransitionInfo);
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -141,6 +150,15 @@ public class ScTransitionInfoServiceImpl implements IScTransitionInfoService
|
|||||||
}
|
}
|
||||||
info.setSheepId(sheep.getId().intValue());
|
info.setSheepId(sheep.getId().intValue());
|
||||||
info.setVarietyId(sheep.getVarietyId());
|
info.setVarietyId(sheep.getVarietyId());
|
||||||
|
if (info.getSheepfoldId() == null && sheep.getSheepfoldId() != null) {
|
||||||
|
info.setSheepfoldId(sheep.getSheepfoldId());
|
||||||
|
}
|
||||||
|
if (StringUtils.isBlank(info.getTransFrom()) && sheep.getRanchId() != null) {
|
||||||
|
DaRanch ranch = daRanchService.selectDaRanchById(sheep.getRanchId());
|
||||||
|
if (ranch != null) {
|
||||||
|
info.setTransFrom(ranch.getRanch());
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new RuntimeException("耳号不能为空");
|
throw new RuntimeException("耳号不能为空");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,53 +91,54 @@
|
|||||||
WHERE t.id = #{id}
|
WHERE t.id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertScTransitionInfo" parameterType="ScTransitionInfo" useGeneratedKeys="true" keyProperty="id">
|
<!-- <insert id="insertScTransitionInfo" parameterType="ScTransitionInfo" useGeneratedKeys="true" keyProperty="id">-->
|
||||||
insert into sc_transition_info
|
<!-- insert into sc_transition_info-->
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<!-- <trim prefix="(" suffix=")" suffixOverrides=",">-->
|
||||||
<if test="sheepId != null">sheep_id,</if>
|
<!-- <if test="sheepId != null">sheep_id,</if>-->
|
||||||
<if test="varietyId != null">variety_id,</if>
|
<!-- <if test="varietyId != null">variety_id,</if>-->
|
||||||
<if test="transTo != null and transTo != ''">trans_to,</if>
|
<!-- <if test="transTo != null and transTo != ''">trans_to,</if>-->
|
||||||
<if test="transFrom != null and transFrom != ''">trans_from,</if>
|
<!-- <if test="transFrom != null and transFrom != ''">trans_from,</if>-->
|
||||||
<if test="eventType != null and eventType != ''">event_type,</if>
|
<!-- <if test="eventType != null and eventType != ''">event_type,</if>-->
|
||||||
<if test="transType != null">trans_type,</if>
|
<!-- <if test="transType != null">trans_type,</if>-->
|
||||||
<if test="transitionDate != null">transition_date,</if>
|
<!-- <if test="transitionDate != null">transition_date,</if>-->
|
||||||
<if test="technician != null and technician != ''">technician,</if>
|
<!-- <if test="technician != null and technician != ''">technician,</if>-->
|
||||||
<if test="status != null">status,</if>
|
<!-- <if test="status != null">status,</if>-->
|
||||||
<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>-->
|
||||||
<if test="userId != null">user_id,</if>
|
<!-- <if test="userId != null">user_id,</if>-->
|
||||||
<if test="deptId != null">dept_id,</if>
|
<!-- <if test="deptId != null">dept_id,</if>-->
|
||||||
</trim>
|
<!-- </trim>-->
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<!-- <trim prefix="values (" suffix=")" suffixOverrides=",">-->
|
||||||
<if test="sheepId != null">#{sheepId},</if>
|
<!-- <if test="sheepId != null">#{sheepId},</if>-->
|
||||||
<if test="varietyId != null">#{varietyId},</if>
|
<!-- <if test="varietyId != null">#{varietyId},</if>-->
|
||||||
<if test="transTo != null and transTo != ''">#{transTo},</if>
|
<!-- <if test="transTo != null and transTo != ''">#{transTo},</if>-->
|
||||||
<if test="transFrom != null and transFrom != ''">#{transFrom},</if>
|
<!-- <if test="transFrom != null and transFrom != ''">#{transFrom},</if>-->
|
||||||
<if test="eventType != null and eventType != ''">#{eventType},</if>
|
<!-- <if test="eventType != null and eventType != ''">#{eventType},</if>-->
|
||||||
<if test="transType != null">#{transType},</if>
|
<!-- <if test="transType != null">#{transType},</if>-->
|
||||||
<if test="transitionDate != null">#{transitionDate},</if>
|
<!-- <if test="transitionDate != null">#{transitionDate},</if>-->
|
||||||
<if test="technician != null and technician != ''">#{technician},</if>
|
<!-- <if test="technician != null and technician != ''">#{technician},</if>-->
|
||||||
<if test="status != null">#{status},</if>
|
<!-- <if test="status != null">#{status},</if>-->
|
||||||
<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>-->
|
||||||
<if test="userId != null">#{userId},</if>
|
<!-- <if test="userId != null">#{userId},</if>-->
|
||||||
<if test="deptId != null">#{deptId},</if>
|
<!-- <if test="deptId != null">#{deptId},</if>-->
|
||||||
</trim>
|
<!-- </trim>-->
|
||||||
</insert>
|
<!-- </insert>-->
|
||||||
|
|
||||||
<insert id="insertScTransitionInfoBatch">
|
<insert id="insertScTransitionInfoBatch">
|
||||||
INSERT INTO sc_transition_info (
|
INSERT INTO sc_transition_info (
|
||||||
sheep_id, variety_id, trans_to, trans_from,
|
sheep_id,sheepfold_id, variety_id, trans_to, trans_from,
|
||||||
event_type,trans_type, transition_date, technician, status, comment,
|
event_type,trans_type, transition_date, technician, status, comment,
|
||||||
create_by, create_time
|
create_by, create_time,user_id,dept_id
|
||||||
) VALUES
|
) VALUES
|
||||||
<foreach collection="list" item="item" separator=",">
|
<foreach collection="list" item="item" separator=",">
|
||||||
(
|
(
|
||||||
#{item.sheepId}, #{item.varietyId}, #{item.transTo}, #{item.transFrom}, #{item.eventType},
|
#{item.sheepId},#{item.sheepfoldId}, #{item.varietyId}, #{item.transTo}, #{item.transFrom}, #{item.eventType},
|
||||||
#{item.transType},#{item.transitionDate}, #{item.technician}, #{item.status}, #{item.comment},
|
#{item.transType},#{item.transitionDate}, #{item.technician}, #{item.status}, #{item.comment},
|
||||||
#{item.createBy}, now()
|
#{item.createBy}, now(), #{item.userId},
|
||||||
|
#{item.deptId}
|
||||||
)
|
)
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
|
|||||||
Reference in New Issue
Block a user