基础信息班次

highway
A0010407 1 year ago
parent 2492c033a4
commit ec89c8db95

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

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

@ -57,4 +57,7 @@ public interface IBaseShiftsTService {
* @return * @return
*/ */
public int deleteBaseShiftsTByShiftId(String shiftId); 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) { public int deleteBaseShiftsTByShiftId(String shiftId) {
return baseShiftsTMapper.deleteBaseShiftsTByShiftId(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"> <select id="selectBaseShiftsTList" parameterType="BaseShiftsT" resultMap="BaseShiftsTResult">
<include refid="selectBaseShiftsTVo"/> <include refid="selectBaseShiftsTVo"/>
<where> <where>
<if test="shiftCode != null and shiftCode != ''"> and Shift_Code = #{shiftCode}</if> <if test="shiftCode != null and shiftCode != ''"> and Shift_Code like concat('%', #{shiftCode}, '%')</if>
<if test="shiftDesc != null and shiftDesc != ''"> and Shift_Desc = #{shiftDesc}</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="shiftDescGlobal != null and shiftDescGlobal != ''"> and Shift_Desc_Global = #{shiftDescGlobal}</if>
<if test="shiftDescExtended != null and shiftDescExtended != ''"> and Shift_Desc_Extended = #{shiftDescExtended}</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> <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> </foreach>
</delete> </delete>
<select id="queryAllStartTime" parameterType="String" resultMap="BaseShiftsTResult"> <!-- <select id="queryAllStartTime" parameterType="String" resultMap="BaseShiftsTResult">-->
select <!-- 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> </select>
</mapper> </mapper>
Loading…
Cancel
Save