Compare commits
No commits in common. "b2b764840e8f77874e6861c3901d69822c9bc40b" and "3d929972d9841230b63614016155da1e41f3ddd5" have entirely different histories.
b2b764840e
...
3d929972d9
|
|
@ -36,7 +36,7 @@ public class KitchenStaffInfoController extends BaseController {
|
||||||
@ApiOperation(value = "查询厨房员工资料列表")
|
@ApiOperation(value = "查询厨房员工资料列表")
|
||||||
//@RequiresPermissions("kitchen:info:list")
|
//@RequiresPermissions("kitchen:info:list")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
public TableDataInfo list(@RequestBody KitchenStaffInfo kitchenStaffInfo) {
|
public TableDataInfo list(@RequestBody @Valid KitchenStaffInfo kitchenStaffInfo) {
|
||||||
startPage();
|
startPage();
|
||||||
List<KitchenStaffInfo> list = kitchenStaffInfoService.selectKitchenStaffInfoList(kitchenStaffInfo);
|
List<KitchenStaffInfo> list = kitchenStaffInfoService.selectKitchenStaffInfoList(kitchenStaffInfo);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,4 @@ public interface KitchenStaffDevicePrivilegeMapper {
|
||||||
public int deleteKitchenStaffDevicePrivilegeByIds(Long[] ids);
|
public int deleteKitchenStaffDevicePrivilegeByIds(Long[] ids);
|
||||||
|
|
||||||
public int deleteKitchenStaffDevicePrivilegeByStaffId(Long staffId);
|
public int deleteKitchenStaffDevicePrivilegeByStaffId(Long staffId);
|
||||||
|
|
||||||
public int deleteKitchenStaffDevicePrivilegeByStaffIds(Long[] staffIds);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,11 +56,12 @@ public class KitchenStaffDevicePrivilegeServiceImpl implements IKitchenStaffDevi
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public int insertKitchenStaffDevicePrivilege(List<KitchenStaffDevicePrivilege> kitchenStaffDevicePrivilege) {
|
public int insertKitchenStaffDevicePrivilege(List<KitchenStaffDevicePrivilege> kitchenStaffDevicePrivilege) {
|
||||||
if(CollUtil.isNotEmpty(kitchenStaffDevicePrivilege)) {
|
if(CollUtil.isNotEmpty(kitchenStaffDevicePrivilege)) {
|
||||||
|
kitchenStaffDevicePrivilegeMapper.deleteKitchenStaffDevicePrivilegeByStaffId(kitchenStaffDevicePrivilege.get(0).getStaffId());
|
||||||
for (KitchenStaffDevicePrivilege privilege : kitchenStaffDevicePrivilege) {
|
for (KitchenStaffDevicePrivilege privilege : kitchenStaffDevicePrivilege) {
|
||||||
privilege.setCreateTime(DateUtils.getNowDate());
|
privilege.setCreateTime(DateUtils.getNowDate());
|
||||||
privilege.setCreateBy(SecurityUtils.getUsername());
|
privilege.setCreateBy(SecurityUtils.getUsername());
|
||||||
try {
|
try {
|
||||||
kitchenStaffDevicePrivilegeMapper.insertKitchenStaffDevicePrivilege(privilege);
|
return kitchenStaffDevicePrivilegeMapper.insertKitchenStaffDevicePrivilege(privilege);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new ServiceException(e.getMessage());
|
throw new ServiceException(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
package com.bonus.canteen.core.kitchen.service.impl;
|
package com.bonus.canteen.core.kitchen.service.impl;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import com.bonus.canteen.core.kitchen.domain.AccessAuthority;
|
import com.bonus.canteen.core.kitchen.domain.AccessAuthority;
|
||||||
|
|
@ -58,7 +61,6 @@ public class KitchenStaffInfoServiceImpl implements IKitchenStaffInfoService {
|
||||||
List<KitchenStaffDevicePrivilege> kitchenStaffDevicePrivilegeList = kitchenStaffDevicePrivilegeMapper
|
List<KitchenStaffDevicePrivilege> kitchenStaffDevicePrivilegeList = kitchenStaffDevicePrivilegeMapper
|
||||||
.selectKitchenStaffDevicePrivilegeByStaffId(staffId);
|
.selectKitchenStaffDevicePrivilegeByStaffId(staffId);
|
||||||
if(CollUtil.isNotEmpty(kitchenStaffDevicePrivilegeList)) {
|
if(CollUtil.isNotEmpty(kitchenStaffDevicePrivilegeList)) {
|
||||||
List<AccessAuthority> accessAuthorityList = Lists.newArrayList();
|
|
||||||
AccessAuthority accessAuthority = new AccessAuthority();
|
AccessAuthority accessAuthority = new AccessAuthority();
|
||||||
for (KitchenStaffDevicePrivilege kitchenStaffDevicePrivilege : kitchenStaffDevicePrivilegeList) {
|
for (KitchenStaffDevicePrivilege kitchenStaffDevicePrivilege : kitchenStaffDevicePrivilegeList) {
|
||||||
KitchenDeviceListVO deviceInfo = kitchenDeviceInfoMapper.selectKitchenDeviceInfoByDeviceId(kitchenStaffDevicePrivilege.getDeviceId());
|
KitchenDeviceListVO deviceInfo = kitchenDeviceInfoMapper.selectKitchenDeviceInfoByDeviceId(kitchenStaffDevicePrivilege.getDeviceId());
|
||||||
|
|
@ -69,9 +71,7 @@ public class KitchenStaffInfoServiceImpl implements IKitchenStaffInfoService {
|
||||||
accessAuthority.setDeviceId(kitchenStaffDevicePrivilege.getDeviceId());
|
accessAuthority.setDeviceId(kitchenStaffDevicePrivilege.getDeviceId());
|
||||||
accessAuthority.setDeviceType(kitchenStaffDevicePrivilege.getDeviceType());
|
accessAuthority.setDeviceType(kitchenStaffDevicePrivilege.getDeviceType());
|
||||||
accessAuthority.setPrivilegeValue(kitchenStaffDevicePrivilege.getPrivilegeValue());
|
accessAuthority.setPrivilegeValue(kitchenStaffDevicePrivilege.getPrivilegeValue());
|
||||||
accessAuthorityList.add(accessAuthority);
|
|
||||||
}
|
}
|
||||||
kitchenStaffInfo.setAccessAuthorityList(accessAuthorityList);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return kitchenStaffInfo;
|
return kitchenStaffInfo;
|
||||||
|
|
@ -108,9 +108,7 @@ public class KitchenStaffInfoServiceImpl implements IKitchenStaffInfoService {
|
||||||
public int insertKitchenStaffInfo(KitchenStaffInfo kitchenStaffInfo) {
|
public int insertKitchenStaffInfo(KitchenStaffInfo kitchenStaffInfo) {
|
||||||
kitchenStaffInfo.setCreateTime(DateUtils.getNowDate());
|
kitchenStaffInfo.setCreateTime(DateUtils.getNowDate());
|
||||||
kitchenStaffInfo.setCreateBy(SecurityUtils.getUsername());
|
kitchenStaffInfo.setCreateBy(SecurityUtils.getUsername());
|
||||||
kitchenStaffInfo.setStaffId(null);
|
|
||||||
try {
|
try {
|
||||||
checkUser(kitchenStaffInfo);
|
|
||||||
int result = kitchenStaffInfoMapper.insertKitchenStaffInfo(kitchenStaffInfo);
|
int result = kitchenStaffInfoMapper.insertKitchenStaffInfo(kitchenStaffInfo);
|
||||||
addPrivileges(kitchenStaffInfo);
|
addPrivileges(kitchenStaffInfo);
|
||||||
return result;
|
return result;
|
||||||
|
|
@ -129,11 +127,7 @@ public class KitchenStaffInfoServiceImpl implements IKitchenStaffInfoService {
|
||||||
public int updateKitchenStaffInfo(KitchenStaffInfo kitchenStaffInfo) {
|
public int updateKitchenStaffInfo(KitchenStaffInfo kitchenStaffInfo) {
|
||||||
kitchenStaffInfo.setUpdateTime(DateUtils.getNowDate());
|
kitchenStaffInfo.setUpdateTime(DateUtils.getNowDate());
|
||||||
kitchenStaffInfo.setUpdateBy(SecurityUtils.getUsername());
|
kitchenStaffInfo.setUpdateBy(SecurityUtils.getUsername());
|
||||||
if(Objects.isNull(kitchenStaffInfo.getStaffId())) {
|
|
||||||
throw new ServiceException("员工编号不能为空");
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
checkUser(kitchenStaffInfo);
|
|
||||||
kitchenStaffInfoMapper.updateKitchenStaffInfo(kitchenStaffInfo);
|
kitchenStaffInfoMapper.updateKitchenStaffInfo(kitchenStaffInfo);
|
||||||
kitchenStaffDevicePrivilegeMapper.deleteKitchenStaffDevicePrivilegeByStaffId(kitchenStaffInfo.getStaffId());
|
kitchenStaffDevicePrivilegeMapper.deleteKitchenStaffDevicePrivilegeByStaffId(kitchenStaffInfo.getStaffId());
|
||||||
addPrivileges(kitchenStaffInfo);
|
addPrivileges(kitchenStaffInfo);
|
||||||
|
|
@ -143,24 +137,8 @@ public class KitchenStaffInfoServiceImpl implements IKitchenStaffInfoService {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkUser(KitchenStaffInfo kitchenStaffInfo) {
|
|
||||||
KitchenStaffInfo kitchenStaffInfoByPhone = new KitchenStaffInfo();
|
|
||||||
kitchenStaffInfoByPhone.setUserId(kitchenStaffInfo.getUserId());
|
|
||||||
List<KitchenStaffInfo> staffInfoList = kitchenStaffInfoMapper.selectKitchenStaffInfoList(kitchenStaffInfoByPhone);
|
|
||||||
if(CollUtil.isNotEmpty(staffInfoList) && !Objects.equals(staffInfoList.get(0).getStaffId(), kitchenStaffInfo.getStaffId())) {
|
|
||||||
throw new ServiceException("该用户已存在");
|
|
||||||
}
|
|
||||||
kitchenStaffInfoByPhone = new KitchenStaffInfo();
|
|
||||||
kitchenStaffInfoByPhone.setStaffNo(kitchenStaffInfo.getStaffNo());
|
|
||||||
staffInfoList = kitchenStaffInfoMapper.selectKitchenStaffInfoList(kitchenStaffInfoByPhone);
|
|
||||||
if(CollUtil.isNotEmpty(staffInfoList) && !Objects.equals(staffInfoList.get(0).getStaffId(), kitchenStaffInfo.getStaffId())) {
|
|
||||||
throw new ServiceException("该用户编号已存在");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addPrivileges(KitchenStaffInfo kitchenStaffInfo) {
|
private void addPrivileges(KitchenStaffInfo kitchenStaffInfo) {
|
||||||
if(CollUtil.isNotEmpty(kitchenStaffInfo.getAccessAuthorityList())) {
|
if(CollUtil.isNotEmpty(kitchenStaffInfo.getAccessAuthorityList())) {
|
||||||
List<KitchenStaffDevicePrivilege> kitchenStaffDevicePrivilegeList = new ArrayList<>();
|
|
||||||
for(AccessAuthority access : kitchenStaffInfo.getAccessAuthorityList()) {
|
for(AccessAuthority access : kitchenStaffInfo.getAccessAuthorityList()) {
|
||||||
KitchenStaffDevicePrivilege kitchenStaffDevicePrivilege = new KitchenStaffDevicePrivilege();
|
KitchenStaffDevicePrivilege kitchenStaffDevicePrivilege = new KitchenStaffDevicePrivilege();
|
||||||
kitchenStaffDevicePrivilege.setStaffId(kitchenStaffInfo.getStaffId());
|
kitchenStaffDevicePrivilege.setStaffId(kitchenStaffInfo.getStaffId());
|
||||||
|
|
@ -168,9 +146,8 @@ public class KitchenStaffInfoServiceImpl implements IKitchenStaffInfoService {
|
||||||
kitchenStaffDevicePrivilege.setDeviceType(access.getDeviceType());
|
kitchenStaffDevicePrivilege.setDeviceType(access.getDeviceType());
|
||||||
kitchenStaffDevicePrivilege.setPrivilegeName("is_enable");
|
kitchenStaffDevicePrivilege.setPrivilegeName("is_enable");
|
||||||
kitchenStaffDevicePrivilege.setPrivilegeValue(access.getPrivilegeValue());
|
kitchenStaffDevicePrivilege.setPrivilegeValue(access.getPrivilegeValue());
|
||||||
kitchenStaffDevicePrivilegeList.add(kitchenStaffDevicePrivilege);
|
kitchenStaffDevicePrivilegeService.insertKitchenStaffDevicePrivilege(Collections.singletonList(kitchenStaffDevicePrivilege));
|
||||||
}
|
}
|
||||||
kitchenStaffDevicePrivilegeService.insertKitchenStaffDevicePrivilege(kitchenStaffDevicePrivilegeList);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -182,7 +159,6 @@ public class KitchenStaffInfoServiceImpl implements IKitchenStaffInfoService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteKitchenStaffInfoByStaffIds(Long[] staffIds) {
|
public int deleteKitchenStaffInfoByStaffIds(Long[] staffIds) {
|
||||||
kitchenStaffDevicePrivilegeMapper.deleteKitchenStaffDevicePrivilegeByStaffIds(staffIds);
|
|
||||||
return kitchenStaffInfoMapper.deleteKitchenStaffInfoByStaffIds(staffIds);
|
return kitchenStaffInfoMapper.deleteKitchenStaffInfoByStaffIds(staffIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -194,7 +170,6 @@ public class KitchenStaffInfoServiceImpl implements IKitchenStaffInfoService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteKitchenStaffInfoByStaffId(Long staffId) {
|
public int deleteKitchenStaffInfoByStaffId(Long staffId) {
|
||||||
kitchenStaffDevicePrivilegeMapper.deleteKitchenStaffDevicePrivilegeByStaffId(staffId);
|
|
||||||
return kitchenStaffInfoMapper.deleteKitchenStaffInfoByStaffId(staffId);
|
return kitchenStaffInfoMapper.deleteKitchenStaffInfoByStaffId(staffId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -96,12 +96,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<delete id="deleteKitchenStaffDevicePrivilegeByStaffId" parameterType="Long">
|
<delete id="deleteKitchenStaffDevicePrivilegeByStaffId" parameterType="Long">
|
||||||
delete from kitchen_staff_device_privilege where staff_id = #{staffId}
|
delete from kitchen_staff_device_privilege where staff_id = #{staffId}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<delete id="deleteKitchenStaffDevicePrivilegeByStaffIds">
|
|
||||||
delete from kitchen_staff_device_privilege where staff_id in
|
|
||||||
<foreach item="staffId" collection="array" open="(" separator="," close=")">
|
|
||||||
#{staffId}
|
|
||||||
</foreach>
|
|
||||||
</delete>
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -42,7 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="nutrityCertExpire != null "> and nutrity_cert_expire = #{nutrityCertExpire}</if>
|
<if test="nutrityCertExpire != null "> and nutrity_cert_expire = #{nutrityCertExpire}</if>
|
||||||
<if test="safetyCertExpire != null "> and safety_cert_expire = #{safetyCertExpire}</if>
|
<if test="safetyCertExpire != null "> and safety_cert_expire = #{safetyCertExpire}</if>
|
||||||
<if test="sex != null "> and su.sex = #{sex}</if>
|
<if test="sex != null "> and su.sex = #{sex}</if>
|
||||||
<if test="postIds != null and postIds.length > 0">
|
<if test="postIds != null and postIds.length() > 0">
|
||||||
and sup.post_id in
|
and sup.post_id in
|
||||||
<foreach item="postId" collection="postIds" open="(" separator="," close=")">
|
<foreach item="postId" collection="postIds" open="(" separator="," close=")">
|
||||||
#{postId}
|
#{postId}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue