完善专家模块
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
/**
|
||||
* Copyright (C) 2018-2020
|
||||
* All rights reserved, Designed By www.yixiang.co
|
||||
* 注意:
|
||||
* 本软件为www.yixiang.co开发研制,未经购买不得使用
|
||||
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
|
||||
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
|
||||
*/
|
||||
package co.yixiang.modules.expert.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 hupeng
|
||||
* @date 2022-09-17
|
||||
*/
|
||||
@Data
|
||||
@TableName("yx_store_expert")
|
||||
public class YxStoreExpert implements Serializable {
|
||||
|
||||
/** 专家id */
|
||||
@TableId
|
||||
private Long id;
|
||||
|
||||
|
||||
/** 商户Id(0为总后台管理员创建,不为0的时候是商户后台创建) */
|
||||
private Integer merId;
|
||||
|
||||
|
||||
/** 专家人像大图 */
|
||||
@NotBlank
|
||||
private String image;
|
||||
|
||||
|
||||
/** 专家名称 */
|
||||
@NotBlank
|
||||
private String expertName;
|
||||
|
||||
|
||||
/** 专家简介 */
|
||||
@NotBlank
|
||||
private String expertInfo;
|
||||
|
||||
|
||||
/** 专家的职级 */
|
||||
@NotBlank
|
||||
private String expertStatus;
|
||||
|
||||
|
||||
/** 专家所属单位 */
|
||||
@NotBlank
|
||||
private String expertUnit;
|
||||
|
||||
|
||||
/** 添加时间 */
|
||||
@TableField(fill= FieldFill.INSERT)
|
||||
private Timestamp createTime;
|
||||
|
||||
|
||||
/** 更新时间 */
|
||||
@TableField(fill= FieldFill.INSERT_UPDATE)
|
||||
private Timestamp updateTime;
|
||||
|
||||
|
||||
/** 是否删除 */
|
||||
private Integer isDel;
|
||||
|
||||
|
||||
public void copy(YxStoreExpert source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
/**
|
||||
* Copyright (C) 2018-2020
|
||||
* All rights reserved, Designed By www.yixiang.co
|
||||
* 注意:
|
||||
* 本软件为www.yixiang.co开发研制,未经购买不得使用
|
||||
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
|
||||
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
|
||||
*/
|
||||
package co.yixiang.modules.expert.rest;
|
||||
|
||||
import co.yixiang.domain.PageResult;
|
||||
import co.yixiang.dozer.service.IGenerator;
|
||||
import co.yixiang.logging.aop.log.Log;
|
||||
import co.yixiang.modules.expert.domain.YxStoreExpert;
|
||||
import co.yixiang.modules.expert.service.YxStoreExpertService;
|
||||
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.security.access.prepost.PreAuthorize;
|
||||
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 hupeng
|
||||
* @date 2022-09-17
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Api(tags = " ss管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/yxStoreExpert")
|
||||
public class YxStoreExpertController {
|
||||
|
||||
private final YxStoreExpertService yxStoreExpertService;
|
||||
private final IGenerator generator;
|
||||
|
||||
|
||||
@Log("导出数据")
|
||||
@ApiOperation("导出数据")
|
||||
@GetMapping(value = "/download")
|
||||
// @PreAuthorize("@ss.hasAnyPermissions('admin','yxStoreExpert:list')")
|
||||
public void download(HttpServletResponse response, YxStoreExpertQueryCriteria criteria) throws IOException {
|
||||
yxStoreExpertService.download(generator.convert(yxStoreExpertService.queryAll(criteria), YxStoreExpertDto.class), response);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@Log("查询 专家")
|
||||
@ApiOperation("查询 专家")
|
||||
// @PreAuthorize("@ss.hasAnyPermissions('admin','yxStoreExpert:list')")
|
||||
public ResponseEntity<PageResult<YxStoreExpertDto>> getYxStoreExperts(YxStoreExpertQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(yxStoreExpertService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增 专家")
|
||||
@ApiOperation("新增 专家")
|
||||
// @PreAuthorize("ss.hasAnyPermissions('admin','yxStoreExpert:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody YxStoreExpert resources){
|
||||
return new ResponseEntity<>(yxStoreExpertService.save(resources),HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改 专家")
|
||||
@ApiOperation("修改 专家")
|
||||
// @PreAuthorize("@ss.hasAnyPermissions('admin','yxStoreExpert:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody YxStoreExpert resources){
|
||||
yxStoreExpertService.updateById(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除 专家")
|
||||
@ApiOperation("删除 专家")
|
||||
// @PreAuthorize("@ss.hasAnyPermissions ('admin','yxStoreExpert:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> deleteAll(@RequestBody Long[] ids) {
|
||||
Arrays.asList(ids).forEach(id->{
|
||||
yxStoreExpertService.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.expert.service;
|
||||
|
||||
import co.yixiang.common.service.BaseService;
|
||||
import co.yixiang.domain.PageResult;
|
||||
import co.yixiang.modules.expert.domain.YxStoreExpert;
|
||||
import co.yixiang.modules.expert.service.dto.YxStoreExpertDto;
|
||||
import co.yixiang.modules.expert.service.dto.YxStoreExpertQueryCriteria;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2022-09-17
|
||||
*/
|
||||
public interface YxStoreExpertService extends BaseService<YxStoreExpert> {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param criteria 条件
|
||||
* @param pageable 分页参数
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
PageResult<YxStoreExpertDto> queryAll(YxStoreExpertQueryCriteria criteria, Pageable pageable);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
* @param criteria 条件参数
|
||||
* @return List<YxStoreExpertDto>
|
||||
*/
|
||||
List<YxStoreExpert> queryAll(YxStoreExpertQueryCriteria criteria);
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
* @param all 待导出的数据
|
||||
* @param response /
|
||||
* @throws IOException /
|
||||
*/
|
||||
void download(List<YxStoreExpertDto> all, HttpServletResponse response) throws IOException;
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
* Copyright (C) 2018-2020
|
||||
* All rights reserved, Designed By www.yixiang.co
|
||||
* 注意:
|
||||
* 本软件为www.yixiang.co开发研制,未经购买不得使用
|
||||
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
|
||||
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
|
||||
*/
|
||||
package co.yixiang.modules.expert.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.Value;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2022-09-17
|
||||
*/
|
||||
@Data
|
||||
public class YxStoreExpertDto implements Serializable {
|
||||
|
||||
/** 专家id */
|
||||
private Long id;
|
||||
|
||||
/** 商户Id(0为总后台管理员创建,不为0的时候是商户后台创建) */
|
||||
|
||||
private Integer merId;
|
||||
|
||||
/** 专家人像大图 */
|
||||
private String image;
|
||||
|
||||
/** 专家名称 */
|
||||
private String expertName;
|
||||
|
||||
/** 专家简介 */
|
||||
private String expertInfo;
|
||||
|
||||
/** 专家的职级 */
|
||||
private String expertStatus;
|
||||
|
||||
/** 专家所属单位 */
|
||||
private String expertUnit;
|
||||
|
||||
/** 添加时间 */
|
||||
private Timestamp createTime;
|
||||
|
||||
/** 更新时间 */
|
||||
private Timestamp updateTime;
|
||||
|
||||
/** 是否删除 */
|
||||
private Integer isDel;
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Copyright (C) 2018-2020
|
||||
* All rights reserved, Designed By www.yixiang.co
|
||||
* 注意:
|
||||
* 本软件为www.yixiang.co开发研制,未经购买不得使用
|
||||
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
|
||||
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
|
||||
*/
|
||||
package co.yixiang.modules.expert.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2022-09-17
|
||||
*/
|
||||
@Data
|
||||
public class YxStoreExpertQueryCriteria{
|
||||
}
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
/**
|
||||
* Copyright (C) 2018-2020
|
||||
* All rights reserved, Designed By www.yixiang.co
|
||||
* 注意:
|
||||
* 本软件为www.yixiang.co开发研制,未经购买不得使用
|
||||
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
|
||||
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
|
||||
*/
|
||||
package co.yixiang.modules.expert.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.expert.domain.YxStoreExpert;
|
||||
import co.yixiang.modules.expert.service.YxStoreExpertService;
|
||||
import co.yixiang.modules.expert.service.dto.YxStoreExpertDto;
|
||||
import co.yixiang.modules.expert.service.dto.YxStoreExpertQueryCriteria;
|
||||
import co.yixiang.modules.expert.service.mapper.YxStoreExpertMapper;
|
||||
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-17
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
//@CacheConfig(cacheNames = "yxStoreExpert")
|
||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||
public class YxStoreExpertServiceImpl extends BaseServiceImpl<YxStoreExpertMapper, YxStoreExpert> implements YxStoreExpertService {
|
||||
|
||||
private final IGenerator generator;
|
||||
|
||||
@Override
|
||||
//@Cacheable
|
||||
public PageResult<YxStoreExpertDto> queryAll(YxStoreExpertQueryCriteria criteria, Pageable pageable) {
|
||||
getPage(pageable);
|
||||
PageInfo<YxStoreExpert> page = new PageInfo<>(queryAll(criteria));
|
||||
return generator.convertPageInfo(page,YxStoreExpertDto.class);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
//@Cacheable
|
||||
public List<YxStoreExpert> queryAll(YxStoreExpertQueryCriteria criteria){
|
||||
return baseMapper.selectList(QueryHelpPlus.getPredicate(YxStoreExpert.class, criteria));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void download(List<YxStoreExpertDto> all, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (YxStoreExpertDto yxStoreExpert : all) {
|
||||
Map<String,Object> map = new LinkedHashMap<>();
|
||||
map.put("商户Id(0为总后台管理员创建,不为0的时候是商户后台创建)", yxStoreExpert.getMerId());
|
||||
map.put("专家人像大图", yxStoreExpert.getImage());
|
||||
map.put("专家名称", yxStoreExpert.getExpertName());
|
||||
map.put("专家简介", yxStoreExpert.getExpertInfo());
|
||||
map.put("专家的职级", yxStoreExpert.getExpertStatus());
|
||||
map.put("专家所属单位", yxStoreExpert.getExpertUnit());
|
||||
map.put("添加时间", yxStoreExpert.getCreateTime());
|
||||
map.put("更新时间", yxStoreExpert.getUpdateTime());
|
||||
map.put("是否删除", yxStoreExpert.getIsDel());
|
||||
list.add(map);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* Copyright (C) 2018-2020
|
||||
* All rights reserved, Designed By www.yixiang.co
|
||||
* 注意:
|
||||
* 本软件为www.yixiang.co开发研制,未经购买不得使用
|
||||
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
|
||||
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
|
||||
*/
|
||||
package co.yixiang.modules.expert.service.mapper;
|
||||
|
||||
import co.yixiang.common.mapper.CoreMapper;
|
||||
import co.yixiang.modules.expert.domain.YxStoreExpert;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2022-09-17
|
||||
*/
|
||||
@Repository
|
||||
public interface YxStoreExpertMapper extends CoreMapper<YxStoreExpert> {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user