sj
2 years ago
8 changed files with 454 additions and 0 deletions
@ -0,0 +1,109 @@
|
||||
/** |
||||
* Copyright (C) 2018-2020 |
||||
* All rights reserved, Designed By www.yixiang.co |
||||
* 注意: |
||||
* 本软件为www.yixiang.co开发研制,未经购买不得使用 |
||||
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) |
||||
* 一经发现盗用、分享等行为,将追究法律责任,后果自负 |
||||
*/ |
||||
package co.yixiang.modules.evaluation.domain; |
||||
import com.baomidou.mybatisplus.annotation.FieldFill; |
||||
import com.baomidou.mybatisplus.annotation.TableField; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import lombok.Data; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import cn.hutool.core.bean.BeanUtil; |
||||
import cn.hutool.core.bean.copier.CopyOptions; |
||||
import javax.validation.constraints.*; |
||||
import java.sql.Timestamp; |
||||
import java.io.Serializable; |
||||
|
||||
/** |
||||
* @author ssj |
||||
* @date 2022-09-21 |
||||
*/ |
||||
@Data |
||||
@TableName("yx_evaluation") |
||||
public class YxEvaluation implements Serializable { |
||||
|
||||
/** 评测ID */ |
||||
@TableId |
||||
private Integer id; |
||||
|
||||
|
||||
/** 在列表里面的首页图 */ |
||||
private String homeImage; |
||||
|
||||
|
||||
/** 评测介绍 */ |
||||
private String synopsis; |
||||
|
||||
|
||||
/** 评测视频 */ |
||||
@NotBlank |
||||
private String videoInput; |
||||
|
||||
|
||||
|
||||
/** 关联商品信息 */ |
||||
@NotNull |
||||
private String product; |
||||
|
||||
/** 评测总结 */ |
||||
private String summary; |
||||
|
||||
|
||||
/** 产品展示图集 */ |
||||
private String displayImage; |
||||
|
||||
|
||||
/** 产品展示文字 */ |
||||
private String displaySynopsis; |
||||
|
||||
|
||||
/** 实用体验感受图 */ |
||||
private String feelImage; |
||||
|
||||
|
||||
/** 使用体验感受文字 */ |
||||
private String feelSynopsis; |
||||
|
||||
|
||||
/** 易用性体验图 */ |
||||
private String accessibilityImage; |
||||
|
||||
|
||||
/** 易用性体验文字 */ |
||||
private String accessibilitySynopsis; |
||||
|
||||
|
||||
/** 添加时间 */ |
||||
@TableField(fill= FieldFill.INSERT) |
||||
private Timestamp createTime; |
||||
|
||||
|
||||
/** 更新时间 */ |
||||
@TableField(fill= FieldFill.INSERT_UPDATE) |
||||
private Timestamp updateTime; |
||||
|
||||
|
||||
/** 是否删除 */ |
||||
private Integer isDel; |
||||
|
||||
|
||||
/** 是否展示 */ |
||||
private Integer isShow; |
||||
|
||||
|
||||
/** 排序 */ |
||||
@NotNull |
||||
private Integer sort; |
||||
|
||||
|
||||
private Long tenantId; |
||||
|
||||
|
||||
public void copy(YxEvaluation source){ |
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
||||
} |
||||
} |
@ -0,0 +1,90 @@
|
||||
/** |
||||
* Copyright (C) 2018-2020 |
||||
* All rights reserved, Designed By www.yixiang.co |
||||
* 注意: |
||||
* 本软件为www.yixiang.co开发研制,未经购买不得使用 |
||||
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) |
||||
* 一经发现盗用、分享等行为,将追究法律责任,后果自负 |
||||
*/ |
||||
package co.yixiang.modules.evaluation.rest; |
||||
|
||||
import co.yixiang.domain.PageResult; |
||||
import co.yixiang.dozer.service.IGenerator; |
||||
import co.yixiang.logging.aop.log.Log; |
||||
import co.yixiang.modules.evaluation.domain.YxEvaluation; |
||||
import co.yixiang.modules.evaluation.service.YxEvaluationService; |
||||
import co.yixiang.modules.evaluation.service.dto.YxEvaluationDto; |
||||
import co.yixiang.modules.evaluation.service.dto.YxEvaluationQueryCriteria; |
||||
import co.yixiang.modules.expert.service.dto.YxStoreExpertDto; |
||||
import co.yixiang.modules.expert.service.dto.YxStoreExpertQueryCriteria; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import lombok.AllArgsConstructor; |
||||
import org.springframework.data.domain.Pageable; |
||||
import org.springframework.http.HttpStatus; |
||||
import org.springframework.http.ResponseEntity; |
||||
import org.springframework.validation.annotation.Validated; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import javax.servlet.http.HttpServletResponse; |
||||
import java.io.IOException; |
||||
import java.util.Arrays; |
||||
/** |
||||
* @author ssj |
||||
* @date 2022-09-21 |
||||
*/ |
||||
@AllArgsConstructor |
||||
@Api(tags = " Evaluation管理") |
||||
@RestController |
||||
@RequestMapping("/api/yxEvaluation") |
||||
public class YxEvaluationController { |
||||
|
||||
private final YxEvaluationService yxEvaluationService; |
||||
private final IGenerator generator; |
||||
|
||||
|
||||
@Log("导出数据") |
||||
@ApiOperation("导出数据") |
||||
@GetMapping(value = "/download") |
||||
// @PreAuthorize("@ss.hasAnyPermissions('admin','yxEvaluation:list')")
|
||||
public void download(HttpServletResponse response, YxEvaluationQueryCriteria criteria) throws IOException { |
||||
yxEvaluationService.download(generator.convert(yxEvaluationService.queryAll(criteria), YxEvaluationDto.class), response); |
||||
} |
||||
|
||||
@GetMapping |
||||
@Log("查询 评测") |
||||
@ApiOperation("查询 评测") |
||||
// @PreAuthorize("@ss.hasAnyPermissions('admin','yxEvaluation:list')")
|
||||
public ResponseEntity<PageResult<YxEvaluationDto>> getYxEvaluations(YxEvaluationQueryCriteria criteria, Pageable pageable){ |
||||
return new ResponseEntity<>(yxEvaluationService.queryAll(criteria,pageable),HttpStatus.OK); |
||||
} |
||||
|
||||
@PostMapping |
||||
@Log("新增 评测") |
||||
@ApiOperation("新增 评测") |
||||
// @PreAuthorize("ss.hasAnyPermissions('admin','yxEvaluation:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody YxEvaluation resources){ |
||||
return new ResponseEntity<>(yxEvaluationService.save(resources),HttpStatus.CREATED); |
||||
} |
||||
|
||||
@PutMapping |
||||
@Log("修改 评测") |
||||
@ApiOperation("修改 评测") |
||||
// @PreAuthorize("@ss.hasAnyPermissions('admin','yxEvaluation:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody YxEvaluation resources){ |
||||
yxEvaluationService.updateById(resources); |
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
||||
} |
||||
|
||||
@Log("删除 专家") |
||||
@ApiOperation("删除 专家") |
||||
// @PreAuthorize("@ss.hasAnyPermissions ('admin','yxEvaluation:del')")
|
||||
@DeleteMapping |
||||
public ResponseEntity<Object> deleteAll(@RequestBody Long[] ids) { |
||||
Arrays.asList(ids).forEach(id->{ |
||||
yxEvaluationService.removeById(id); |
||||
}); |
||||
return new ResponseEntity<>(HttpStatus.OK); |
||||
} |
||||
} |
||||
|
@ -0,0 +1,49 @@
|
||||
/** |
||||
* Copyright (C) 2018-2020 |
||||
* All rights reserved, Designed By www.yixiang.co |
||||
* 注意: |
||||
* 本软件为www.yixiang.co开发研制,未经购买不得使用 |
||||
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) |
||||
* 一经发现盗用、分享等行为,将追究法律责任,后果自负 |
||||
*/ |
||||
package co.yixiang.modules.evaluation.service; |
||||
|
||||
import co.yixiang.common.service.BaseService; |
||||
import co.yixiang.domain.PageResult; |
||||
import co.yixiang.modules.evaluation.domain.YxEvaluation; |
||||
import co.yixiang.modules.evaluation.service.dto.YxEvaluationDto; |
||||
import co.yixiang.modules.evaluation.service.dto.YxEvaluationQueryCriteria; |
||||
import org.springframework.data.domain.Pageable; |
||||
|
||||
import javax.servlet.http.HttpServletResponse; |
||||
import java.io.IOException; |
||||
import java.util.List; |
||||
/** |
||||
* @author ssj |
||||
* @date 2022-09-21 |
||||
*/ |
||||
public interface YxEvaluationService extends BaseService<YxEvaluation> { |
||||
|
||||
/** |
||||
* 查询数据分页 |
||||
* @param criteria 条件 |
||||
* @param pageable 分页参数 |
||||
* @return Map<String,Object> |
||||
*/ |
||||
PageResult<YxEvaluationDto> queryAll(YxEvaluationQueryCriteria criteria, Pageable pageable); |
||||
|
||||
/** |
||||
* 查询所有数据不分页 |
||||
* @param criteria 条件参数 |
||||
* @return List<YxEvaluationDto> |
||||
*/ |
||||
List<YxEvaluation> queryAll(YxEvaluationQueryCriteria criteria); |
||||
|
||||
/** |
||||
* 导出数据 |
||||
* @param all 待导出的数据 |
||||
* @param response / |
||||
* @throws IOException / |
||||
*/ |
||||
void download(List<YxEvaluationDto> all, HttpServletResponse response) throws IOException; |
||||
} |
@ -0,0 +1,74 @@
|
||||
/** |
||||
* Copyright (C) 2018-2020 |
||||
* All rights reserved, Designed By www.yixiang.co |
||||
* 注意: |
||||
* 本软件为www.yixiang.co开发研制,未经购买不得使用 |
||||
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) |
||||
* 一经发现盗用、分享等行为,将追究法律责任,后果自负 |
||||
*/ |
||||
package co.yixiang.modules.evaluation.service.dto; |
||||
|
||||
import lombok.Data; |
||||
import java.sql.Timestamp; |
||||
import java.io.Serializable; |
||||
|
||||
/** |
||||
* @author hupeng |
||||
* @date 2022-09-21 |
||||
*/ |
||||
@Data |
||||
public class YxEvaluationDto implements Serializable { |
||||
|
||||
/** 评测ID */ |
||||
private Integer id; |
||||
|
||||
/** 在列表里面的首页图 */ |
||||
private String homeImage; |
||||
|
||||
/** 评测介绍 */ |
||||
private String synopsis; |
||||
|
||||
/** 评测视频 */ |
||||
private String videoInput; |
||||
|
||||
/** 关联商品信息*/ |
||||
private String product; |
||||
|
||||
/** 评测总结 */ |
||||
private String summary; |
||||
|
||||
/** 产品展示图集 */ |
||||
private String displayImage; |
||||
|
||||
/** 产品展示文字 */ |
||||
private String displaySynopsis; |
||||
|
||||
/** 实用体验感受图 */ |
||||
private String feelImage; |
||||
|
||||
/** 使用体验感受文字 */ |
||||
private String feelSynopsis; |
||||
|
||||
/** 易用性体验图 */ |
||||
private String accessibilityImage; |
||||
|
||||
/** 易用性体验文字 */ |
||||
private String accessibilitySynopsis; |
||||
|
||||
/** 添加时间 */ |
||||
private Timestamp createTime; |
||||
|
||||
/** 更新时间 */ |
||||
private Timestamp updateTime; |
||||
|
||||
/** 是否删除 */ |
||||
private Integer isDel; |
||||
|
||||
/** 是否展示 */ |
||||
private Integer isShow; |
||||
|
||||
/** 排序 */ |
||||
private Integer sort; |
||||
|
||||
private Long tenantId; |
||||
} |
@ -0,0 +1,19 @@
|
||||
/** |
||||
* Copyright (C) 2018-2020 |
||||
* All rights reserved, Designed By www.yixiang.co |
||||
* 注意: |
||||
* 本软件为www.yixiang.co开发研制,未经购买不得使用 |
||||
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) |
||||
* 一经发现盗用、分享等行为,将追究法律责任,后果自负 |
||||
*/ |
||||
package co.yixiang.modules.evaluation.service.dto; |
||||
|
||||
import lombok.Data; |
||||
|
||||
/** |
||||
* @author hupeng |
||||
* @date 2022-09-21 |
||||
*/ |
||||
@Data |
||||
public class YxEvaluationQueryCriteria{ |
||||
} |
@ -0,0 +1,88 @@
|
||||
/** |
||||
* Copyright (C) 2018-2020 |
||||
* All rights reserved, Designed By www.yixiang.co |
||||
* 注意: |
||||
* 本软件为www.yixiang.co开发研制,未经购买不得使用 |
||||
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) |
||||
* 一经发现盗用、分享等行为,将追究法律责任,后果自负 |
||||
*/ |
||||
package co.yixiang.modules.evaluation.service.impl; |
||||
|
||||
import co.yixiang.common.service.impl.BaseServiceImpl; |
||||
import co.yixiang.common.utils.QueryHelpPlus; |
||||
import co.yixiang.domain.PageResult; |
||||
import co.yixiang.dozer.service.IGenerator; |
||||
import co.yixiang.modules.evaluation.domain.YxEvaluation; |
||||
import co.yixiang.modules.evaluation.service.YxEvaluationService; |
||||
import co.yixiang.modules.evaluation.service.dto.YxEvaluationDto; |
||||
import co.yixiang.modules.evaluation.service.dto.YxEvaluationQueryCriteria; |
||||
import co.yixiang.modules.evaluation.service.mapper.YxEvaluationMapper; |
||||
import co.yixiang.utils.FileUtil; |
||||
import com.github.pagehelper.PageInfo; |
||||
import lombok.AllArgsConstructor; |
||||
import org.springframework.data.domain.Pageable; |
||||
import org.springframework.stereotype.Service; |
||||
import org.springframework.transaction.annotation.Propagation; |
||||
import org.springframework.transaction.annotation.Transactional; |
||||
|
||||
import javax.servlet.http.HttpServletResponse; |
||||
import java.io.IOException; |
||||
import java.util.ArrayList; |
||||
import java.util.LinkedHashMap; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
/** |
||||
* @author hupeng |
||||
* @date 2022-09-21 |
||||
*/ |
||||
@Service |
||||
@AllArgsConstructor |
||||
//@CacheConfig(cacheNames = "yxEvaluation")
|
||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) |
||||
public class YxEvaluationServiceImpl extends BaseServiceImpl<YxEvaluationMapper, YxEvaluation> implements YxEvaluationService { |
||||
|
||||
private final IGenerator generator; |
||||
|
||||
@Override |
||||
//@Cacheable
|
||||
public PageResult<YxEvaluationDto> queryAll(YxEvaluationQueryCriteria criteria, Pageable pageable) { |
||||
getPage(pageable); |
||||
PageInfo<YxEvaluation> page = new PageInfo<>(queryAll(criteria)); |
||||
return generator.convertPageInfo(page,YxEvaluationDto.class); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
//@Cacheable
|
||||
public List<YxEvaluation> queryAll(YxEvaluationQueryCriteria criteria){ |
||||
return baseMapper.selectList(QueryHelpPlus.getPredicate(YxEvaluation.class, criteria)); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public void download(List<YxEvaluationDto> all, HttpServletResponse response) throws IOException { |
||||
List<Map<String, Object>> list = new ArrayList<>(); |
||||
for (YxEvaluationDto yxEvaluation : all) { |
||||
Map<String,Object> map = new LinkedHashMap<>(); |
||||
map.put("在列表里面的首页图", yxEvaluation.getHomeImage()); |
||||
map.put("评测介绍", yxEvaluation.getSynopsis()); |
||||
map.put("评测视频", yxEvaluation.getVideoInput()); |
||||
map.put("关联商品信息", yxEvaluation.getProduct()); |
||||
map.put("评测总结", yxEvaluation.getSummary()); |
||||
map.put("产品展示图集", yxEvaluation.getDisplayImage()); |
||||
map.put("产品展示文字", yxEvaluation.getDisplaySynopsis()); |
||||
map.put("实用体验感受图", yxEvaluation.getFeelImage()); |
||||
map.put("使用体验感受文字", yxEvaluation.getFeelSynopsis()); |
||||
map.put("易用性体验图", yxEvaluation.getAccessibilityImage()); |
||||
map.put("易用性体验文字", yxEvaluation.getAccessibilitySynopsis()); |
||||
map.put("添加时间", yxEvaluation.getCreateTime()); |
||||
map.put("更新时间", yxEvaluation.getUpdateTime()); |
||||
map.put("是否删除", yxEvaluation.getIsDel()); |
||||
map.put("是否展示", yxEvaluation.getIsShow()); |
||||
map.put("排序", yxEvaluation.getSort()); |
||||
map.put(" tenantId", yxEvaluation.getTenantId()); |
||||
list.add(map); |
||||
} |
||||
FileUtil.downloadExcel(list, response); |
||||
} |
||||
} |
@ -0,0 +1,22 @@
|
||||
/** |
||||
* Copyright (C) 2018-2020 |
||||
* All rights reserved, Designed By www.yixiang.co |
||||
* 注意: |
||||
* 本软件为www.yixiang.co开发研制,未经购买不得使用 |
||||
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) |
||||
* 一经发现盗用、分享等行为,将追究法律责任,后果自负 |
||||
*/ |
||||
package co.yixiang.modules.evaluation.service.mapper; |
||||
|
||||
import co.yixiang.common.mapper.CoreMapper; |
||||
import co.yixiang.modules.evaluation.domain.YxEvaluation; |
||||
import org.springframework.stereotype.Repository; |
||||
|
||||
/** |
||||
* @author hupeng |
||||
* @date 2022-09-21 |
||||
*/ |
||||
@Repository |
||||
public interface YxEvaluationMapper extends CoreMapper<YxEvaluation> { |
||||
|
||||
} |
Loading…
Reference in new issue