Commit 978eab79 authored by shiyu's avatar shiyu

裁剪记录

parent 19040b44
...@@ -6,6 +6,7 @@ import com.wwdz.ch.admin.service.ItemService; ...@@ -6,6 +6,7 @@ import com.wwdz.ch.admin.service.ItemService;
import com.wwdz.ch.admin.util.AuthSupport; import com.wwdz.ch.admin.util.AuthSupport;
import com.wwdz.ch.core.type.Result; import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.db.dto.request.CoinRequestDto; import com.wwdz.ch.db.dto.request.CoinRequestDto;
import com.wwdz.ch.db.dto.request.CroppingRecordRequestDto;
import com.xxdxxs.utils.JsonUtils; import com.xxdxxs.utils.JsonUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -29,7 +30,7 @@ public class ItemController { ...@@ -29,7 +30,7 @@ public class ItemController {
SynCoinJob synCoinJob; SynCoinJob synCoinJob;
// @RequiresPermissions("admin:item:findDetail") // @RequiresPermissions("admin:item:findDetail")
@RequiresPermissionsDesc(menu = { "钱币列表", "钱币明细" }, button = "查询") @RequiresPermissionsDesc(menu = { "商品列表", "钱币明细" }, button = "查询")
@PostMapping("/findDetail") @PostMapping("/findDetail")
public Result findDetail(@RequestBody CoinRequestDto coinRequestDto) { public Result findDetail(@RequestBody CoinRequestDto coinRequestDto) {
logger.info("【请求开始】操作人:[" + AuthSupport.userName()+ "] 钱币列表->钱币明细->查询,请求参数:parma:{}", coinRequestDto); logger.info("【请求开始】操作人:[" + AuthSupport.userName()+ "] 钱币列表->钱币明细->查询,请求参数:parma:{}", coinRequestDto);
...@@ -40,7 +41,7 @@ public class ItemController { ...@@ -40,7 +41,7 @@ public class ItemController {
// @RequiresPermissions("admin:item:setCoin") // @RequiresPermissions("admin:item:setCoin")
@RequiresPermissionsDesc(menu = { "钱币列表", "钱币设置" }, button = "更新") @RequiresPermissionsDesc(menu = { "商品列表", "钱币设置" }, button = "更新")
@PostMapping("/setItem") @PostMapping("/setItem")
public Result setItem(@RequestBody CoinRequestDto coinRequestDto) { public Result setItem(@RequestBody CoinRequestDto coinRequestDto) {
logger.info("【请求开始】操作人:[" + AuthSupport.userName()+ "] 钱币列表->钱币设置->更新,请求参数:parma:{}", coinRequestDto); logger.info("【请求开始】操作人:[" + AuthSupport.userName()+ "] 钱币列表->钱币设置->更新,请求参数:parma:{}", coinRequestDto);
...@@ -51,7 +52,14 @@ public class ItemController { ...@@ -51,7 +52,14 @@ public class ItemController {
@RequiresPermissionsDesc(menu = { "商品列表", "图片裁剪记录保存" }, button = "新增")
@PostMapping("/saveCroppingRecord")
public Result saveCroppingRecord(@RequestBody CroppingRecordRequestDto croppingRecordRequestDto) {
logger.info("【请求开始】操作人:[" + AuthSupport.userName()+ "] 商品列表->图片裁剪记录保存->新增,请求参数:parma:{}", croppingRecordRequestDto);
Result result = itemService.saveCroppingRecord(croppingRecordRequestDto);
logger.info("【请求结束】商品列表->图片裁剪记录保存->新增");
return result;
}
// @GetMapping("/syn") // @GetMapping("/syn")
public void syn() { public void syn() {
......
...@@ -7,12 +7,15 @@ import com.wwdz.ch.admin.util.AuthSupport; ...@@ -7,12 +7,15 @@ import com.wwdz.ch.admin.util.AuthSupport;
import com.wwdz.ch.core.consts.CommonEnum; import com.wwdz.ch.core.consts.CommonEnum;
import com.wwdz.ch.core.storage.QiniuStorage; import com.wwdz.ch.core.storage.QiniuStorage;
import com.wwdz.ch.core.type.Result; import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.db.dao.CroppingRecordDao;
import com.wwdz.ch.db.domain.Category; import com.wwdz.ch.db.domain.Category;
import com.wwdz.ch.db.domain.CroppingRecord;
import com.wwdz.ch.db.domain.Item; import com.wwdz.ch.db.domain.Item;
import com.wwdz.ch.db.domain.OperateLog; import com.wwdz.ch.db.domain.OperateLog;
import com.wwdz.ch.db.dto.request.CoinRequestDto; import com.wwdz.ch.db.dto.request.CoinRequestDto;
import com.wwdz.ch.db.dao.CategoryManager; import com.wwdz.ch.db.dao.CategoryManager;
import com.wwdz.ch.db.dao.ItemManager; import com.wwdz.ch.db.dao.ItemManager;
import com.wwdz.ch.db.dto.request.CroppingRecordRequestDto;
import com.xxdxxs.utils.EntityMapper; import com.xxdxxs.utils.EntityMapper;
import com.xxdxxs.utils.JsonUtils; import com.xxdxxs.utils.JsonUtils;
import com.xxdxxs.utils.StringUtils; import com.xxdxxs.utils.StringUtils;
...@@ -43,6 +46,9 @@ public class ItemServiceImpl implements ItemService { ...@@ -43,6 +46,9 @@ public class ItemServiceImpl implements ItemService {
@Autowired @Autowired
CategoryManager categoryManager; CategoryManager categoryManager;
@Autowired
CroppingRecordDao croppingRecordDao;
@Override @Override
public List<CoinVo> findList(CoinRequestDto coinRequestDto) { public List<CoinVo> findList(CoinRequestDto coinRequestDto) {
try { try {
...@@ -154,6 +160,19 @@ public class ItemServiceImpl implements ItemService { ...@@ -154,6 +160,19 @@ public class ItemServiceImpl implements ItemService {
return Result.success(); return Result.success();
} }
@Override
public Result saveCroppingRecord(CroppingRecordRequestDto croppingRecordRequestDto) {
try {
CroppingRecord croppingRecord = new CroppingRecord();
EntityMapper.copyAttribute(croppingRecordRequestDto, croppingRecord);
croppingRecordDao.insert(croppingRecord);
} catch (Exception e) {
logger.error("保存裁剪记录 error :{}", e);
return Result.failed();
}
return Result.success();
}
public CoinVo convertEntity(Item item) { public CoinVo convertEntity(Item item) {
try { try {
CoinVo coinVo = new CoinVo(); CoinVo coinVo = new CoinVo();
......
...@@ -3,6 +3,8 @@ package com.wwdz.ch.admin.service; ...@@ -3,6 +3,8 @@ package com.wwdz.ch.admin.service;
import com.wwdz.ch.admin.entity.vo.CoinVo; import com.wwdz.ch.admin.entity.vo.CoinVo;
import com.wwdz.ch.core.type.Result; import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.db.dto.request.CoinRequestDto; import com.wwdz.ch.db.dto.request.CoinRequestDto;
import com.wwdz.ch.db.dto.request.CroppingRecordRequestDto;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List; import java.util.List;
...@@ -13,4 +15,11 @@ public interface ItemService { ...@@ -13,4 +15,11 @@ public interface ItemService {
Result findDetails(CoinRequestDto coinRequestDto); Result findDetails(CoinRequestDto coinRequestDto);
Result setItem(CoinRequestDto coinRequestDto); Result setItem(CoinRequestDto coinRequestDto);
/**
* 保存图片裁剪记录
* @param croppingRecordRequestDto
* @return
*/
Result saveCroppingRecord(CroppingRecordRequestDto croppingRecordRequestDto);
} }
package com.wwdz.ch.db.dao;
import com.wwdz.ch.db.domain.CroppingRecord;
public interface CroppingRecordDao {
boolean insert(CroppingRecord croppingRecord);
}
package com.wwdz.ch.db.dao.impl;
import com.wwdz.ch.db.dao.CroppingRecordDao;
import com.wwdz.ch.db.domain.CroppingRecord;
import com.wwdz.ch.db.mapper.CroppingRecordMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.Date;
@Repository
public class CroppingRecordDaoImpl implements CroppingRecordDao {
@Autowired
CroppingRecordMapper croppingRecordMapper;
@Override
public boolean insert(CroppingRecord croppingRecord) {
croppingRecord.setCreateTime(new Date());
int num = croppingRecordMapper.insert(croppingRecord);
return num > 0;
}
}
package com.wwdz.ch.db.domain;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import com.xxdxxs.entity.Entity;
import lombok.Data;
/**
* @author shiyu
* @date 2023/08/04
*/
@Data
public class CroppingRecord implements Entity {
private Integer id;
/**
* 商品id
*/
private Long itemId;
/**
* 裁剪坐标
*/
private String coordinate;
/**
* 原始图片地址
*/
private String imageUrl;
/**
* 创建时间
*/
private Date createTime;
private static final long serialVersionUID = 1L;
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", itemId=").append(itemId);
sb.append(", coordinate=").append(coordinate);
sb.append(", imageUrl=").append(imageUrl);
sb.append(", createTime=").append(createTime);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
CroppingRecord other = (CroppingRecord) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getItemId() == null ? other.getItemId() == null : this.getItemId().equals(other.getItemId()))
&& (this.getCoordinate() == null ? other.getCoordinate() == null : this.getCoordinate().equals(other.getCoordinate()))
&& (this.getImageUrl() == null ? other.getImageUrl() == null : this.getImageUrl().equals(other.getImageUrl()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getItemId() == null) ? 0 : getItemId().hashCode());
result = prime * result + ((getCoordinate() == null) ? 0 : getCoordinate().hashCode());
result = prime * result + ((getImageUrl() == null) ? 0 : getImageUrl().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
return result;
}
/**
* This enum was generated by MyBatis Generator.
* This enum corresponds to the database table cropping_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public enum Column {
id("id", "id", "INTEGER", false),
itemId("item_id", "itemId", "BIGINT", false),
coordinate("coordinate", "coordinate", "VARCHAR", false),
imageUrl("image_url", "imageUrl", "VARCHAR", false),
createTime("create_time", "createTime", "TIMESTAMP", false);
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table cropping_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private static final String BEGINNING_DELIMITER = "`";
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table cropping_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private static final String ENDING_DELIMITER = "`";
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table cropping_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private final String column;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table cropping_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private final boolean isColumnNameDelimited;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table cropping_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private final String javaProperty;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table cropping_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private final String jdbcType;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table cropping_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String value() {
return this.column;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table cropping_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String getValue() {
return this.column;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table cropping_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String getJavaProperty() {
return this.javaProperty;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table cropping_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String getJdbcType() {
return this.jdbcType;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table cropping_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) {
this.column = column;
this.javaProperty = javaProperty;
this.jdbcType = jdbcType;
this.isColumnNameDelimited = isColumnNameDelimited;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table cropping_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String desc() {
return this.getEscapedColumnName() + " DESC";
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table cropping_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String asc() {
return this.getEscapedColumnName() + " ASC";
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table cropping_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public static Column[] excludes(Column ... excludes) {
ArrayList<Column> columns = new ArrayList<>(Arrays.asList(Column.values()));
if (excludes != null && excludes.length > 0) {
columns.removeAll(new ArrayList<>(Arrays.asList(excludes)));
}
return columns.toArray(new Column[]{});
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table cropping_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String getEscapedColumnName() {
if (this.isColumnNameDelimited) {
return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column).append(ENDING_DELIMITER).toString();
} else {
return this.column;
}
}
}
}
\ No newline at end of file
package com.wwdz.ch.db.dto.request;
import com.xxdxxs.entity.Entity;
import lombok.Data;
import java.util.Date;
@Data
public class CroppingRecordRequestDto extends BaseRequestDto implements Entity {
private Integer id;
/**
* 商品id
*/
private Long itemId;
/**
* 裁剪坐标
*/
private String coordinate;
/**
* 原始图片地址
*/
private String imageUrl;
/**
* 创建时间
*/
private Date createTime;
}
package com.wwdz.ch.db.mapper;
import com.wwdz.ch.db.domain.CroppingRecord;
import com.wwdz.ch.db.domain.CroppingRecordExample;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface CroppingRecordMapper {
long countByExample(CroppingRecordExample example);
int deleteByExample(CroppingRecordExample example);
int deleteByPrimaryKey(Integer id);
int insert(CroppingRecord record);
int insertSelective(CroppingRecord record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table cropping_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
CroppingRecord selectOneByExample(CroppingRecordExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table cropping_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
CroppingRecord selectOneByExampleSelective(@Param("example") CroppingRecordExample example, @Param("selective") CroppingRecord.Column ... selective);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table cropping_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
List<CroppingRecord> selectByExampleSelective(@Param("example") CroppingRecordExample example, @Param("selective") CroppingRecord.Column ... selective);
List<CroppingRecord> selectByExample(CroppingRecordExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table cropping_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
CroppingRecord selectByPrimaryKeySelective(@Param("id") Integer id, @Param("selective") CroppingRecord.Column ... selective);
CroppingRecord selectByPrimaryKey(Integer id);
int updateByExampleSelective(@Param("record") CroppingRecord record, @Param("example") CroppingRecordExample example);
int updateByExample(@Param("record") CroppingRecord record, @Param("example") CroppingRecordExample example);
int updateByPrimaryKeySelective(CroppingRecord record);
int updateByPrimaryKey(CroppingRecord record);
}
\ No newline at end of file
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