修复代码生成器模板引入错误的问题
This commit is contained in:
@ -8,7 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
package ${package}.service.mapper;
|
package ${package}.service.mapper;
|
||||||
|
|
||||||
import co.yixiang.commonold.mapper.CoreMapper;
|
import co.yixiang.common.mapper.CoreMapper;
|
||||||
import ${package}.domain.${className};
|
import ${package}.domain.${className};
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
@ -18,7 +18,6 @@ import org.springframework.stereotype.Repository;
|
|||||||
* @date ${date}
|
* @date ${date}
|
||||||
*/
|
*/
|
||||||
@Repository
|
@Repository
|
||||||
@Mapper
|
|
||||||
public interface ${className}Mapper extends CoreMapper<${className}> {
|
public interface ${className}Mapper extends CoreMapper<${className}> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,12 +18,12 @@ import co.yixiang.exception.EntityExistException;
|
|||||||
</#if>
|
</#if>
|
||||||
</#list>
|
</#list>
|
||||||
</#if>
|
</#if>
|
||||||
import co.yixiang.commonold.service.impl.BaseServiceImpl;
|
import co.yixiang.common.service.impl.BaseServiceImpl;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import co.yixiang.dozer.service.IGenerator;
|
import co.yixiang.dozer.service.IGenerator;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import co.yixiang.commonold.utils.QueryHelpPlus;
|
import co.yixiang.common.utils.QueryHelpPlus;
|
||||||
import co.yixiang.utils.ValidationUtil;
|
import co.yixiang.utils.ValidationUtil;
|
||||||
import co.yixiang.utils.FileUtil;
|
import co.yixiang.utils.FileUtil;
|
||||||
import ${package}.service.${className}Service;
|
import ${package}.service.${className}Service;
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
|
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
|
||||||
*/
|
*/
|
||||||
package ${package}.service;
|
package ${package}.service;
|
||||||
import co.yixiang.commonold.service.BaseService;
|
import co.yixiang.common.service.BaseService;
|
||||||
import ${package}.domain.${className};
|
import ${package}.domain.${className};
|
||||||
import ${package}.service.dto.${className}Dto;
|
import ${package}.service.dto.${className}Dto;
|
||||||
import ${package}.service.dto.${className}QueryCriteria;
|
import ${package}.service.dto.${className}QueryCriteria;
|
||||||
|
@ -147,19 +147,6 @@ public class UserController {
|
|||||||
return ApiResult.ok(map);
|
return ApiResult.ok(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
|
||||||
// * 获取活动状态
|
|
||||||
// */
|
|
||||||
// @GetMapping("/user/activity")
|
|
||||||
// @ApiOperation(value = "获取活动状态",notes = "获取活动状态")
|
|
||||||
// @Deprecated
|
|
||||||
// public ApiResult<Object> activity(){
|
|
||||||
// Map<String,Object> map = new LinkedHashMap<>();
|
|
||||||
// map.put("is_bargin",false);
|
|
||||||
// map.put("is_pink",false);
|
|
||||||
// map.put("is_seckill",false);
|
|
||||||
// return ApiResult.ok(map);
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 签到用户信息
|
* 签到用户信息
|
||||||
|
@ -0,0 +1,52 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (C) 2018-2020
|
||||||
|
* All rights reserved, Designed By www.yixiang.co
|
||||||
|
* 注意:
|
||||||
|
* 本软件为www.yixiang.co开发研制,未经购买不得使用
|
||||||
|
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
|
||||||
|
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
|
||||||
|
*/
|
||||||
|
package co.yixiang.modules.product.domain;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.bean.copier.CopyOptions;
|
||||||
|
import co.yixiang.domain.BaseDomain;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
|
||||||
|
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hupeng
|
||||||
|
* @date 2020-06-28
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName(value = "yx_store_product_rule",autoResultMap = true)
|
||||||
|
public class YxStoreProductRule extends BaseDomain {
|
||||||
|
|
||||||
|
@TableId
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
|
||||||
|
/** 规格名称 */
|
||||||
|
@NotBlank
|
||||||
|
private String ruleName;
|
||||||
|
|
||||||
|
|
||||||
|
/** 规格值 */
|
||||||
|
@TableField(typeHandler = FastjsonTypeHandler.class)
|
||||||
|
@NotNull
|
||||||
|
private JSONArray ruleValue;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void copy(YxStoreProductRule source){
|
||||||
|
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,49 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (C) 2018-2020
|
||||||
|
* All rights reserved, Designed By www.yixiang.co
|
||||||
|
* 注意:
|
||||||
|
* 本软件为www.yixiang.co开发研制,未经购买不得使用
|
||||||
|
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
|
||||||
|
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
|
||||||
|
*/
|
||||||
|
package co.yixiang.modules.product.service;
|
||||||
|
|
||||||
|
import co.yixiang.common.service.BaseService;
|
||||||
|
import co.yixiang.modules.product.domain.YxStoreProductRule;
|
||||||
|
import co.yixiang.modules.product.service.dto.YxStoreProductRuleDto;
|
||||||
|
import co.yixiang.modules.product.service.dto.YxStoreProductRuleQueryCriteria;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.List;
|
||||||
|
import java.io.IOException;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hupeng
|
||||||
|
* @date 2020-06-28
|
||||||
|
*/
|
||||||
|
public interface YxStoreProductRuleService extends BaseService<YxStoreProductRule> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询数据分页
|
||||||
|
* @param criteria 条件
|
||||||
|
* @param pageable 分页参数
|
||||||
|
* @return Map<String,Object>
|
||||||
|
*/
|
||||||
|
Map<String,Object> queryAll(YxStoreProductRuleQueryCriteria criteria, Pageable pageable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有数据不分页
|
||||||
|
* @param criteria 条件参数
|
||||||
|
* @return List<YxStoreProductRuleDto>
|
||||||
|
*/
|
||||||
|
List<YxStoreProductRule> queryAll(YxStoreProductRuleQueryCriteria criteria);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出数据
|
||||||
|
* @param all 待导出的数据
|
||||||
|
* @param response /
|
||||||
|
* @throws IOException /
|
||||||
|
*/
|
||||||
|
void download(List<YxStoreProductRuleDto> all, HttpServletResponse response) throws IOException;
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (C) 2018-2020
|
||||||
|
* All rights reserved, Designed By www.yixiang.co
|
||||||
|
* 注意:
|
||||||
|
* 本软件为www.yixiang.co开发研制,未经购买不得使用
|
||||||
|
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
|
||||||
|
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
|
||||||
|
*/
|
||||||
|
package co.yixiang.modules.product.service.dto;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import lombok.Data;
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hupeng
|
||||||
|
* @date 2020-06-28
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class YxStoreProductRuleDto implements Serializable {
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/** 规格名称 */
|
||||||
|
private String ruleName;
|
||||||
|
|
||||||
|
/** 规格值 */
|
||||||
|
private JSONArray ruleValue;
|
||||||
|
|
||||||
|
private Timestamp createTime;
|
||||||
|
|
||||||
|
private Timestamp updateTime;
|
||||||
|
|
||||||
|
private Integer isDel;
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (C) 2018-2020
|
||||||
|
* All rights reserved, Designed By www.yixiang.co
|
||||||
|
* 注意:
|
||||||
|
* 本软件为www.yixiang.co开发研制,未经购买不得使用
|
||||||
|
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
|
||||||
|
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
|
||||||
|
*/
|
||||||
|
package co.yixiang.modules.product.service.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import java.util.List;
|
||||||
|
import co.yixiang.annotation.Query;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hupeng
|
||||||
|
* @date 2020-06-28
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class YxStoreProductRuleQueryCriteria{
|
||||||
|
}
|
@ -0,0 +1,88 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (C) 2018-2020
|
||||||
|
* All rights reserved, Designed By www.yixiang.co
|
||||||
|
* 注意:
|
||||||
|
* 本软件为www.yixiang.co开发研制,未经购买不得使用
|
||||||
|
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
|
||||||
|
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
|
||||||
|
*/
|
||||||
|
package co.yixiang.modules.product.service.impl;
|
||||||
|
|
||||||
|
import co.yixiang.common.service.impl.BaseServiceImpl;
|
||||||
|
import co.yixiang.common.utils.QueryHelpPlus;
|
||||||
|
|
||||||
|
import co.yixiang.modules.product.domain.YxStoreProductRule;
|
||||||
|
import co.yixiang.modules.product.service.YxStoreProductRuleService;
|
||||||
|
import co.yixiang.modules.product.service.dto.YxStoreProductRuleDto;
|
||||||
|
import co.yixiang.modules.product.service.dto.YxStoreProductRuleQueryCriteria;
|
||||||
|
import co.yixiang.modules.product.service.mapper.YxStoreProductRuleMapper;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import co.yixiang.dozer.service.IGenerator;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
|
||||||
|
import co.yixiang.utils.ValidationUtil;
|
||||||
|
import co.yixiang.utils.FileUtil;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Propagation;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
// 默认不使用缓存
|
||||||
|
//import org.springframework.cache.annotation.CacheConfig;
|
||||||
|
//import org.springframework.cache.annotation.CacheEvict;
|
||||||
|
//import org.springframework.cache.annotation.Cacheable;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.io.IOException;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hupeng
|
||||||
|
* @date 2020-06-28
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@AllArgsConstructor
|
||||||
|
//@CacheConfig(cacheNames = "yxStoreProductRule")
|
||||||
|
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||||
|
public class YxStoreProductRuleServiceImpl extends BaseServiceImpl<YxStoreProductRuleMapper, YxStoreProductRule> implements YxStoreProductRuleService {
|
||||||
|
|
||||||
|
private final IGenerator generator;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
//@Cacheable
|
||||||
|
public Map<String, Object> queryAll(YxStoreProductRuleQueryCriteria criteria, Pageable pageable) {
|
||||||
|
getPage(pageable);
|
||||||
|
PageInfo<YxStoreProductRule> page = new PageInfo<>(queryAll(criteria));
|
||||||
|
Map<String, Object> map = new LinkedHashMap<>(2);
|
||||||
|
map.put("content", generator.convert(page.getList(), YxStoreProductRuleDto.class));
|
||||||
|
map.put("totalElements", page.getTotal());
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
//@Cacheable
|
||||||
|
public List<YxStoreProductRule> queryAll(YxStoreProductRuleQueryCriteria criteria){
|
||||||
|
return baseMapper.selectList(QueryHelpPlus.getPredicate(YxStoreProductRule.class, criteria));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void download(List<YxStoreProductRuleDto> all, HttpServletResponse response) throws IOException {
|
||||||
|
List<Map<String, Object>> list = new ArrayList<>();
|
||||||
|
for (YxStoreProductRuleDto yxStoreProductRule : all) {
|
||||||
|
Map<String,Object> map = new LinkedHashMap<>();
|
||||||
|
map.put("规格名称", yxStoreProductRule.getRuleName());
|
||||||
|
map.put("规格值", yxStoreProductRule.getRuleValue());
|
||||||
|
map.put(" createTime", yxStoreProductRule.getCreateTime());
|
||||||
|
map.put(" updateTime", yxStoreProductRule.getUpdateTime());
|
||||||
|
map.put(" isDel", yxStoreProductRule.getIsDel());
|
||||||
|
list.add(map);
|
||||||
|
}
|
||||||
|
FileUtil.downloadExcel(list, response);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (C) 2018-2020
|
||||||
|
* All rights reserved, Designed By www.yixiang.co
|
||||||
|
* 注意:
|
||||||
|
* 本软件为www.yixiang.co开发研制,未经购买不得使用
|
||||||
|
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
|
||||||
|
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
|
||||||
|
*/
|
||||||
|
package co.yixiang.modules.product.service.mapper;
|
||||||
|
|
||||||
|
|
||||||
|
import co.yixiang.common.mapper.CoreMapper;
|
||||||
|
import co.yixiang.modules.product.domain.YxStoreProductRule;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hupeng
|
||||||
|
* @date 2020-06-28
|
||||||
|
*/
|
||||||
|
@Repository
|
||||||
|
public interface YxStoreProductRuleMapper extends CoreMapper<YxStoreProductRule> {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,86 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (C) 2018-2020
|
||||||
|
* All rights reserved, Designed By www.yixiang.co
|
||||||
|
* 注意:
|
||||||
|
* 本软件为www.yixiang.co开发研制,未经购买不得使用
|
||||||
|
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
|
||||||
|
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
|
||||||
|
*/
|
||||||
|
package co.yixiang.modules.product.rest;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import co.yixiang.dozer.service.IGenerator;
|
||||||
|
import co.yixiang.modules.product.domain.YxStoreProductRule;
|
||||||
|
import co.yixiang.modules.product.service.YxStoreProductRuleService;
|
||||||
|
import co.yixiang.modules.product.service.dto.YxStoreProductRuleDto;
|
||||||
|
import co.yixiang.modules.product.service.dto.YxStoreProductRuleQueryCriteria;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import co.yixiang.logging.aop.log.Log;
|
||||||
|
|
||||||
|
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 io.swagger.annotations.*;
|
||||||
|
import java.io.IOException;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hupeng
|
||||||
|
* @date 2020-06-28
|
||||||
|
*/
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Api(tags = "sku规则管理")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/yxStoreProductRule")
|
||||||
|
public class StoreProductRuleController {
|
||||||
|
|
||||||
|
private final YxStoreProductRuleService yxStoreProductRuleService;
|
||||||
|
private final IGenerator generator;
|
||||||
|
|
||||||
|
|
||||||
|
@Log("导出数据")
|
||||||
|
@ApiOperation("导出数据")
|
||||||
|
@GetMapping(value = "/download")
|
||||||
|
@PreAuthorize("@el.check('admin','yxStoreProductRule:list')")
|
||||||
|
public void download(HttpServletResponse response, YxStoreProductRuleQueryCriteria criteria) throws IOException {
|
||||||
|
yxStoreProductRuleService.download(generator.convert(yxStoreProductRuleService.queryAll(criteria), YxStoreProductRuleDto.class), response);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
@Log("查询sku规则")
|
||||||
|
@ApiOperation("查询sku规则")
|
||||||
|
@PreAuthorize("@el.check('admin','yxStoreProductRule:list')")
|
||||||
|
public ResponseEntity<Object> getYxStoreProductRules(YxStoreProductRuleQueryCriteria criteria, Pageable pageable){
|
||||||
|
return new ResponseEntity<>(yxStoreProductRuleService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
@Log("新增sku规则")
|
||||||
|
@ApiOperation("新增sku规则")
|
||||||
|
@PreAuthorize("@el.check('admin','yxStoreProductRule:add')")
|
||||||
|
public ResponseEntity<Object> create(@Validated @RequestBody YxStoreProductRule resources){
|
||||||
|
return new ResponseEntity<>(yxStoreProductRuleService.save(resources),HttpStatus.CREATED);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping
|
||||||
|
@Log("修改sku规则")
|
||||||
|
@ApiOperation("修改sku规则")
|
||||||
|
@PreAuthorize("@el.check('admin','yxStoreProductRule:edit')")
|
||||||
|
public ResponseEntity<Object> update(@Validated @RequestBody YxStoreProductRule resources){
|
||||||
|
yxStoreProductRuleService.updateById(resources);
|
||||||
|
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log("删除sku规则")
|
||||||
|
@ApiOperation("删除sku规则")
|
||||||
|
@PreAuthorize("@el.check('admin','yxStoreProductRule:del')")
|
||||||
|
@DeleteMapping
|
||||||
|
public ResponseEntity<Object> deleteAll(@RequestBody Integer[] ids) {
|
||||||
|
Arrays.asList(ids).forEach(id->{
|
||||||
|
yxStoreProductRuleService.removeById(id);
|
||||||
|
});
|
||||||
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user