基础信息班次

highway
A0010407 1 year ago
parent 2492c033a4
commit ec89c8db95

@ -72,7 +72,13 @@ public class BaseShiftsTController extends BaseController {
@Log(title = "班次管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BaseShiftsT baseShiftsT) {
return toAjax(baseShiftsTService.insertBaseShiftsT(baseShiftsT));
if (baseShiftsTService.checkCodeUnique(baseShiftsT)) {
return AjaxResult.error("班次编码已存在!");
}else if(baseShiftsTService.checkNameUnique(baseShiftsT)){
return AjaxResult.error("班次名称已存在!");
}else{
return toAjax(baseShiftsTService.insertBaseShiftsT(baseShiftsT));
}
}
/**

@ -63,4 +63,7 @@ public interface BaseShiftsTMapper {
List<Date> queryAllStartTime(BaseShiftsT baseShiftsT);
List<Date> queryAllEndTime(BaseShiftsT baseShiftsT);
String checkCodeUnique(BaseShiftsT baseShiftsT);
String checkNameUnique(BaseShiftsT baseShiftsT);
}

@ -57,4 +57,7 @@ public interface IBaseShiftsTService {
* @return
*/
public int deleteBaseShiftsTByShiftId(String shiftId);
boolean checkCodeUnique(BaseShiftsT baseShiftsT);
boolean checkNameUnique(BaseShiftsT baseShiftsT);
}

@ -142,4 +142,36 @@ public class BaseShiftsTServiceImpl implements IBaseShiftsTService {
public int deleteBaseShiftsTByShiftId(String shiftId) {
return baseShiftsTMapper.deleteBaseShiftsTByShiftId(shiftId);
}
/**
*
*
* @return
*/
@Override
@DS("#header.poolName")
public boolean checkCodeUnique(BaseShiftsT baseShiftsT) {
String code = baseShiftsTMapper.checkCodeUnique(baseShiftsT);
if(code == null){
return false;
}else{
return true;
}
}
/**
*
*
* @return
*/
@Override
@DS("#header.poolName")
public boolean checkNameUnique(BaseShiftsT baseShiftsT) {
String name = baseShiftsTMapper.checkNameUnique(baseShiftsT);
if(name == null){
return false;
}else{
return true;
}
}
}

@ -30,8 +30,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectBaseShiftsTList" parameterType="BaseShiftsT" resultMap="BaseShiftsTResult">
<include refid="selectBaseShiftsTVo"/>
<where>
<if test="shiftCode != null and shiftCode != ''"> and Shift_Code = #{shiftCode}</if>
<if test="shiftDesc != null and shiftDesc != ''"> and Shift_Desc = #{shiftDesc}</if>
<if test="shiftCode != null and shiftCode != ''"> and Shift_Code like concat('%', #{shiftCode}, '%')</if>
<if test="shiftDesc != null and shiftDesc != ''"> and Shift_Desc like concat('%', #{shiftDesc}, '%')</if>
<if test="shiftDescGlobal != null and shiftDescGlobal != ''"> and Shift_Desc_Global = #{shiftDescGlobal}</if>
<if test="shiftDescExtended != null and shiftDescExtended != ''"> and Shift_Desc_Extended = #{shiftDescExtended}</if>
<if test="shiftStartTime != null and shiftStartTime != ''"> and Shift_Start_Time = #{shiftStartTime}</if>
@ -126,8 +126,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</delete>
<select id="queryAllStartTime" parameterType="String" resultMap="BaseShiftsTResult">
select
<!-- <select id="queryAllStartTime" parameterType="String" resultMap="BaseShiftsTResult">-->
<!-- select-->
<!-- </select>-->
<select id="checkNameUnique" parameterType="BaseShiftsT" resultType ="java.lang.String">
select shift_desc
from base_shifts_t
where shift_desc = #{shiftDesc}
</select>
<select id="checkCodeUnique" parameterType="BaseShiftsT" resultType ="java.lang.String">
select shift_code
from base_shifts_t
where shift_code = #{shiftCode}
</select>
</mapper>
Loading…
Cancel
Save