卸货地修改
This commit is contained in:
@ -0,0 +1,121 @@
|
||||
package com.xjrsoft.module.sales.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.xjrsoft.common.model.result.R;
|
||||
import com.xjrsoft.common.page.ConventPage;
|
||||
import com.xjrsoft.common.page.PageOutput;
|
||||
import com.xjrsoft.common.utils.VoToColumnUtil;
|
||||
import com.xjrsoft.module.datalog.service.DatalogService;
|
||||
import com.xjrsoft.module.datalog.vo.DataChangeLogVo;
|
||||
import com.xjrsoft.module.sales.dto.LngGradeSystemPageDto;
|
||||
import com.xjrsoft.module.sales.dto.UpdateLngGradeSystemDto;
|
||||
import com.xjrsoft.module.sales.entity.LngGradeSystem;
|
||||
import com.xjrsoft.module.sales.service.IGradeSystemService;
|
||||
import com.xjrsoft.module.sales.vo.LngGradeSystemPageVo;
|
||||
import com.xjrsoft.module.sales.vo.LngGradeSystemVo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @title: 评价体系
|
||||
* @Author 管理员
|
||||
* @Date: 2025-12-05
|
||||
* @Version 1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sales" + "/gradeSystem")
|
||||
@Api(value = "/sales" + "/gradeSystem",tags = "评价体系代码")
|
||||
@AllArgsConstructor
|
||||
public class GradeSystemController {
|
||||
|
||||
|
||||
private final IGradeSystemService gradeSystemService;
|
||||
private final DatalogService dataService;
|
||||
|
||||
@GetMapping(value = "/page")
|
||||
@ApiOperation(value="LngGradeSystem列表(分页)")
|
||||
@SaCheckPermission("gradeSystem:list")
|
||||
public R page(@Valid LngGradeSystemPageDto dto){
|
||||
|
||||
LambdaQueryWrapper<LngGradeSystem> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper
|
||||
.like(StrUtil.isNotBlank(dto.getGsName()),LngGradeSystem::getGsName,dto.getGsName())
|
||||
.like(StrUtil.isNotBlank(dto.getTypeCode()),LngGradeSystem::getTypeCode,dto.getTypeCode())
|
||||
.like(StrUtil.isNotBlank(dto.getValid()),LngGradeSystem::getValid,dto.getValid())
|
||||
.orderByDesc(LngGradeSystem::getId)
|
||||
.select(LngGradeSystem.class,x -> VoToColumnUtil.fieldsToColumns(LngGradeSystemPageVo.class).contains(x.getProperty()));
|
||||
IPage<LngGradeSystem> page = gradeSystemService.page(ConventPage.getPage(dto), queryWrapper);
|
||||
PageOutput<LngGradeSystemPageVo> pageOutput = ConventPage.getPageOutput(page, LngGradeSystemPageVo.class);
|
||||
return R.ok(pageOutput);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@ApiOperation(value="根据id查询LngGradeSystem信息")
|
||||
@SaCheckPermission("gradeSystem:detail")
|
||||
public R info(@RequestParam Long id){
|
||||
LngGradeSystem lngGradeSystem = gradeSystemService.getByIdDeep(id);
|
||||
if (lngGradeSystem == null) {
|
||||
return R.error("找不到此数据!");
|
||||
}
|
||||
return R.ok(BeanUtil.toBean(lngGradeSystem, LngGradeSystemVo.class));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/datalog")
|
||||
@ApiOperation(value="根据id查询LngGradeSystem数据详细日志")
|
||||
@SaCheckPermission("gradeSystem:datalog")
|
||||
public R datalog(@RequestParam Long id){
|
||||
List<DataChangeLogVo> logs = dataService.findLogsByEntityId(UpdateLngGradeSystemDto.class,id);
|
||||
return R.ok(logs);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation(value = "新增LngGradeSystem")
|
||||
@SaCheckPermission("gradeSystem:add")
|
||||
public R add(@Valid @RequestBody UpdateLngGradeSystemDto dto){
|
||||
UpdateLngGradeSystemDto res = dataService.insert(dto);
|
||||
return R.ok(res.getId());
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation(value = "修改LngGradeSystem")
|
||||
@SaCheckPermission("gradeSystem:edit")
|
||||
public R update(@Valid @RequestBody UpdateLngGradeSystemDto dto){
|
||||
return R.ok(dataService.updateById(dto));
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@ApiOperation(value = "删除")
|
||||
@SaCheckPermission("gradeSystem:delete")
|
||||
public R delete(@Valid @RequestBody List<Long> ids){
|
||||
return R.ok(dataService.deleteByIds(UpdateLngGradeSystemDto.class, ids));
|
||||
|
||||
}
|
||||
|
||||
@PostMapping("/enable")
|
||||
@ApiOperation(value = "启用LngGradeSystem")
|
||||
@SaCheckPermission("gradeSystem:enable")
|
||||
public R enable(@Valid @RequestBody List<Long> ids){
|
||||
return R.ok(dataService.enable(UpdateLngGradeSystemDto.class,ids));
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/disable")
|
||||
@ApiOperation(value = "禁用LngGradeSystem")
|
||||
@SaCheckPermission("gradeSystem:disable")
|
||||
public R disable(@Valid @RequestBody List<Long> ids){
|
||||
return R.ok(dataService.disable(UpdateLngGradeSystemDto.class,ids));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,130 @@
|
||||
package com.xjrsoft.module.sales.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.github.yulichang.annotation.EntityMapping;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @title: 评价体系
|
||||
* @Author 管理员
|
||||
* @Date: 2025-12-05
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("lng_grade_system")
|
||||
@ApiModel(value = "评价体系对象", description = "评价体系")
|
||||
public class LngGradeSystem implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ApiModelProperty("主键")
|
||||
@TableId
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 编码(可用于排序、分类)
|
||||
*/
|
||||
@ApiModelProperty("编码(可用于排序、分类)")
|
||||
private String gsCode;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@ApiModelProperty("名称")
|
||||
private String gsName;
|
||||
|
||||
/**
|
||||
* 评价对象(供应商准入/供应商评级/客户评级/客户评价/承运商准入/承运商评级)
|
||||
*/
|
||||
@ApiModelProperty("评价对象(供应商准入/供应商评级/客户评级/客户评价/承运商准入/承运商评级)")
|
||||
private String typeCode;
|
||||
|
||||
/**
|
||||
* 有效标志(Y-有效,N-无效)
|
||||
*/
|
||||
@ApiModelProperty("有效标志(Y-有效,N-无效)")
|
||||
private String valid;
|
||||
|
||||
/**
|
||||
* 审批状态(未审批/审批中/已审批/已驳回)
|
||||
*/
|
||||
@ApiModelProperty("审批状态(未审批/审批中/已审批/已驳回)")
|
||||
private String approCode;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ApiModelProperty("备注")
|
||||
private String note;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
@ApiModelProperty("创建人id")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ApiModelProperty("创建时间")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createDate;
|
||||
|
||||
/**
|
||||
* 修改人id
|
||||
*/
|
||||
@ApiModelProperty("修改人id")
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
private Long modifyUserId;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@ApiModelProperty("修改时间")
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
private LocalDateTime modifyDate;
|
||||
|
||||
/**
|
||||
* 租户id
|
||||
*/
|
||||
@ApiModelProperty("租户id")
|
||||
private Long tenantId;
|
||||
|
||||
/**
|
||||
* 部门id
|
||||
*/
|
||||
@ApiModelProperty("部门id")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 数据权限id
|
||||
*/
|
||||
@ApiModelProperty("数据权限id")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long ruleUserId;
|
||||
|
||||
|
||||
/**
|
||||
* lngGradeSystemItem
|
||||
*/
|
||||
@ApiModelProperty("lngGradeSystemItem子表")
|
||||
@TableField(exist = false)
|
||||
@EntityMapping(thisField = "id", joinField = "gsId")
|
||||
private List<LngGradeSystemItem> lngGradeSystemItemList;
|
||||
|
||||
}
|
||||
@ -0,0 +1,121 @@
|
||||
package com.xjrsoft.module.sales.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
/**
|
||||
* @title: 评价体系
|
||||
* @Author 管理员
|
||||
* @Date: 2025-12-05
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("lng_grade_system_item")
|
||||
@ApiModel(value = "评价体系对象", description = "评价体系")
|
||||
public class LngGradeSystemItem implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ApiModelProperty("主键")
|
||||
@TableId
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 评价体系主键
|
||||
*/
|
||||
@ApiModelProperty("评价体系主键")
|
||||
private Long gsId;
|
||||
|
||||
/**
|
||||
* 评分事项
|
||||
*/
|
||||
@ApiModelProperty("评分事项")
|
||||
private String itemName;
|
||||
|
||||
/**
|
||||
* 评分标准
|
||||
*/
|
||||
@ApiModelProperty("评分标准")
|
||||
private String itemDesc;
|
||||
|
||||
/**
|
||||
* 评价部门编码
|
||||
*/
|
||||
@ApiModelProperty("评价部门编码")
|
||||
private String eDeptCode;
|
||||
|
||||
/**
|
||||
* 显示顺序
|
||||
*/
|
||||
@ApiModelProperty("显示顺序")
|
||||
private Short sort;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ApiModelProperty("备注")
|
||||
private String note;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
@ApiModelProperty("创建人id")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ApiModelProperty("创建时间")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createDate;
|
||||
|
||||
/**
|
||||
* 修改人id
|
||||
*/
|
||||
@ApiModelProperty("修改人id")
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
private Long modifyUserId;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@ApiModelProperty("修改时间")
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
private LocalDateTime modifyDate;
|
||||
|
||||
/**
|
||||
* 租户id
|
||||
*/
|
||||
@ApiModelProperty("租户id")
|
||||
private Long tenantId;
|
||||
|
||||
/**
|
||||
* 部门id
|
||||
*/
|
||||
@ApiModelProperty("部门id")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 数据权限id
|
||||
*/
|
||||
@ApiModelProperty("数据权限id")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long ruleUserId;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.xjrsoft.module.sales.mapper;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.xjrsoft.module.sales.entity.LngGradeSystemItem;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @title: mapper
|
||||
* @Author 管理员
|
||||
* @Date: 2025-12-05
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface LngGradeSystemItemMapper extends MPJBaseMapper<LngGradeSystemItem> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.xjrsoft.module.sales.mapper;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.xjrsoft.module.sales.entity.LngGradeSystem;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @title: mapper
|
||||
* @Author 管理员
|
||||
* @Date: 2025-12-05
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface LngGradeSystemMapper extends MPJBaseMapper<LngGradeSystem> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,41 @@
|
||||
package com.xjrsoft.module.sales.service;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseService;
|
||||
import com.github.yulichang.extension.mapping.base.MPJDeepService;
|
||||
import com.github.yulichang.extension.mapping.base.MPJRelationService;
|
||||
import com.xjrsoft.module.sales.entity.LngGradeSystem;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @title: service
|
||||
* @Author 管理员
|
||||
* @Date: 2025-12-05
|
||||
* @Version 1.0
|
||||
*/
|
||||
|
||||
public interface IGradeSystemService extends MPJBaseService<LngGradeSystem>, MPJDeepService<LngGradeSystem>, MPJRelationService<LngGradeSystem> {
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param lngGradeSystem
|
||||
* @return
|
||||
*/
|
||||
Boolean add(LngGradeSystem lngGradeSystem);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param lngGradeSystem
|
||||
* @return
|
||||
*/
|
||||
Boolean update(LngGradeSystem lngGradeSystem);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
Boolean delete(List<Long> ids);
|
||||
}
|
||||
@ -0,0 +1,88 @@
|
||||
package com.xjrsoft.module.sales.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.github.yulichang.base.MPJBaseServiceImpl;
|
||||
import com.xjrsoft.module.sales.entity.LngGradeSystem;
|
||||
import com.xjrsoft.module.sales.entity.LngGradeSystemItem;
|
||||
import com.xjrsoft.module.sales.mapper.LngGradeSystemItemMapper;
|
||||
import com.xjrsoft.module.sales.mapper.LngGradeSystemMapper;
|
||||
import com.xjrsoft.module.sales.service.IGradeSystemService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @title: service
|
||||
* @Author 管理员
|
||||
* @Date: 2025-12-05
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class GradeSystemServiceImpl extends MPJBaseServiceImpl<LngGradeSystemMapper, LngGradeSystem> implements IGradeSystemService {
|
||||
private final LngGradeSystemMapper gradeSystemLngGradeSystemMapper;
|
||||
|
||||
private final LngGradeSystemItemMapper gradeSystemLngGradeSystemItemMapper;
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean add(LngGradeSystem lngGradeSystem) {
|
||||
gradeSystemLngGradeSystemMapper.insert(lngGradeSystem);
|
||||
for (LngGradeSystemItem lngGradeSystemItem : lngGradeSystem.getLngGradeSystemItemList()) {
|
||||
lngGradeSystemItem.setGsId(lngGradeSystem.getId());
|
||||
gradeSystemLngGradeSystemItemMapper.insert(lngGradeSystemItem);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean update(LngGradeSystem lngGradeSystem) {
|
||||
gradeSystemLngGradeSystemMapper.updateById(lngGradeSystem);
|
||||
//********************************* LngGradeSystemItem 增删改 开始 *******************************************/
|
||||
{
|
||||
// 查出所有子级的id
|
||||
List<LngGradeSystemItem> lngGradeSystemItemList = gradeSystemLngGradeSystemItemMapper.selectList(Wrappers.lambdaQuery(LngGradeSystemItem.class).eq(LngGradeSystemItem::getGsId, lngGradeSystem.getId()).select(LngGradeSystemItem::getId));
|
||||
List<Long> lngGradeSystemItemIds = lngGradeSystemItemList.stream().map(LngGradeSystemItem::getId).collect(Collectors.toList());
|
||||
//原有子表单 没有被删除的主键
|
||||
List<Long> lngGradeSystemItemOldIds = lngGradeSystem.getLngGradeSystemItemList().stream().map(LngGradeSystemItem::getId).filter(Objects::nonNull).collect(Collectors.toList());
|
||||
//找到需要删除的id
|
||||
List<Long> lngGradeSystemItemRemoveIds = lngGradeSystemItemIds.stream().filter(item -> !lngGradeSystemItemOldIds.contains(item)).collect(Collectors.toList());
|
||||
|
||||
for (LngGradeSystemItem lngGradeSystemItem : lngGradeSystem.getLngGradeSystemItemList()) {
|
||||
//如果不等于空则修改
|
||||
if (lngGradeSystemItem.getId() != null) {
|
||||
gradeSystemLngGradeSystemItemMapper.updateById(lngGradeSystemItem);
|
||||
}
|
||||
//如果等于空 则新增
|
||||
else {
|
||||
//已经不存在的id 删除
|
||||
lngGradeSystemItem.setGsId(lngGradeSystem.getId());
|
||||
gradeSystemLngGradeSystemItemMapper.insert(lngGradeSystemItem);
|
||||
}
|
||||
}
|
||||
//已经不存在的id 删除
|
||||
if(lngGradeSystemItemRemoveIds.size() > 0){
|
||||
gradeSystemLngGradeSystemItemMapper.deleteBatchIds(lngGradeSystemItemRemoveIds);
|
||||
}
|
||||
}
|
||||
//********************************* LngGradeSystemItem 增删改 结束 *******************************************/
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean delete(List<Long> ids) {
|
||||
gradeSystemLngGradeSystemMapper.deleteBatchIds(ids);
|
||||
gradeSystemLngGradeSystemItemMapper.delete(Wrappers.lambdaQuery(LngGradeSystemItem.class).in(LngGradeSystemItem::getGsId, ids));
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user