13 changed files with 406 additions and 10 deletions
@ -0,0 +1,135 @@ |
|||
package com.qs.serve.modules.goods.controller; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.qs.serve.common.model.annotation.SysLog; |
|||
import com.qs.serve.common.model.dto.PageVo; |
|||
import com.qs.serve.common.model.dto.R; |
|||
import com.qs.serve.common.model.enums.BizType; |
|||
import com.qs.serve.common.model.enums.SystemModule; |
|||
import com.qs.serve.common.util.PageUtil; |
|||
import com.qs.serve.common.util.CopierUtil; |
|||
import com.qs.serve.common.util.StringUtils; |
|||
import com.qs.serve.common.util.TreeUtil; |
|||
import com.qs.serve.modules.biz.consts.GroupDataType; |
|||
import com.qs.serve.modules.bms.entity.vo.BmsRegionTreeVo; |
|||
import com.qs.serve.modules.goods.entity.bo.GoodsFeedbackTypeBo; |
|||
import com.qs.serve.modules.goods.entity.vo.GoodsFeedbackTypeTreeVo; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import com.qs.serve.modules.goods.entity.GoodsFeedbackType; |
|||
import com.qs.serve.modules.goods.service.GoodsFeedbackTypeService; |
|||
|
|||
import javax.validation.Valid; |
|||
import java.util.List; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* 商品 问题反馈类型 |
|||
* @author YenHex |
|||
* @since 2024-11-01 |
|||
*/ |
|||
@Slf4j |
|||
@AllArgsConstructor |
|||
@RestController |
|||
@RequestMapping("goods/feedbackType") |
|||
public class GoodsFeedbackTypeController { |
|||
|
|||
private GoodsFeedbackTypeService goodsFeedbackTypeService; |
|||
|
|||
/** |
|||
* 列表 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/options") |
|||
public R<List<GoodsFeedbackTypeTreeVo>> getOptions(GoodsFeedbackType param){ |
|||
LambdaQueryWrapper<GoodsFeedbackType> lqw = new LambdaQueryWrapper<>(param); |
|||
lqw.eq(GoodsFeedbackType::getHideFlag,0) |
|||
.orderByDesc(GoodsFeedbackType::getSort); |
|||
List<GoodsFeedbackType> list = goodsFeedbackTypeService.list(lqw); |
|||
List<GoodsFeedbackTypeTreeVo> treeVoList = list.stream().map(obj->{ |
|||
GoodsFeedbackTypeTreeVo treeNode = CopierUtil.copy(obj,new GoodsFeedbackTypeTreeVo()); |
|||
treeNode.setId(obj.getId()); |
|||
treeNode.setParentId(obj.getPid()); |
|||
treeNode.setSort(obj.getSort()); |
|||
return treeNode; |
|||
}).collect(Collectors.toList()); |
|||
return R.ok(TreeUtil.buildByRecursive(treeVoList,TreeUtil.DEFAULT_PID_STRING)); |
|||
} |
|||
|
|||
/** |
|||
* 列表 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/tree") |
|||
public R<List<GoodsFeedbackTypeTreeVo>> getList(GoodsFeedbackType param){ |
|||
LambdaQueryWrapper<GoodsFeedbackType> lqw = new LambdaQueryWrapper<>(param); |
|||
lqw.orderByDesc(GoodsFeedbackType::getSort); |
|||
List<GoodsFeedbackType> list = goodsFeedbackTypeService.list(lqw); |
|||
List<GoodsFeedbackTypeTreeVo> treeVoList = list.stream().map(obj->{ |
|||
GoodsFeedbackTypeTreeVo treeNode = CopierUtil.copy(obj,new GoodsFeedbackTypeTreeVo()); |
|||
treeNode.setId(obj.getId()); |
|||
treeNode.setParentId(obj.getPid()); |
|||
treeNode.setSort(obj.getSort()); |
|||
return treeNode; |
|||
}).collect(Collectors.toList()); |
|||
return R.ok(TreeUtil.buildByRecursive(treeVoList,TreeUtil.DEFAULT_PID_STRING)); |
|||
} |
|||
|
|||
/** |
|||
* ID查询 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@GetMapping("/getById/{id}") |
|||
@SysLog(module = SystemModule.GOODS, title = "问题反馈类型", biz = BizType.QUERY) |
|||
public R<GoodsFeedbackType> getById(@PathVariable("id") String id){ |
|||
GoodsFeedbackType goodsFeedbackType = goodsFeedbackTypeService.getById(id); |
|||
return R.ok(goodsFeedbackType); |
|||
} |
|||
|
|||
/** |
|||
* 更新 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/updateById") |
|||
@SysLog(module = SystemModule.GOODS, title = "问题反馈类型", biz = BizType.UPDATE) |
|||
public R<?> updateById(@RequestBody @Valid GoodsFeedbackTypeBo param){ |
|||
GoodsFeedbackType entity = CopierUtil.copy(param,new GoodsFeedbackType()); |
|||
boolean result = goodsFeedbackTypeService.updateById(entity); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
/** |
|||
* 新增 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/save") |
|||
@SysLog(module = SystemModule.GOODS, title = "问题反馈类型", biz = BizType.INSERT) |
|||
public R<?> save(@RequestBody @Valid GoodsFeedbackTypeBo param){ |
|||
GoodsFeedbackType entity = CopierUtil.copy(param,new GoodsFeedbackType()); |
|||
boolean result = goodsFeedbackTypeService.save(entity); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
/** |
|||
* 删除 |
|||
* @param ids |
|||
* @return |
|||
*/ |
|||
@DeleteMapping("/deleteById/{ids}") |
|||
@SysLog(module = SystemModule.GOODS, title = "问题反馈类型", biz = BizType.DELETE) |
|||
public R<?> deleteById(@PathVariable("ids") String ids){ |
|||
List<Long> idsLong = StringUtils.splitIdLong(ids); |
|||
boolean result = goodsFeedbackTypeService.removeByIds(idsLong); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,97 @@ |
|||
package com.qs.serve.modules.goods.entity; |
|||
|
|||
import java.time.LocalDate; |
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
import java.time.LocalDateTime; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* 问题反馈类型 实体类 |
|||
* @author YenHex |
|||
* @since 2024-11-01 |
|||
*/ |
|||
@Data |
|||
@TableName("goods_feedback_type") |
|||
public class GoodsFeedbackType implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** id */ |
|||
@TableId(type = IdType.AUTO) |
|||
private String id; |
|||
|
|||
/** 反馈类目 */ |
|||
@Length(max = 255,message = "反馈类目长度不能超过255字") |
|||
private String name; |
|||
|
|||
/** 父级id */ |
|||
private String pid; |
|||
|
|||
/** 隐藏 */ |
|||
private Integer hideFlag; |
|||
|
|||
private Integer sort; |
|||
|
|||
/** 备注 */ |
|||
@Length(max = 255,message = "备注长度不能超过255字") |
|||
private String remark; |
|||
|
|||
/** 创建时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private LocalDateTime createTime; |
|||
|
|||
/** 最后更新时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private LocalDateTime updateTime; |
|||
|
|||
/** 所属租户 */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String tenantId; |
|||
|
|||
/** 逻辑删除标记(0:显示;1:隐藏) */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String delFlag; |
|||
|
|||
/** 创建人 */ |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private String createBy; |
|||
|
|||
/** 更新人 */ |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private String updateBy; |
|||
|
|||
|
|||
public static GoodsFeedbackType toNewObject(GoodsFeedbackType source){ |
|||
GoodsFeedbackType feedbackType = new GoodsFeedbackType(); |
|||
feedbackType.setId(source.getId()); |
|||
feedbackType.setName(source.getName()); |
|||
feedbackType.setPid(source.getPid()); |
|||
feedbackType.setRemark(source.getRemark()); |
|||
feedbackType.setCreateTime(source.getCreateTime()); |
|||
feedbackType.setUpdateTime(source.getUpdateTime()); |
|||
feedbackType.setTenantId(source.getTenantId()); |
|||
feedbackType.setDelFlag(source.getDelFlag()); |
|||
feedbackType.setCreateBy(source.getCreateBy()); |
|||
feedbackType.setUpdateBy(source.getUpdateBy()); |
|||
return feedbackType; |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,11 @@ |
|||
package com.qs.serve.modules.goods.entity.bo; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2024/11/1 |
|||
*/ |
|||
@Data |
|||
public class GoodsFeedbackTypeBo { |
|||
} |
@ -0,0 +1,20 @@ |
|||
package com.qs.serve.modules.goods.entity.vo; |
|||
|
|||
import com.qs.serve.common.model.dto.TreeNode; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2024/11/1 |
|||
*/ |
|||
@Data |
|||
public class GoodsFeedbackTypeTreeVo extends TreeNode { |
|||
|
|||
/** 反馈类目 */ |
|||
private String name; |
|||
|
|||
/** 隐藏 */ |
|||
private Integer hideFlag; |
|||
|
|||
} |
@ -0,0 +1,14 @@ |
|||
package com.qs.serve.modules.goods.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.qs.serve.modules.goods.entity.GoodsFeedbackType; |
|||
|
|||
/** |
|||
* 问题反馈类型 Mapper |
|||
* @author YenHex |
|||
* @date 2024-11-01 |
|||
*/ |
|||
public interface GoodsFeedbackTypeMapper extends BaseMapper<GoodsFeedbackType> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,14 @@ |
|||
package com.qs.serve.modules.goods.service; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import com.qs.serve.modules.goods.entity.GoodsFeedbackType; |
|||
|
|||
/** |
|||
* 问题反馈类型 服务接口 |
|||
* @author YenHex |
|||
* @date 2024-11-01 |
|||
*/ |
|||
public interface GoodsFeedbackTypeService extends IService<GoodsFeedbackType> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,22 @@ |
|||
package com.qs.serve.modules.goods.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.stereotype.Service; |
|||
import com.qs.serve.modules.goods.entity.GoodsFeedbackType; |
|||
import com.qs.serve.modules.goods.service.GoodsFeedbackTypeService; |
|||
import com.qs.serve.modules.goods.mapper.GoodsFeedbackTypeMapper; |
|||
|
|||
/** |
|||
* 问题反馈类型 服务实现类 |
|||
* @author YenHex |
|||
* @since 2024-11-01 |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
@AllArgsConstructor |
|||
public class GoodsFeedbackTypeServiceImpl extends ServiceImpl<GoodsFeedbackTypeMapper,GoodsFeedbackType> implements GoodsFeedbackTypeService { |
|||
|
|||
} |
|||
|
Loading…
Reference in new issue