Commit 155bd764 authored by xiaoyao's avatar xiaoyao

fix

parent 8522c7f6
...@@ -16,6 +16,18 @@ ...@@ -16,6 +16,18 @@
</properties> </properties>
<dependencies> <dependencies>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
<dependency> <dependency>
<groupId>com.wwdz</groupId> <groupId>com.wwdz</groupId>
<artifactId>ch-core</artifactId> <artifactId>ch-core</artifactId>
......
package com.wwdz.ch.admin.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import java.util.ArrayList;
@Configuration
@EnableSwagger2
public class SwaggerConfig {
@Bean
public Docket docket(Environment environment) {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.select()
//指定包名 basePackage
.apis(RequestHandlerSelectors.basePackage("com.wwdz.ch.admin.web"))
//再次过滤(根据接口过滤)
.paths(PathSelectors.any())
.build();
}
private ApiInfo apiInfo() {
//contact 维护接口人信息
Contact contact = new Contact("xiaoyao", "", "");
return new ApiInfo(
//标题
"泉库后端文档",
//描述
"增加注释,实时更新,在线测试",
//版本
"v1.0",
//服务条款网址
"urn:tos",
//维护人信息
contact,
//许可
"Apache 2.0",
//许可链接
"http://www.apache.org/licenses/LICENSE-2.0",
new ArrayList());
}
}
package com.wwdz.ch.admin.dao;
import com.qiniu.util.StringUtils;
import com.wwdz.ch.db.domain.BidRecord;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Arrays;
import java.util.List;
@ApiModel(value = "BidRecordVo", description = "成交记录前端交互VO")
public class BidRecordVo implements Serializable {
private static final long serialVersionUID = 4014894220574552837L;
@ApiModelProperty(value = "成交记录id", name = "id")
private Long id;
@ApiModelProperty(value = "购买人", name = "buyer")
private String buyer;
@ApiModelProperty(value = "购买平台", name = "platform")
private String platform;
@ApiModelProperty(value = "分类Id", name = "cid")
private Integer cid;
@ApiModelProperty(value = "图片", name = "images")
private List<String> images;
@ApiModelProperty(value = "成交时间", name = "bidtime")
private Integer bidtime;
@ApiModelProperty(value = "成交价格", name = "price")
private Long price;
public BidRecord toDo() {
BidRecord record = new BidRecord();
record.setBidtime(bidtime);
record.setBuyer(buyer);
record.setIsDeleted(false);
record.setCid(cid);
record.setImages(StringUtils.join(images, ";"));
record.setPlatform(platform);
record.setPrice(price);
record.setExtra("");
record.setLink("");
return record;
}
public BidRecordVo() {}
public BidRecordVo(BidRecord record) {
this.id = record.getId();
this.cid = record.getCid();
this.images = Arrays.asList(record.getImages().split(";"));
this.bidtime = record.getBidtime();
this.price = record.getPrice();
this.buyer = record.getBuyer();
this.platform = record.getPlatform();
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getBuyer() {
return buyer;
}
public void setBuyer(String buyer) {
this.buyer = buyer;
}
public String getPlatform() {
return platform;
}
public void setPlatform(String platform) {
this.platform = platform;
}
public Integer getCid() {
return cid;
}
public void setCid(Integer cid) {
this.cid = cid;
}
public List<String> getImages() {
return images;
}
public void setImages(List<String> images) {
this.images = images;
}
public Integer getBidtime() {
return bidtime;
}
public void setBidtime(Integer bidtime) {
this.bidtime = bidtime;
}
public Long getPrice() {
return price;
}
public void setPrice(Long price) {
this.price = price;
}
}
...@@ -2,6 +2,8 @@ package com.wwdz.ch.admin.dao; ...@@ -2,6 +2,8 @@ package com.wwdz.ch.admin.dao;
import com.alibaba.druid.support.json.JSONUtils; import com.alibaba.druid.support.json.JSONUtils;
import com.wwdz.ch.db.domain.Category; import com.wwdz.ch.db.domain.Category;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.io.Serializable; import java.io.Serializable;
...@@ -9,86 +11,98 @@ import java.util.HashMap; ...@@ -9,86 +11,98 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ApiModel
public class CategoryVo implements Serializable { public class CategoryVo implements Serializable {
private static final long serialVersionUID = 96458407347975312L; private static final long serialVersionUID = 96458407347975312L;
/** @ApiModelProperty(value = "分类Id")
* 类目ID
*/
private Integer id; private Integer id;
/** @ApiModelProperty(value = "分类名称")
* 类目名称
*/
private String name; private String name;
/** @ApiModelProperty(value = "分类图片")
* 类目图标
*/
private String icon; private String icon;
/** @ApiModelProperty(value = "父类目ID")
* 父类目id
*/
private Integer pid; private Integer pid;
/** @ApiModelProperty(value = "层级")
* 层级
*/
private Integer level; private Integer level;
/** @ApiModelProperty(value = "描述")
* 描述
*/
private String desc; private String desc;
/** @ApiModelProperty(value = "面值")
* 铸造时间 private String parValue;
*/
@ApiModelProperty(value = "命名来源")
private String nameSrc;
@ApiModelProperty(value = "造币厂")
private String mint;
@ApiModelProperty(value = "铸造时间")
private String publishTime; private String publishTime;
/** @ApiModelProperty(value = "铸造者")
* 铸造者
*/
private String publisher; private String publisher;
/** @ApiModelProperty(value = "王朝")
* 王朝
*/
private String dynasty; private String dynasty;
/** @ApiModelProperty(value = "品种代码")
* 品种代码
*/
private String serialNo; private String serialNo;
/** @ApiModelProperty(value = "分类路径")
* 分类
*/
private String categoryPath; private String categoryPath;
/** @ApiModelProperty(value = "扩展名称")
* 扩展名称
*/
private String extendName; private String extendName;
/** @ApiModelProperty(value = "材质")
* 直径 (mm * 100) private String material;
*/
@ApiModelProperty(value = "直径 (mm * 100)")
private Integer diameter; private Integer diameter;
/** @ApiModelProperty(value = " 厚度 (mm * 100)")
* 厚度 (mm * 100)
*/
private Integer thickness; private Integer thickness;
@ApiModelProperty(value = "重量 (g * 100)")
private Integer weight;
@ApiModelProperty(value = "合金成分分析表图片路径")
private String caTableImage;
@ApiModelProperty(value = "是否叶子节点")
private Boolean isLeaf;
@ApiModelProperty(value = "存世量")
private Integer exiQuantity;
/** /**
*重量 (g * 100) * 子类目
*/ */
private Integer weight; private List<CategoryVo> children;
public String getCaTableImage() {
return caTableImage;
}
public void setCaTableImage(String caTableImage) {
this.caTableImage = caTableImage;
}
public Boolean getLeaf() { public Boolean getLeaf() {
return isLeaf; return isLeaf;
...@@ -98,42 +112,37 @@ public class CategoryVo implements Serializable { ...@@ -98,42 +112,37 @@ public class CategoryVo implements Serializable {
isLeaf = leaf; isLeaf = leaf;
} }
/** public String getParValue() {
* 是否叶子节点 return parValue;
*/ }
private Boolean isLeaf;
/** public void setParValue(String parValue) {
* 当前所有人(传承链这块还要重新设计,暂时只存当前拥有人) this.parValue = parValue;
*/ }
private String owner;
/** public String getNameSrc() {
* 面值 return nameSrc;
*/ }
private String parValue;
/** public void setNameSrc(String nameSrc) {
* 存世量 this.nameSrc = nameSrc;
*/ }
private String exiQuantity;
/** public String getMint() {
* 材质 return mint;
*/ }
private String material;
/** public void setMint(String mint) {
* 详细图片 this.mint = mint;
*/ }
private String images;
public String getMaterial() {
return material;
}
/** public void setMaterial(String material) {
* 子类目 this.material = material;
*/ }
private List<CategoryVo> children;
public CategoryVo(){} public CategoryVo(){}
...@@ -149,18 +158,18 @@ public class CategoryVo implements Serializable { ...@@ -149,18 +158,18 @@ public class CategoryVo implements Serializable {
Map<String, Object> extraData = (Map<String, Object>) JSONUtils.parse(category.getExtra()); Map<String, Object> extraData = (Map<String, Object>) JSONUtils.parse(category.getExtra());
this.publishTime = extractExtra(extraData, "publishTime"); this.publishTime = extractExtra(extraData, "publishTime");
this.publisher = extractExtra(extraData, "publisher"); this.publisher = extractExtra(extraData, "publisher");
this.exiQuantity = extractExtra(extraData, "exiQuantity"); this.exiQuantity = extractExtraInt(extraData, "exiQuantity");
this.parValue = extractExtra(extraData, "parValue");
this.material = extractExtra(extraData, "material");
this.images = extractExtra(extraData, "images");
this.dynasty = extractExtra(extraData, "dynasty"); this.dynasty = extractExtra(extraData, "dynasty");
this.diameter = extractExtraInt(extraData, "diameter"); this.diameter = extractExtraInt(extraData, "diameter");
this.thickness = extractExtraInt(extraData, "thickness"); this.thickness = extractExtraInt(extraData, "thickness");
this.weight = extractExtraInt(extraData, "weight"); this.weight = extractExtraInt(extraData, "weight");
this.owner = extractExtra(extraData, "owner");
this.extendName = extractExtra(extraData, "extendName"); this.extendName = extractExtra(extraData, "extendName");
this.serialNo = extractExtra(extraData, "serialNo"); this.serialNo = extractExtra(extraData, "serialNo");
this.caTableImage = extractExtra(extraData, "caTableImage");
this.nameSrc = extractExtra(extraData, "nameSrc");
this.mint = extractExtra(extraData, "mint");
this.parValue = extractExtra(extraData, "parValue");
this.material = extractExtra(extraData, "material");
} }
} }
...@@ -236,37 +245,14 @@ public class CategoryVo implements Serializable { ...@@ -236,37 +245,14 @@ public class CategoryVo implements Serializable {
this.publisher = publisher; this.publisher = publisher;
} }
public String getParValue() { public Integer getExiQuantity() {
return parValue;
}
public void setParValue(String parValue) {
this.parValue = parValue;
}
public String getExiQuantity() {
return exiQuantity; return exiQuantity;
} }
public void setExiQuantity(String exiQuantity) { public void setExiQuantity(Integer exiQuantity) {
this.exiQuantity = exiQuantity; this.exiQuantity = exiQuantity;
} }
public String getMaterial() {
return material;
}
public void setMaterial(String material) {
this.material = material;
}
public String getImages() {
return images;
}
public void setImages(String images) {
this.images = images;
}
public String getDynasty() { public String getDynasty() {
return dynasty; return dynasty;
...@@ -324,14 +310,6 @@ public class CategoryVo implements Serializable { ...@@ -324,14 +310,6 @@ public class CategoryVo implements Serializable {
this.weight = weight; this.weight = weight;
} }
public String getOwner() {
return owner;
}
public void setOwner(String owner) {
this.owner = owner;
}
private String extractExtra(Map<String, Object> extraData, String key) { private String extractExtra(Map<String, Object> extraData, String key) {
if (null != extraData.get(key)) { if (null != extraData.get(key)) {
return extraData.get(key).toString(); return extraData.get(key).toString();
...@@ -340,7 +318,7 @@ public class CategoryVo implements Serializable { ...@@ -340,7 +318,7 @@ public class CategoryVo implements Serializable {
} }
private Integer extractExtraInt(Map<String, Object> extraData, String key) { private Integer extractExtraInt(Map<String, Object> extraData, String key) {
if (null != extraData.get(key)) { if (!StringUtils.isEmpty(extraData.get(key))) {
return Integer.valueOf(extraData.get(key).toString()); return Integer.valueOf(extraData.get(key).toString());
} }
return null; return null;
...@@ -362,17 +340,18 @@ public class CategoryVo implements Serializable { ...@@ -362,17 +340,18 @@ public class CategoryVo implements Serializable {
Map<String, Object> extraObj = new HashMap<>(); Map<String, Object> extraObj = new HashMap<>();
extraObj.put("publishTime", this.publishTime); extraObj.put("publishTime", this.publishTime);
extraObj.put("publisher", this.publisher); extraObj.put("publisher", this.publisher);
extraObj.put("parValue", this.parValue);
extraObj.put("exiQuantity", this.exiQuantity); extraObj.put("exiQuantity", this.exiQuantity);
extraObj.put("material", this.material); extraObj.put("mint", this.mint);
extraObj.put("images", this.images); extraObj.put("parValue", this.parValue);
extraObj.put("owner", this.owner); extraObj.put("nameSrc",this.nameSrc);
extraObj.put("caTableImage", this.caTableImage);
extraObj.put("diameter", this.diameter); extraObj.put("diameter", this.diameter);
extraObj.put("dynasty", this.dynasty); extraObj.put("dynasty", this.dynasty);
extraObj.put("extendName", this.extendName); extraObj.put("extendName", this.extendName);
extraObj.put("serialNo", this.serialNo); extraObj.put("serialNo", this.serialNo);
extraObj.put("thickness", this.thickness); extraObj.put("thickness", this.thickness);
extraObj.put("weight", this.weight); extraObj.put("weight", this.weight);
extraObj.put("material", this.material);
return JSONUtils.toJSONString(extraObj); return JSONUtils.toJSONString(extraObj);
} }
} }
package com.wwdz.ch.admin.web;
import com.wwdz.ch.admin.dao.BidRecordVo;
import com.wwdz.ch.admin.util.AuthSupport;
import com.wwdz.ch.core.type.ListResult;
import com.wwdz.ch.core.type.SimpleResult;
import com.wwdz.ch.db.domain.BidRecord;
import com.wwdz.ch.db.service.BidRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.stream.Collectors;
@RestController
@RequestMapping("/admin/bidrecord")
@Validated
@Api
public class BidRecordController {
private static final Logger logger = LoggerFactory.getLogger(CategoryController.class);
@Autowired
private BidRecordService bidRecordService;
// @RequiresPermissions("admin:category:list")
// @RequiresPermissionsDesc(menu = { "商场管理", "成交记录管理" }, button = "查询")
@GetMapping("/list")
@ApiOperation(value = "成交记录列表")
public ListResult<BidRecordVo> list(@ApiParam("分类id") Integer cid) {
logger.info("【请求开始】操作人:[" + AuthSupport.userName()+ "] 商场管理->成交记录->查询,请求参数:cid:{}", cid);
List<BidRecord> collectList = bidRecordService.queryByCid(cid);
List<BidRecordVo> data = collectList.parallelStream().map(a -> new BidRecordVo(a)).collect(Collectors.toList());
return new ListResult<BidRecordVo>(data, data.size());
}
@PostMapping("/add")
@ApiOperation(value = "添加成交记录")
public SimpleResult<Boolean> add(@ApiParam("成交记录数据") @RequestBody BidRecordVo record) {
bidRecordService.add(record.toDo());
return new SimpleResult<>(true);
}
@GetMapping("/delete")
@ApiOperation(value = "删除成交记录")
public SimpleResult<Boolean> delete(@ApiParam("成交记录ID") @NotNull Long id) {
bidRecordService.deleteById(id);
return new SimpleResult<>(true);
}
}
package com.wwdz.ch.admin.web; package com.wwdz.ch.admin.web;
import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import com.wwdz.ch.admin.annotation.RequiresPermissionsDesc; import com.wwdz.ch.admin.annotation.RequiresPermissionsDesc;
import com.wwdz.ch.admin.dao.CategoryVo; import com.wwdz.ch.admin.dao.CategoryVo;
import com.wwdz.ch.admin.util.AuthSupport; import com.wwdz.ch.admin.util.AuthSupport;
import com.wwdz.ch.admin.util.CatVo; import com.wwdz.ch.core.type.ListResult;
import com.wwdz.ch.db.domain.Category; import com.wwdz.ch.db.domain.Category;
import com.wwdz.ch.db.service.CategoryService; import com.wwdz.ch.db.service.CategoryService;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -36,8 +37,8 @@ import com.wwdz.ch.db.domain.DtsCategory; ...@@ -36,8 +37,8 @@ import com.wwdz.ch.db.domain.DtsCategory;
@RestController @RestController
@RequestMapping("/admin/category") @RequestMapping("/admin/category")
@Validated @Validated
public class AdminCategoryController { public class CategoryController {
private static final Logger logger = LoggerFactory.getLogger(AdminCategoryController.class); private static final Logger logger = LoggerFactory.getLogger(CategoryController.class);
@Autowired @Autowired
private CategoryService categoryService; private CategoryService categoryService;
...@@ -45,26 +46,22 @@ public class AdminCategoryController { ...@@ -45,26 +46,22 @@ public class AdminCategoryController {
@RequiresPermissions("admin:category:list") @RequiresPermissions("admin:category:list")
@RequiresPermissionsDesc(menu = { "商场管理", "类目管理" }, button = "查询") @RequiresPermissionsDesc(menu = { "商场管理", "类目管理" }, button = "查询")
@GetMapping("/list") @GetMapping("/list")
public Object list(String id, String name, @RequestParam(defaultValue = "1") Integer page, public ListResult<CategoryVo> list(String id, String name, @RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer limit, @RequestParam(defaultValue = "10") Integer limit,
@Sort @RequestParam(defaultValue = "add_time") String sort, @Sort @RequestParam(defaultValue = "add_time") String sort,
@Order @RequestParam(defaultValue = "desc") String order) { @Order @RequestParam(defaultValue = "desc") String order) {
logger.info("【请求开始】操作人:[" + AuthSupport.userName()+ "] 商场管理->类目管理->查询,请求参数:name:{},page:{}", name, page); logger.info("【请求开始】操作人:[" + AuthSupport.userName()+ "] 商场管理->类目管理->查询,请求参数:name:{},page:{}", name, page);
List<Category> collectList = categoryService.querySelective(id, name, page, limit, sort, order); List<Category> collectList = categoryService.querySelective(id, name, page, limit, sort, order);
long total = PageInfo.of(collectList).getTotal(); List<CategoryVo> data = collectList.parallelStream().map(a -> new CategoryVo(a)).collect(Collectors.toList());
Map<String, Object> data = new HashMap<>();
data.put("total", total);
data.put("items", collectList);
logger.info("【请求结束】商场管理->类目管理->查询:total:{}", JSONObject.toJSONString(data)); logger.info("【请求结束】商场管理->类目管理->查询:total:{}", JSONObject.toJSONString(data));
return ResponseUtil.ok(data); return new ListResult<>(data, data.size());
} }
@RequiresPermissions("admin:category:tree") @RequiresPermissions("admin:category:tree")
@RequiresPermissionsDesc(menu = { "商场管理", "类目管理" }, button = "查询") @RequiresPermissionsDesc(menu = { "商场管理", "类目管理" }, button = "查询")
@GetMapping("/tree") @GetMapping("/tree")
public Object tree() { public ListResult<CategoryVo> tree() {
logger.info("【请求开始】操作人:[" + AuthSupport.userName()+ "] 查询类目树"); logger.info("【请求开始】操作人:[" + AuthSupport.userName()+ "] 查询类目树");
/** /**
* 获取最大深度 * 获取最大深度
...@@ -91,10 +88,8 @@ public class AdminCategoryController { ...@@ -91,10 +88,8 @@ public class AdminCategoryController {
--level; --level;
} }
Map<String, Object> data = new HashMap<>(); List<CategoryVo> data = parentCategoryMap.get(0);
data.put("categories", parentCategoryMap.get(0)); return new ListResult<>(data, data.size());
logger.info("【请求结束】查询类目树 : {}", JSONObject.toJSONString(data));
return ResponseUtil.ok(data);
} }
@RequiresPermissions("admin:category:tree") @RequiresPermissions("admin:category:tree")
...@@ -105,6 +100,8 @@ public class AdminCategoryController { ...@@ -105,6 +100,8 @@ public class AdminCategoryController {
List<CategoryVo> categoryVoList = new ArrayList<>(); List<CategoryVo> categoryVoList = new ArrayList<>();
List<Category> categoryList = categoryService.queryByPid(id); List<Category> categoryList = categoryService.queryByPid(id);
for (Category c : categoryList) { for (Category c : categoryList) {
CategoryVo categoryVo = new CategoryVo(c);
categoryVo.setCategoryPath(StringUtils.join(categoryService.getCategoryPath(c.getId()), ">"));
categoryVoList.add(new CategoryVo(c)); categoryVoList.add(new CategoryVo(c));
} }
Map<String, Object> data = new HashMap<>(); Map<String, Object> data = new HashMap<>();
......
package com.wwdz.ch.admin.web;
public class UgcCoinController {
}
package com.wwdz.ch.core.type;
import java.io.Serializable;
public abstract class BaseResult implements Serializable {
private static final long serialVersionUID = 8908837312876434915L;
protected Integer code = 1001;
protected boolean success = true;
protected String msg = "";
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public boolean isSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
}
package com.wwdz.ch.core.type;
import java.util.List;
public class ListResult<T> extends BaseResult{
private static final long serialVersionUID = 1534643254339611906L;
private Integer total;
/**
* 从1开始计数
*/
private Integer page;
private Integer size;
private List<T> data;
public ListResult(List<T> data, Integer total) {
this.data = data;
this.total = total;
this.page = 1;
this.size = total;
}
public ListResult(List<T> data, Integer total, Integer page, Integer size) {
this(data, total);
this.page = page;
this.size = size;
}
public Integer getTotal() {
return total;
}
public void setTotal(Integer total) {
this.total = total;
}
public Integer getPage() {
return page;
}
public void setPage(Integer page) {
this.page = page;
}
public Integer getSize() {
return size;
}
public void setSize(Integer size) {
this.size = size;
}
public List<T> getData() {
return data;
}
public void setData(List<T> data) {
this.data = data;
}
}
package com.wwdz.ch.core.type;
public class SimpleResult<T> extends BaseResult{
private static final long serialVersionUID = 4737633747704835886L;
private T data;
public SimpleResult(T data) {
this.data = data;
}
public T getData() {
return data;
}
public void setData(T data) {
this.data = data;
}
}
...@@ -125,13 +125,14 @@ pagehelper: ...@@ -125,13 +125,14 @@ pagehelper:
supportMethodsArguments: true supportMethodsArguments: true
params: count=countSql params: count=countSql
spring: spring:
datasource: datasource:
druid: druid:
url: jdbc:mysql://localhost:3306/dts-shop?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC&allowPublicKeyRetrieval=true&verifyServerCertificate=false&useSSL=false url: jdbc:mysql://101.37.172.120:3306/dts-shop?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC&allowPublicKeyRetrieval=true&verifyServerCertificate=false&useSSL=false
driver-class-name: com.mysql.jdbc.Driver driver-class-name: com.mysql.jdbc.Driver
username: root username: root
password: 12121212zmzm password: zhuangdian123
initial-size: 10 initial-size: 10
max-active: 50 max-active: 50
min-idle: 10 min-idle: 10
......
...@@ -56,15 +56,18 @@ ...@@ -56,15 +56,18 @@
<javaClientGenerator type="XMLMAPPER" targetPackage="com.wwdz.ch.db.dao" <javaClientGenerator type="XMLMAPPER" targetPackage="com.wwdz.ch.db.dao"
targetProject="src/main/java"/> targetProject="src/main/java"/>
<!--表名--> <!--表名-->
<table tableName="book"> <table tableName="ugc_coin">
<generatedKey column="id" sqlStatement="MySql" identity="true"/>
</table>
<table tableName="book_item">
<generatedKey column="id" sqlStatement="MySql" identity="true"/>
</table>
<table tableName="chain_node">
<generatedKey column="id" sqlStatement="MySql" identity="true"/> <generatedKey column="id" sqlStatement="MySql" identity="true"/>
</table> </table>
<!-- <table tableName="book">-->
<!-- <generatedKey column="id" sqlStatement="MySql" identity="true"/>-->
<!-- </table>-->
<!-- <table tableName="book_item">-->
<!-- <generatedKey column="id" sqlStatement="MySql" identity="true"/>-->
<!-- </table>-->
<!-- <table tableName="chain_node">-->
<!-- <generatedKey column="id" sqlStatement="MySql" identity="true"/>-->
<!-- </table>-->
<!-- <table tableName="dts_admin">--> <!-- <table tableName="dts_admin">-->
<!-- <generatedKey column="id" sqlStatement="MySql" identity="true"/>--> <!-- <generatedKey column="id" sqlStatement="MySql" identity="true"/>-->
<!-- <columnOverride column="role_ids" javaType="java.lang.Integer[]"--> <!-- <columnOverride column="role_ids" javaType="java.lang.Integer[]"-->
......
package com.wwdz.ch.db.dao;
import com.wwdz.ch.db.domain.BidRecord;
import com.wwdz.ch.db.domain.BidRecordExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface BidRecordMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table bid_record
*
* @mbg.generated
*/
long countByExample(BidRecordExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table bid_record
*
* @mbg.generated
*/
int deleteByExample(BidRecordExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table bid_record
*
* @mbg.generated
*/
int deleteByPrimaryKey(Long id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table bid_record
*
* @mbg.generated
*/
int insert(BidRecord record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table bid_record
*
* @mbg.generated
*/
int insertSelective(BidRecord record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table bid_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
BidRecord selectOneByExample(BidRecordExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table bid_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
BidRecord selectOneByExampleSelective(@Param("example") BidRecordExample example, @Param("selective") BidRecord.Column ... selective);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table bid_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
List<BidRecord> selectByExampleSelective(@Param("example") BidRecordExample example, @Param("selective") BidRecord.Column ... selective);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table bid_record
*
* @mbg.generated
*/
List<BidRecord> selectByExample(BidRecordExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table bid_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
BidRecord selectByPrimaryKeySelective(@Param("id") Long id, @Param("selective") BidRecord.Column ... selective);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table bid_record
*
* @mbg.generated
*/
BidRecord selectByPrimaryKey(Long id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table bid_record
*
* @mbg.generated
*/
int updateByExampleSelective(@Param("record") BidRecord record, @Param("example") BidRecordExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table bid_record
*
* @mbg.generated
*/
int updateByExample(@Param("record") BidRecord record, @Param("example") BidRecordExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table bid_record
*
* @mbg.generated
*/
int updateByPrimaryKeySelective(BidRecord record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table bid_record
*
* @mbg.generated
*/
int updateByPrimaryKey(BidRecord record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_category
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
int logicalDeleteByPrimaryKey(Long id);
}
\ No newline at end of file
package com.wwdz.ch.db.dao;
import com.wwdz.ch.db.domain.UgcCoin;
import com.wwdz.ch.db.domain.UgcCoinExample;
import com.wwdz.ch.db.domain.UgcCoinWithBLOBs;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface UgcCoinMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ugc_coin
*
* @mbg.generated
*/
long countByExample(UgcCoinExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ugc_coin
*
* @mbg.generated
*/
int deleteByExample(UgcCoinExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ugc_coin
*
* @mbg.generated
*/
int deleteByPrimaryKey(Long id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ugc_coin
*
* @mbg.generated
*/
int insert(UgcCoinWithBLOBs record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ugc_coin
*
* @mbg.generated
*/
int insertSelective(UgcCoinWithBLOBs record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ugc_coin
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
UgcCoin selectOneByExample(UgcCoinExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ugc_coin
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
UgcCoinWithBLOBs selectOneByExampleSelective(@Param("example") UgcCoinExample example, @Param("selective") UgcCoinWithBLOBs.Column ... selective);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ugc_coin
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
UgcCoinWithBLOBs selectOneByExampleWithBLOBs(UgcCoinExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ugc_coin
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
List<UgcCoinWithBLOBs> selectByExampleSelective(@Param("example") UgcCoinExample example, @Param("selective") UgcCoinWithBLOBs.Column ... selective);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ugc_coin
*
* @mbg.generated
*/
List<UgcCoinWithBLOBs> selectByExampleWithBLOBs(UgcCoinExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ugc_coin
*
* @mbg.generated
*/
List<UgcCoin> selectByExample(UgcCoinExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ugc_coin
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
UgcCoinWithBLOBs selectByPrimaryKeySelective(@Param("id") Long id, @Param("selective") UgcCoinWithBLOBs.Column ... selective);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ugc_coin
*
* @mbg.generated
*/
UgcCoinWithBLOBs selectByPrimaryKey(Long id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ugc_coin
*
* @mbg.generated
*/
int updateByExampleSelective(@Param("record") UgcCoinWithBLOBs record, @Param("example") UgcCoinExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ugc_coin
*
* @mbg.generated
*/
int updateByExampleWithBLOBs(@Param("record") UgcCoinWithBLOBs record, @Param("example") UgcCoinExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ugc_coin
*
* @mbg.generated
*/
int updateByExample(@Param("record") UgcCoin record, @Param("example") UgcCoinExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ugc_coin
*
* @mbg.generated
*/
int updateByPrimaryKeySelective(UgcCoinWithBLOBs record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ugc_coin
*
* @mbg.generated
*/
int updateByPrimaryKeyWithBLOBs(UgcCoinWithBLOBs record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ugc_coin
*
* @mbg.generated
*/
int updateByPrimaryKey(UgcCoin record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_category
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
int logicalDeleteByPrimaryKey(Long id);
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
package com.wwdz.ch.db.service;
import com.wwdz.ch.db.dao.BidRecordMapper;
import com.wwdz.ch.db.domain.BidRecord;
import com.wwdz.ch.db.domain.BidRecordExample;
import com.wwdz.ch.db.domain.Category;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
@Service
public class BidRecordService {
@Resource
private BidRecordMapper bidRecordMapper;
public void add(BidRecord record) {
record.setCreated(LocalDateTime.now());
record.setUpdated(LocalDateTime.now());
bidRecordMapper.insertSelective(record);
}
public int updateById(BidRecord record) {
record.setUpdated(LocalDateTime.now());
return bidRecordMapper.updateByPrimaryKeySelective(record);
}
public List<BidRecord> queryByCid(Integer cid) {
BidRecordExample example = new BidRecordExample();
example.createCriteria().andCidEqualTo(cid).andIsDeletedEqualTo(false);
example.setOrderByClause("created desc");
return bidRecordMapper.selectByExample(example);
}
public void deleteById(Long id) {
bidRecordMapper.logicalDeleteByPrimaryKey(id);
}
}
package com.wwdz.ch.db.service;
import com.github.pagehelper.PageHelper;
import com.wwdz.ch.db.dao.UgcCoinMapper;
import com.wwdz.ch.db.domain.*;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
@Service
public class UgcCoinService {
@Resource
private UgcCoinMapper ugcCoinMapper;
public List<UgcCoin> queryByUserId(Long userId, Integer page, Integer size) {
UgcCoinExample example = new UgcCoinExample();
example.or().andUidEqualTo(userId).andIsDeletedEqualTo(false);
page = null != page ? page : 1;
size = null != size ? size : 10;
PageHelper.startPage(page, size);
return ugcCoinMapper.selectByExample(example);
}
public void add(UgcCoinWithBLOBs coin) {
coin.setCreated(LocalDateTime.now());
coin.setUpdated(LocalDateTime.now());
ugcCoinMapper.insertSelective(coin);
}
public int updateById(UgcCoinWithBLOBs coin) {
coin.setUpdated(LocalDateTime.now());
return ugcCoinMapper.updateByPrimaryKeySelective(coin);
}
public void deleteById(Long id) {
ugcCoinMapper.logicalDeleteByPrimaryKey(id);
}
}
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment