This commit is contained in:
caixiang 2023-03-03 14:33:26 +08:00
commit e04a4d184e
13 changed files with 258 additions and 21 deletions

View File

@ -43,6 +43,11 @@
<artifactId>ym-common</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.75</version>
</dependency>
</dependencies>

View File

@ -0,0 +1,167 @@
/*
* Copyright (c) 2018.
* http://www.ulabcare.com
*/
package com.cnbm.admin.base;
import com.alibaba.fastjson.JSON;
import com.cnbm.admin.entity.LoginUser;
import com.cnbm.admin.enums.WhetherEnum;
import lombok.Builder;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 接口支持基类
*
* @author jiff
* @date 2018/11/1
* @since 1.0
*/
@Service
public class BaseSupport {
protected LoginUser getLoginUser() {
// 后续完善拦截器再使用该方式
// LoginUser loginUser = loginUserHolder.get();
// if (loginUser != null) {
// return loginUser;
// }
HttpSession session = getHttpServletRequest().getSession(false);
LoginUser loginUser = null;
if (session != null) {
String loginUserJson = (String) session.getAttribute(LoginUser.HTTP_HEADER_NAME);
if (StringUtils.isNotBlank(loginUserJson)) {
loginUser = JSON.parseObject(loginUserJson, LoginUser.class);
return loginUser;
}
}
return null;
}
/**
* 获取当前http请求对象
*
* @return
*/
protected HttpServletRequest getHttpServletRequest() {
return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
}
/**
* 获取当前http响应对象
*
* @return
*/
protected HttpServletResponse getHttpServletResponse() {
return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getResponse();
}
/**
* 设置公共字段值一般用于创建新记录包含以下字段
*
* <p>
* {@link CommonField#enabled}<br>
* {@link CommonField#valid}<br>
* {@link CommonField#creatorId}<br>
* {@link CommonField#creatorName}<br>
* {@link CommonField#createTime}<br>
* {@link CommonField#updaterId}<br>
* {@link CommonField#updaterName}<br>
* {@link CommonField#updateTime}<br>
* </p>
*
* @param t 需要设置的对象
* @param ignoreProperties 忽略的字段
* @param <T>
*/
public <T extends Serializable> T setCommonField(T t, String... ignoreProperties) {
CommonField commonField = CommonField.builder()
.enabled(WhetherEnum.YES.getValue())
.valid(WhetherEnum.YES.getValue())
.createTime(LocalDateTime.now())
.creatorId(getLoginUser().getSysUserEntity().getId())
.creatorName(getLoginUser().getUsername())
.updateTime(LocalDateTime.now())
.updaterId(getLoginUser().getSysUserEntity().getId())
.updaterName(getLoginUser().getUsername())
.build();
BeanUtils.copyProperties(commonField, t, ignoreProperties);
return t;
}
/**
* 设置更新的公共字段值一般用于更新记录包含以下字段
*
* <p>
* {@link CommonField#updaterId}<br>
* {@link CommonField#updaterName}<br>
* {@link CommonField#updateTime}<br>
* </p>
*
* @param t 需要设置的对象
* @param <T>
*/
public <T extends Serializable> T setUpdateCommonField(T t) {
CommonField commonField = CommonField.builder()
.updaterId(getLoginUser().getSysUserEntity().getId())
.updaterName(getLoginUser().getUsername())
.updateTime(LocalDateTime.now())
.build();
BeanUtils.copyProperties(commonField, t, "enabled", "valid");
return t;
}
@Data
@Builder
private static class CommonField implements Serializable {
/**
* 启用状态:0 停用1启用
*/
private Integer enabled;
/**
* 删除标志是否有效:1 可用 0不可用
*/
private Integer valid;
/**
* 创建人
*/
private Long creatorId;
/**
* 创建人
*/
private String creatorName;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 更新人
*/
private Long updaterId;
/**
* 更新人
*/
private String updaterName;
/**
* 更新时间
*/
private LocalDateTime updateTime;
}
}

View File

@ -24,6 +24,8 @@ public class LoginUser implements UserDetails{
private static final long serialVersionUID = 1L;
public static final String HTTP_HEADER_NAME = "loginUser";
private SysUserEntity sysUserEntity;
private List<String> permissions;

View File

@ -1,5 +1,6 @@
package com.cnbm.admin.service.impl;
import com.alibaba.fastjson.JSON;
import com.cnbm.admin.entity.LoginUser;
import com.cnbm.admin.entity.SysLogLoginEntity;
import com.cnbm.admin.enums.LoginOperationEnum;
@ -9,7 +10,6 @@ import com.cnbm.admin.service.CaptchaService;
import com.cnbm.admin.service.SysLogLoginService;
import com.cnbm.admin.utils.JwtUtil;
import com.cnbm.admin.service.LoginService;
import com.cnbm.admin.utils.ResponseResult;
import com.cnbm.common.exception.ErrorCode;
import com.cnbm.common.utils.IpUtils;
import com.cnbm.common.utils.Result;
@ -22,8 +22,11 @@ import org.springframework.security.authentication.UsernamePasswordAuthenticatio
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Service;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@ -81,6 +84,11 @@ public class LoginServiceImpl implements LoginService {
map.put("token",jwt);
//把完整的用户信息存入redis userid作为key
redisTemplate.opsForValue().set("login:"+userid,loginUser,1, TimeUnit.DAYS);
//当前登录用户信息存入session中
HttpSession session = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest().getSession();
session.setAttribute(loginUser.HTTP_HEADER_NAME, JSON.toJSONString(loginUser));
//登录成功
log.setStatus(LoginStatusEnum.SUCCESS.value());
log.setCreator(loginUser.getSysUserEntity().getId());

View File

@ -210,9 +210,9 @@ public class WoPackagingBoxSubstrateController {
@PostMapping("insertSubstrateManual")
@ApiOperation("手动装箱")
@LogOperation("手动装箱")
public Result insertSubstrateManual(@RequestBody ChangePackingBoxDTO dto){
public Result insertSubstrateManual(@RequestBody ChangePackingBoxDTO[] dtos){
woPackagingBoxSubstrateService.insertSubstrateManual(dto);
woPackagingBoxSubstrateService.insertSubstrateManual(dtos);
return new Result();
}

View File

@ -32,7 +32,7 @@ public interface WoPackagingBoxSubstrateServiceBiz extends CrudService<WoPackagi
void replaceSubstrate(ChangePackingBoxDTO[] dtos);
void insertSubstrateManual(ChangePackingBoxDTO dto);
void insertSubstrateManual(ChangePackingBoxDTO[] dtos);
WoPackagingBoxSubstrate getBySubId(String subId);

View File

@ -3,6 +3,9 @@ package com.cnbm.packing.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.cnbm.admin.base.BaseSupport;
import com.cnbm.admin.base.BaseSupport;
import com.cnbm.admin.utils.BaseSupportUtils;
import com.cnbm.common.page.PageData;
import com.cnbm.common.service.impl.CrudServiceImpl;
import com.cnbm.common.utils.ConvertUtils;
@ -14,6 +17,7 @@ import com.cnbm.packing.entity.WoPowerLevel;
import com.cnbm.packing.mapper.ChangePackagingBoxHistoryMapper;
import com.cnbm.packing.service.ChangePackagingBoxHistoryServiceBiz;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -30,6 +34,9 @@ import java.util.Map;
@Service
public class ChangePackagingBoxHistoryServiceBizImpl extends CrudServiceImpl<ChangePackagingBoxHistoryMapper, ChangePackagingBoxHistory, ChangePackagingBoxHistoryDTO> implements ChangePackagingBoxHistoryServiceBiz {
// @Autowired
// private BaseSupport baseSupport;
@Override
public QueryWrapper<ChangePackagingBoxHistory> getWrapper(Map<String, Object> params){
LocalDateTime startTime = (LocalDateTime) params.get("startTime");
@ -65,6 +72,7 @@ public class ChangePackagingBoxHistoryServiceBizImpl extends CrudServiceImpl<Cha
@Transactional(rollbackFor = Exception.class)
public void save(ChangePackagingBoxHistoryDTO dto) {
ChangePackagingBoxHistory entity = ConvertUtils.sourceToTarget(dto, ChangePackagingBoxHistory.class);
BaseSupportUtils.setCommonField(entity);
insert(entity);
}
@ -72,6 +80,7 @@ public class ChangePackagingBoxHistoryServiceBizImpl extends CrudServiceImpl<Cha
@Transactional(rollbackFor = Exception.class)
public void update(ChangePackagingBoxHistoryDTO dto) {
ChangePackagingBoxHistory entity = ConvertUtils.sourceToTarget(dto, ChangePackagingBoxHistory.class);
BaseSupportUtils.setUpdateCommonField(entity);
updateById(entity);
}

View File

@ -3,6 +3,8 @@ package com.cnbm.packing.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.cnbm.admin.base.BaseSupport;
import com.cnbm.admin.utils.BaseSupportUtils;
import com.cnbm.admin.utils.CodeGeneratorHelper;
import com.cnbm.common.page.PageData;
import com.cnbm.common.service.impl.CrudServiceImpl;
@ -31,6 +33,8 @@ public class PrintModelServiceBizImpl extends CrudServiceImpl<PrintModelMapper,
@Autowired
private PrintModelMapper mapper;
// @Autowired
// private BaseSupport baseSupport;
@Override
public QueryWrapper<PrintModel> getWrapper(Map<String, Object> params){
@ -69,6 +73,7 @@ public class PrintModelServiceBizImpl extends CrudServiceImpl<PrintModelMapper,
@Transactional(rollbackFor = Exception.class)
public void save(PrintModelDTO dto) {
PrintModel entity = ConvertUtils.sourceToTarget(dto, PrintModel.class);
BaseSupportUtils.setCommonField(entity);
insert(entity);
}
@ -76,6 +81,7 @@ public class PrintModelServiceBizImpl extends CrudServiceImpl<PrintModelMapper,
@Transactional(rollbackFor = Exception.class)
public void update(PrintModelDTO dto) {
PrintModel entity = ConvertUtils.sourceToTarget(dto, PrintModel.class);
BaseSupportUtils.setUpdateCommonField(entity);
updateById(entity);
}

View File

@ -3,6 +3,8 @@ package com.cnbm.packing.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.cnbm.admin.base.BaseSupport;
import com.cnbm.admin.utils.BaseSupportUtils;
import com.cnbm.common.page.PageData;
import com.cnbm.common.service.impl.CrudServiceImpl;
import com.cnbm.common.utils.ConvertUtils;
@ -34,6 +36,8 @@ public class WoCompensationPowerServiceBizImpl extends CrudServiceImpl<WoCompens
@Autowired
private WoCompensationPowerMapper mapper;
// @Autowired
// private BaseSupport baseSupport;
@Override
public QueryWrapper<WoCompensationPower> getWrapper(Map<String, Object> params){
@ -66,6 +70,7 @@ public class WoCompensationPowerServiceBizImpl extends CrudServiceImpl<WoCompens
@Transactional(rollbackFor = Exception.class)
public void save(WoCompensationPowerDTO dto) {
WoCompensationPower entity = ConvertUtils.sourceToTarget(dto, WoCompensationPower.class);
BaseSupportUtils.setCommonField(entity);
insert(entity);
}
@ -73,6 +78,7 @@ public class WoCompensationPowerServiceBizImpl extends CrudServiceImpl<WoCompens
@Transactional(rollbackFor = Exception.class)
public void update(WoCompensationPowerDTO dto) {
WoCompensationPower entity = ConvertUtils.sourceToTarget(dto, WoCompensationPower.class);
BaseSupportUtils.setUpdateCommonField(entity);
updateById(entity);
}

View File

@ -3,6 +3,8 @@ package com.cnbm.packing.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.cnbm.admin.base.BaseSupport;
import com.cnbm.admin.utils.BaseSupportUtils;
import com.cnbm.common.page.PageData;
import com.cnbm.common.service.impl.CrudServiceImpl;
import com.cnbm.common.utils.ConvertUtils;
@ -36,6 +38,9 @@ public class WoPackagingBoxServiceBizImpl extends CrudServiceImpl<WoPackagingBox
private WoPackagingBoxMapper mapper;
@Autowired
private WoPackagingBoxSubstrateMapper substrateMapper;
// @Autowired
// private BaseSupport baseSupport;
@Override
public QueryWrapper<WoPackagingBox> getWrapper(Map<String, Object> params){
@ -82,6 +87,7 @@ public class WoPackagingBoxServiceBizImpl extends CrudServiceImpl<WoPackagingBox
@Transactional(rollbackFor = Exception.class)
public IdVo add(WoPackagingBoxDTO dto) {
WoPackagingBox entity = ConvertUtils.sourceToTarget(dto, WoPackagingBox.class);
BaseSupportUtils.setCommonField(entity);
insert(entity);
return IdVo.builder().id(entity.getId()).build();
}
@ -90,6 +96,7 @@ public class WoPackagingBoxServiceBizImpl extends CrudServiceImpl<WoPackagingBox
@Transactional(rollbackFor = Exception.class)
public void update(WoPackagingBoxDTO dto) {
WoPackagingBox entity = ConvertUtils.sourceToTarget(dto, WoPackagingBox.class);
BaseSupportUtils.setUpdateCommonField(entity);
updateById(entity);
}

View File

@ -3,6 +3,8 @@ package com.cnbm.packing.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.cnbm.admin.base.BaseSupport;
import com.cnbm.admin.utils.BaseSupportUtils;
import com.cnbm.common.page.PageData;
import com.cnbm.common.service.impl.CrudServiceImpl;
import com.cnbm.common.utils.ConvertUtils;
@ -41,6 +43,8 @@ public class WoPackagingBoxSubstrateServiceBizImpl extends CrudServiceImpl<WoPac
private ChangePackagingBoxHistoryServiceBiz changePackagingBoxHistoryService;
@Autowired
private WoPackagingBoxSubstrateMapper mapper;
// @Autowired
// private BaseSupport baseSupport;
@Override
public QueryWrapper<WoPackagingBoxSubstrate> getWrapper(Map<String, Object> params){
@ -75,6 +79,7 @@ public class WoPackagingBoxSubstrateServiceBizImpl extends CrudServiceImpl<WoPac
@Transactional(rollbackFor = Exception.class)
public void save(WoPackagingBoxSubstrateDTO dto) {
WoPackagingBoxSubstrate entity = ConvertUtils.sourceToTarget(dto, WoPackagingBoxSubstrate.class);
BaseSupportUtils.setCommonField(entity);
insert(entity);
}
@ -82,6 +87,7 @@ public class WoPackagingBoxSubstrateServiceBizImpl extends CrudServiceImpl<WoPac
@Transactional(rollbackFor = Exception.class)
public void update(WoPackagingBoxSubstrateDTO dto) {
WoPackagingBoxSubstrate entity = ConvertUtils.sourceToTarget(dto, WoPackagingBoxSubstrate.class);
BaseSupportUtils.setUpdateCommonField(entity);
updateById(entity);
}
@ -103,6 +109,7 @@ public class WoPackagingBoxSubstrateServiceBizImpl extends CrudServiceImpl<WoPac
changePackagingBoxHistory.setSourceSlot(entity.getSlot());
changePackagingBoxHistory.setLeaveTime(LocalDateTime.now());
changePackagingBoxHistory.setType(2);
BaseSupportUtils.setCommonField(changePackagingBoxHistory);
changePackagingBoxHistoryService.insert(changePackagingBoxHistory);
//模组从该包装箱中移出该模组变为未绑定BoxID的模组
UpdateWrapper<WoPackagingBoxSubstrate> wrapper = new UpdateWrapper<>();
@ -126,10 +133,12 @@ public class WoPackagingBoxSubstrateServiceBizImpl extends CrudServiceImpl<WoPac
changePackagingBoxHistory.setTargetSlot(dto.getSlot());
changePackagingBoxHistory.setInputTime(LocalDateTime.now());
changePackagingBoxHistory.setType(1);
BaseSupportUtils.setCommonField(changePackagingBoxHistory);
changePackagingBoxHistoryService.insert(changePackagingBoxHistory);
//更新
entity.setPackagingBoxId(dto.getPackagingBoxId());
entity.setSlot(dto.getSlot());
BaseSupportUtils.setUpdateCommonField(entity);
updateById(entity);
}
@ -146,34 +155,38 @@ public class WoPackagingBoxSubstrateServiceBizImpl extends CrudServiceImpl<WoPac
changePackagingBoxHistory.setTargetBoxNo(dto.getPackagingBoxId());
changePackagingBoxHistory.setTargetSlot(dto.getSlot());
changePackagingBoxHistory.setType(3);
BaseSupportUtils.setCommonField(changePackagingBoxHistory);
changePackagingBoxHistoryService.insert(changePackagingBoxHistory);
//更新
entity.setPackagingBoxId(dto.getPackagingBoxId());
entity.setSlot(dto.getSlot());
BaseSupportUtils.setUpdateCommonField(entity);
updateById(entity);
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void insertSubstrateManual(ChangePackingBoxDTO dto) {
QueryWrapper<WoPackagingBoxSubstrate> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(dto.getWoSubstrateId()),WoPackagingBoxSubstrate.WO_SUBSTRATE_ID,dto.getWoSubstrateId());
if(mapper.selectCount(wrapper)>0 && StringUtils.isNotBlank(dto.getWoSubstrateId())) {
WoPackagingBoxSubstrate substrate = mapper.selectList(wrapper).get(0);
substrate.setPackagingBoxId(dto.getPackagingBoxId());
updateById(substrate);
}
else{
//模组ID有时为空用户会输入无码
if(dto.getWoSubstrateId()==null) {
dto.setWoSubstrateId("无码");
public void insertSubstrateManual(ChangePackingBoxDTO[] dtos) {
for(ChangePackingBoxDTO dto : dtos) {
QueryWrapper<WoPackagingBoxSubstrate> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(dto.getWoSubstrateId()), WoPackagingBoxSubstrate.WO_SUBSTRATE_ID, dto.getWoSubstrateId());
if (mapper.selectCount(wrapper) > 0 && StringUtils.isNotBlank(dto.getWoSubstrateId())) {
WoPackagingBoxSubstrate substrate = mapper.selectList(wrapper).get(0);
substrate.setPackagingBoxId(dto.getPackagingBoxId());
BaseSupportUtils.setUpdateCommonField(substrate);
updateById(substrate);
} else {
//模组ID有时为空用户会输入无码
if (dto.getWoSubstrateId() == null) {
dto.setWoSubstrateId("无码");
}
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
WoPackagingBoxSubstrate entity = ConvertUtils.sourceToTarget(dto, WoPackagingBoxSubstrate.class);
BaseSupportUtils.setCommonField(entity);
insert(entity);
}
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
WoPackagingBoxSubstrate entity = ConvertUtils.sourceToTarget(dto, WoPackagingBoxSubstrate.class);
insert(entity);
}
}

View File

@ -3,7 +3,9 @@ package com.cnbm.packing.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.cnbm.admin.base.BaseSupport;
import com.cnbm.admin.enums.WhetherEnum;
import com.cnbm.admin.utils.BaseSupportUtils;
import com.cnbm.common.page.PageData;
import com.cnbm.common.service.impl.CrudServiceImpl;
import com.cnbm.common.utils.ConvertUtils;
@ -42,6 +44,8 @@ public class WoPackagingPrintHistoryServiceBizImpl extends CrudServiceImpl<WoPac
@Autowired
private WoPackagingPrintHistoryMapper mapper;
// @Autowired
// private BaseSupport baseSupport;
@Autowired
private WoPackagingBoxServiceBiz woPackagingBoxServiceBiz;
@ -78,6 +82,7 @@ public class WoPackagingPrintHistoryServiceBizImpl extends CrudServiceImpl<WoPac
@Transactional(rollbackFor = Exception.class)
public void save(WoPackagingPrintHistoryDTO dto) {
WoPackagingPrintHistory entity = ConvertUtils.sourceToTarget(dto, WoPackagingPrintHistory.class);
BaseSupportUtils.setCommonField(entity);
insert(entity);
}
@ -85,6 +90,7 @@ public class WoPackagingPrintHistoryServiceBizImpl extends CrudServiceImpl<WoPac
@Transactional(rollbackFor = Exception.class)
public void update(WoPackagingPrintHistoryDTO dto) {
WoPackagingPrintHistory entity = ConvertUtils.sourceToTarget(dto, WoPackagingPrintHistory.class);
BaseSupportUtils.setUpdateCommonField(entity);
updateById(entity);
}
@ -112,6 +118,7 @@ public class WoPackagingPrintHistoryServiceBizImpl extends CrudServiceImpl<WoPac
BeanUtils.copyProperties(woPackagingBox, woPackagingPrintHistory);
woPackagingPrintHistory.setId(null);
woPackagingPrintHistory.setPrintTime(LocalDateTime.now());
BaseSupportUtils.setCommonField(woPackagingPrintHistory);
insert(woPackagingPrintHistory);
//更新包装箱表中打印状态和时间
woPackagingBox.setPrintTime(woPackagingPrintHistory.getPrintTime());
@ -122,6 +129,7 @@ public class WoPackagingPrintHistoryServiceBizImpl extends CrudServiceImpl<WoPac
else{
woPackagingBox.setPrintCount(woPackagingBox.getPrintCount()+1);
}
BaseSupportUtils.setUpdateCommonField(woPackagingBox);
woPackagingBoxServiceBiz.update(woPackagingBox);
}

View File

@ -3,6 +3,8 @@ package com.cnbm.packing.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.cnbm.admin.base.BaseSupport;
import com.cnbm.admin.utils.BaseSupportUtils;
import com.cnbm.common.page.PageData;
import com.cnbm.common.service.impl.CrudServiceImpl;
import com.cnbm.common.utils.ConvertUtils;
@ -31,6 +33,8 @@ public class WoPowerLevelServiceBizImpl extends CrudServiceImpl<WoPowerLevelMapp
@Autowired
private WoPowerLevelMapper mapper;
// @Autowired
// private BaseSupport baseSupport;
@Override
public QueryWrapper<WoPowerLevel> getWrapper(Map<String, Object> params){
@ -64,6 +68,7 @@ public class WoPowerLevelServiceBizImpl extends CrudServiceImpl<WoPowerLevelMapp
@Transactional(rollbackFor = Exception.class)
public void save(WoPowerLevelDTO dto) {
WoPowerLevel entity = ConvertUtils.sourceToTarget(dto, WoPowerLevel.class);
BaseSupportUtils.setCommonField(entity);
insert(entity);
}
@ -71,6 +76,7 @@ public class WoPowerLevelServiceBizImpl extends CrudServiceImpl<WoPowerLevelMapp
@Transactional(rollbackFor = Exception.class)
public void update(WoPowerLevelDTO dto) {
WoPowerLevel entity = ConvertUtils.sourceToTarget(dto, WoPowerLevel.class);
BaseSupportUtils.setUpdateCommonField(entity);
updateById(entity);
}