This commit is contained in:
韩鹏辉 2024-04-03 10:57:17 +08:00
commit 7e12def5c1
1 changed files with 6 additions and 0 deletions

View File

@ -11,6 +11,7 @@ import com.chaozhanggui.system.cashierservice.util.JSONUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -59,6 +60,7 @@ public class TbPrintPCMachineService {
*/
public Result queryByPage(TbPrintPCMachine tbPrintMachine) {
PageHelper.startPage(tbPrintMachine.getPage(), tbPrintMachine.getPageSize());
tbPrintMachine.setContentType("local");
List<TbPrintPCMachine> tbPrintMachines = this.tbPrintMachineMapper.queryAll(tbPrintMachine);
PageInfo pageInfo=new PageInfo(tbPrintMachines);
return Result.success(CodeEnum.SUCCESS,pageInfo);
@ -73,7 +75,11 @@ public class TbPrintPCMachineService {
public Result insert(PrintMachineDto resources) {
TbPrintPCMachine tbPrintMachine = new TbPrintPCMachine();
tbPrintMachine.setCreatedAt(Instant.now().toEpochMilli());
tbPrintMachine.setContentType("local");
if (resources.getConfig() != null){
if(CollectionUtils.isEmpty(resources.getConfig().getCategoryList())){
resources.getConfig().setCategoryList(null);
}
tbPrintMachine.setConfig(JSONUtil.toJSONString(resources.getConfig(),true));
}
BeanUtils.copyProperties(resources,tbPrintMachine);