联调问题
This commit is contained in:
parent
89045e34dc
commit
44c4bc3032
|
|
@ -48,9 +48,9 @@ public class DayPlanController extends BaseController {
|
|||
//新增日计划
|
||||
@PreAuthorize("@ss.hasPermi('day:plan:add')")
|
||||
@PostMapping("/addDayPlan")
|
||||
public AjaxResult addMonthlyPlan(@RequestBody DayPlanVo dayPlanVo) {
|
||||
public AjaxResult addMonthlyPlan(@RequestBody List<DayPlanVo> dayPlanVoList) {
|
||||
try {
|
||||
int res = dayPlanService.addMonthlyPlan(dayPlanVo);
|
||||
int res = dayPlanService.addMonthlyPlan(dayPlanVoList);
|
||||
if (res > 0) {
|
||||
return AjaxResult.success();
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -51,9 +51,12 @@ public class InspectionStationController extends BaseController {
|
|||
{
|
||||
try {
|
||||
int res = inspectionStationService.addInspectionStation(inspectionStationVo);
|
||||
if (res > 0) {
|
||||
if (res == 1) {
|
||||
return AjaxResult.success();
|
||||
}else {
|
||||
} else if (res == 2) {
|
||||
return AjaxResult.error("名称已经存在");
|
||||
}
|
||||
else {
|
||||
return AjaxResult.error("新增失败");
|
||||
}
|
||||
}catch (Exception e) {
|
||||
|
|
@ -89,8 +92,10 @@ public class InspectionStationController extends BaseController {
|
|||
{
|
||||
try {
|
||||
int res = inspectionStationService.updateInspectionStation(inspectionStationVo);
|
||||
if (res > 0) {
|
||||
if (res == 1) {
|
||||
return AjaxResult.success();
|
||||
} else if (res == 2) {
|
||||
return AjaxResult.error("名称已经存在");
|
||||
}else {
|
||||
return AjaxResult.error("修改失败");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,4 +26,6 @@ public interface InspectionStationMapper {
|
|||
int updateInspectionStation(InspectionStationVo inspectionStationVo);
|
||||
|
||||
InspectionStationVo getInspectionStationDetail(InspectionStationVo inspectionStationVo);
|
||||
|
||||
InspectionStationVo getInspectionStation(InspectionStationVo inspectionStationVo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import java.util.List;
|
|||
*/
|
||||
public interface DayPlanService {
|
||||
|
||||
int addMonthlyPlan(DayPlanVo dayPlanVo);
|
||||
int addMonthlyPlan(List<DayPlanVo> dayPlanVo);
|
||||
|
||||
int delDayPlan(DayPlanVo dayPlanVo);
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import com.bonus.digital.dao.WorkloadSummaryExcelVo;
|
|||
import com.bonus.digital.mapper.DayPlanMapper;
|
||||
import com.bonus.digital.service.DayPlanService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -21,11 +22,16 @@ import java.util.List;
|
|||
public class DayPlanServiceImpl implements DayPlanService {
|
||||
@Resource
|
||||
private DayPlanMapper dayPlanMapper;
|
||||
|
||||
@Override
|
||||
public int addMonthlyPlan(DayPlanVo dayPlanVo) {
|
||||
dayPlanVo.setCreateUser(SecurityUtils.getUserId().toString());
|
||||
dayPlanVo.setCreateTime(new Date());
|
||||
return dayPlanMapper.addMonthlyPlan(dayPlanVo);
|
||||
@Transactional
|
||||
public int addMonthlyPlan(List<DayPlanVo> dayPlanVo) {
|
||||
for (DayPlanVo dayPlanVo1 : dayPlanVo) {
|
||||
dayPlanVo1.setCreateUser(SecurityUtils.getUserId().toString());
|
||||
dayPlanVo1.setCreateTime(new Date());
|
||||
dayPlanMapper.addMonthlyPlan(dayPlanVo1);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -40,6 +40,10 @@ public class InspectionStationServiceImpl implements InspectionStationService {
|
|||
Long userId = SecurityUtils.getUserId();
|
||||
inspectionStationVo.setCreateUser(userId.toString());
|
||||
inspectionStationVo.setCreateTime(new Date());
|
||||
InspectionStationVo res = inspectionStationMapper.getInspectionStation(inspectionStationVo);
|
||||
if (res != null) {
|
||||
return 2;
|
||||
}
|
||||
return inspectionStationMapper.addInspectionStation(inspectionStationVo);
|
||||
}
|
||||
|
||||
|
|
@ -59,6 +63,10 @@ public class InspectionStationServiceImpl implements InspectionStationService {
|
|||
Long userId = SecurityUtils.getUserId();
|
||||
inspectionStationVo.setUpdateUser(userId.toString());
|
||||
inspectionStationVo.setUpdateTime(new Date());
|
||||
InspectionStationVo res = inspectionStationMapper.getInspectionStation(inspectionStationVo);
|
||||
if (res != null && inspectionStationVo.getInspectionStationId()!=res.getInspectionStationId()) {
|
||||
return 2;
|
||||
}
|
||||
return inspectionStationMapper.updateInspectionStation(inspectionStationVo);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,4 +40,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
select inspection_station_id,inspection_station_name,remark,category
|
||||
from tb_inspection_station where inspection_station_name = #{inspectionStationName} and is_active = '1'
|
||||
</select>
|
||||
<select id="getInspectionStation" resultType="com.bonus.digital.dao.InspectionStationVo">
|
||||
select inspection_station_id,inspection_station_name,remark,category
|
||||
from tb_inspection_station where category = #{category} and is_active = '1' and
|
||||
inspection_station_name = #{inspectionStationName}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue