Commit 586fc239 by tyfanchz

删除无用功能、产品列表和代码集相关功能开发

1 parent 97e9f958
Showing 39 changed files with 514 additions and 727 deletions
package com.glsx.smart.controller;
import java.util.List;
import com.alibaba.fastjson.JSON;
import com.github.pagehelper.PageInfo;
import com.glsx.smart.dao.entity.SmartProduct;
import com.glsx.smart.pojo.SmartProductReq;
import com.glsx.smart.service.SmartProductService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -19,12 +23,15 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/product")
public class ProductController {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private SmartProductService productService;
@RequestMapping(value = "/getList", method = {RequestMethod.GET, RequestMethod.POST})
public List<SmartProduct> getList(SmartProduct product) {
return productService.getList(product);
public PageInfo<SmartProduct> getList(SmartProductReq req) {
logger.info("/product/getList param: {}", JSON.toJSONString(req));
return productService.getList(req);
}
@RequestMapping(value = "/getById", method = {RequestMethod.GET, RequestMethod.POST})
......
......@@ -3,6 +3,8 @@ package com.glsx.smart.controller;
import java.util.List;
import com.glsx.smart.dao.entity.SmartProductType;
import com.glsx.smart.service.SmartProductTypeService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -19,6 +21,8 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/productType")
public class ProductTypeController {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private SmartProductTypeService productTypeService;
......
......@@ -3,6 +3,8 @@ package com.glsx.smart.controller;
import java.util.List;
import com.glsx.smart.dao.entity.SmartScene;
import com.glsx.smart.service.SmartSceneService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -19,6 +21,8 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/scene")
public class SceneController {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private SmartSceneService sceneService;
......
......@@ -3,6 +3,8 @@ package com.glsx.smart.controller;
import java.util.List;
import com.glsx.smart.dao.entity.SmartSceneTemplate;
import com.glsx.smart.service.SmartSceneTemplateService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -18,6 +20,8 @@ import org.springframework.web.bind.annotation.RestController;
*/
@RestController
public class SceneTemplateController {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private SmartSceneTemplateService sceneTemplateService;
......
package com.glsx.smart.controller;
import java.util.List;
import com.alibaba.fastjson.JSON;
import com.github.pagehelper.PageInfo;
import com.glsx.smart.dao.entity.SmartSysCode;
import com.glsx.smart.pojo.SmartSysCodeReq;
import com.glsx.smart.service.SmartSysCodeService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
......@@ -18,11 +22,14 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/sysCode")
public class SysCodeController {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private SmartSysCodeService sysCodeService;
@RequestMapping(value = "/getList", method = {RequestMethod.GET, RequestMethod.POST})
public List<SmartSysCode> getList(SmartSysCode sysCode) {
return sysCodeService.getList(sysCode);
public PageInfo<SmartSysCode> getList(SmartSysCodeReq req) {
this.logger.info("$$$$ /sysCode/getList param: {}", JSON.toJSONString(req));
return sysCodeService.getList(req);
}
}
package com.glsx.smart.controller;
import com.glsx.smart.dao.entity.SmartSysFile;
import com.glsx.smart.service.SmartSysFileService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
......@@ -16,8 +19,10 @@ import org.springframework.web.multipart.MultipartFile;
* @date 2021-03-15
*/
@RestController
@RequestMapping("/file")
public class FileController {
@RequestMapping("/sysFile")
public class SysFileController {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private SmartSysFileService sysFileService;
......@@ -26,8 +31,11 @@ public class FileController {
}
@RequestMapping(value = "/deleteFile", method = {RequestMethod.POST})
public void deleteFile(String fileUrl) {
@RequestMapping(value = "/updateFile", method = {RequestMethod.POST})
public void updateFile(SmartSysFile sysFile) {
// 实现流程:
// 1、根据 sysFile.id 获取数据库原来的文件记录;
// 2、删除对应 url 的文件;
// 3、更新传来的文件信息到数据库中。
}
}
......@@ -4,8 +4,8 @@ import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;
import com.glsx.smart.pojo.BaseDTO;
/**
* <p>Description:
......@@ -20,7 +20,26 @@ import com.glsx.smart.pojo.BaseDTO;
* 车家智能产品数据表
*/
@Table(name = "smart_product")
public class SmartProduct extends BaseDTO {
public class SmartProduct {
/**
* 产品类型名称
*/
@Transient
private String typeName;
/**
* 接入平台名称
*/
@Transient
private String platformName;
/**
* 配网模式名称
*/
@Transient
private String networkName;
/**
* 标识ID
*/
......@@ -93,6 +112,30 @@ public class SmartProduct extends BaseDTO {
*/
private Long updateBy;
public String getTypeName() {
return typeName;
}
public void setTypeName(String typeName) {
this.typeName = typeName;
}
public String getPlatformName() {
return platformName;
}
public void setPlatformName(String platformName) {
this.platformName = platformName;
}
public String getNetworkName() {
return networkName;
}
public void setNetworkName(String networkName) {
this.networkName = networkName;
}
public Long getId() {
return id;
}
......@@ -207,25 +250,24 @@ public class SmartProduct extends BaseDTO {
@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(", productName=").append(productName);
sb.append(", icon=").append(icon);
sb.append(", typeId=").append(typeId);
sb.append(", shopProductId=").append(shopProductId);
sb.append(", platformKey=").append(platformKey);
sb.append(", platformProductId=").append(platformProductId);
sb.append(", networkKey=").append(networkKey);
sb.append(", status=").append(status);
sb.append(", remark=").append(remark);
sb.append(", createTime=").append(createTime);
sb.append(", createBy=").append(createBy);
sb.append(", updateTime=").append(updateTime);
sb.append(", updateBy=").append(updateBy);
sb.append("]");
return sb.toString();
return "SmartProduct{" +
"typeName='" + typeName + '\'' +
", platformName='" + platformName + '\'' +
", networkName='" + networkName + '\'' +
", id=" + id +
", productName='" + productName + '\'' +
", icon=" + icon +
", typeId=" + typeId +
", shopProductId='" + shopProductId + '\'' +
", platformKey='" + platformKey + '\'' +
", platformProductId='" + platformProductId + '\'' +
", networkKey='" + networkKey + '\'' +
", status=" + status +
", remark='" + remark + '\'' +
", createTime=" + createTime +
", createBy=" + createBy +
", updateTime=" + updateTime +
", updateBy=" + updateBy +
"} " + super.toString();
}
}
......@@ -5,7 +5,6 @@ import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;
import com.glsx.smart.pojo.BaseDTO;
/**
* <p>Description:
......@@ -20,7 +19,7 @@ import com.glsx.smart.pojo.BaseDTO;
* 车家智能系统代码集表
*/
@Table(name = "smart_sys_code")
public class SmartSysCode extends BaseDTO {
public class SmartSysCode {
/**
* 标识ID
*/
......
......@@ -2,6 +2,7 @@ package com.glsx.smart.dao.mapper;
import java.util.List;
import com.glsx.smart.dao.entity.SmartProduct;
import com.glsx.smart.pojo.SmartProductReq;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -15,6 +16,9 @@ import org.apache.ibatis.annotations.Param;
@Mapper
public interface SmartProductMapper extends tk.mybatis.mapper.common.Mapper<SmartProduct> {
List<SmartProduct> getList(SmartProductReq req);
int insertOrUpdate(SmartProduct record);
int insertOrUpdateSelective(SmartProduct record);
......
......@@ -2,6 +2,7 @@ package com.glsx.smart.dao.mapper;
import java.util.List;
import com.glsx.smart.dao.entity.SmartSysCode;
import com.glsx.smart.pojo.SmartSysCodeReq;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -15,6 +16,8 @@ import org.apache.ibatis.annotations.Param;
@Mapper
public interface SmartSysCodeMapper extends tk.mybatis.mapper.common.Mapper<SmartSysCode> {
List<SmartSysCode> getList(SmartSysCodeReq req);
int insertOrUpdate(SmartSysCode record);
int insertOrUpdateSelective(SmartSysCode record);
......
package com.glsx.smart.exception;
/**
* <p>Description:
* <p>Project: chejia-smart
*
* @author wbh
* @date 2021-03-16
*/
public class BusinessException extends RuntimeException {
private Integer code;
private String message;
public BusinessException() {}
public BusinessException(ResultEnum resultEnum) {
this.code = resultEnum.getCode();
this.message = resultEnum.getMessage();
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
@Override
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}
package com.glsx.smart.exception;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
/**
* <p>Description:
* <p>Project: chejia-smart
*
* @author wbh
* @date 2021-03-16
*/
@RestControllerAdvice
public class BusinessExceptionHandler {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@ExceptionHandler(BusinessException.class)
public void handleBusinessException(BusinessException e) {
logger.error("!!!! ERROR", e);
}
}
package com.glsx.smart.exception;
/**
* <p>Description:
* <p>Project: chejia-smart
*
* @author wbh
* @date 2021-03-16
*/
public enum ResultEnum {
SUCCESS(200, "成功"),
ERROR(500, "系统异常"),
PARAM_ERROR(1001, "参数错误"),
ID_NOT_FOUND(1002, "ID不存在"),
PRODUCT_NOT_FOUND(2001, "产品ID未找到"),
;
private final Integer code;
private final String message;
ResultEnum(Integer code, String message) {
this.code = code;
this.message = message;
}
public Integer getCode() {
return code;
}
public String getMessage() {
return message;
}
}
package com.glsx.smart.pojo;
/**
* <p>Description:
* <p>Project: chejia-smart
*
* @author wbh
* @date 2021-03-16
*/
public class SmartProductReq extends BaseDTO {
}
package com.glsx.smart.pojo;
/**
* <p>Description:
* <p>Project: chejia-smart
*
* @author wbh
* @date 2021-03-16
*/
public class SmartSysCodeReq extends BaseDTO {
/**
* 字典类型
*/
private String dictType;
/**
* 字典键值
*/
private String dictKey;
/**
* 字典值
*/
private String dictValue;
/**
* 父级键值
*/
private String parentKey;
public String getDictType() {
return dictType;
}
public void setDictType(String dictType) {
this.dictType = dictType;
}
public String getDictKey() {
return dictKey;
}
public void setDictKey(String dictKey) {
this.dictKey = dictKey;
}
public String getDictValue() {
return dictValue;
}
public void setDictValue(String dictValue) {
this.dictValue = dictValue;
}
public String getParentKey() {
return parentKey;
}
public void setParentKey(String parentKey) {
this.parentKey = parentKey;
}
@Override
public String toString() {
return "SmartSysCodeReq{" +
"dictType='" + dictType + '\'' +
", dictKey='" + dictKey + '\'' +
", dictValue='" + dictValue + '\'' +
", parentKey='" + parentKey + '\'' +
"} " + super.toString();
}
}
......@@ -13,10 +13,10 @@ import org.slf4j.LoggerFactory;
* @date 2021-03-15
*/
public abstract class BaseService {
protected Logger logger = LoggerFactory.getLogger(this.getClass());
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
/**
* 按需开启分页
* 按需开启分页,调用此方法后需紧跟查询 sql,否则分页将不生效
*
* @param req 请求体
* @param <T> 继承自 {@link BaseDTO}
......
package com.glsx.smart.service;
import java.util.List;
import com.github.pagehelper.PageInfo;
import com.glsx.smart.dao.entity.SmartProduct;
import com.glsx.smart.pojo.SmartProductReq;
/**
* <p>Description:
......@@ -12,7 +13,7 @@ import com.glsx.smart.dao.entity.SmartProduct;
*/
public interface SmartProductService {
List<SmartProduct> getList(SmartProduct product);
PageInfo<SmartProduct> getList(SmartProductReq req);
SmartProduct getById(Long id);
......@@ -20,43 +21,7 @@ public interface SmartProductService {
void getCommandSetById(Long id);
void checkShopProductIdValid(String shopProductId);
void putOn(Long id);
void putOff(Long id);
long countByExample(SmartProduct example);
int deleteByExample(SmartProduct example);
int deleteByPrimaryKey(Long id);
int insert(SmartProduct record);
int insertOrUpdate(SmartProduct record);
int insertOrUpdateSelective(SmartProduct record);
int insertSelective(SmartProduct record);
List<SmartProduct> selectByExample(SmartProduct example);
SmartProduct selectByPrimaryKey(Long id);
int updateByExampleSelective(SmartProduct record, SmartProduct example);
int updateByExample(SmartProduct record, SmartProduct example);
int updateByPrimaryKeySelective(SmartProduct record);
int updateByPrimaryKey(SmartProduct record);
int updateBatch(List<SmartProduct> list);
int updateBatchSelective(List<SmartProduct> list);
int batchInsert(List<SmartProduct> list);
void checkShopProductId(String shopProductId);
void putOnOff(Long id);
}
......@@ -12,35 +12,17 @@ import com.glsx.smart.dao.entity.SmartProductTypeParam;
*/
public interface SmartProductTypeParamService {
int deleteByExample(SmartProductTypeParam example);
int deleteByPrimaryKey(Long id);
int insert(SmartProductTypeParam record);
int insertOrUpdate(SmartProductTypeParam record);
int insertOrUpdateSelective(SmartProductTypeParam record);
int insertSelective(SmartProductTypeParam record);
List<SmartProductTypeParam> selectByExample(SmartProductTypeParam example);
SmartProductTypeParam selectByPrimaryKey(Long id);
int updateByExampleSelective(SmartProductTypeParam record,
SmartProductTypeParam example);
int updateByExample(SmartProductTypeParam record, SmartProductTypeParam example);
int updateByPrimaryKeySelective(SmartProductTypeParam record);
int updateByPrimaryKey(SmartProductTypeParam record);
int updateBatch(List<SmartProductTypeParam> list);
int updateBatchSelective(List<SmartProductTypeParam> list);
int batchInsert(List<SmartProductTypeParam> list);
}
......@@ -19,36 +19,4 @@ public interface SmartProductTypeService {
void save(SmartProductType productType);
List<String> getShopTagList();
int deleteByExample(SmartProductType example);
int deleteByPrimaryKey(Long id);
int insert(SmartProductType record);
int insertOrUpdate(SmartProductType record);
int insertOrUpdateSelective(SmartProductType record);
int insertSelective(SmartProductType record);
List<SmartProductType> selectByExample(SmartProductType example);
SmartProductType selectByPrimaryKey(Long id);
int updateByExampleSelective(SmartProductType record, SmartProductType example);
int updateByExample(SmartProductType record, SmartProductType example);
int updateByPrimaryKeySelective(SmartProductType record);
int updateByPrimaryKey(SmartProductType record);
int updateBatch(List<SmartProductType> list);
int updateBatchSelective(List<SmartProductType> list);
int batchInsert(List<SmartProductType> list);
}
......@@ -12,34 +12,19 @@ import com.glsx.smart.dao.entity.SmartSceneData;
*/
public interface SmartSceneDataService {
int deleteByExample(SmartSceneData example);
int deleteByPrimaryKey(Long id);
int insert(SmartSceneData record);
int insertOrUpdate(SmartSceneData record);
int insertOrUpdateSelective(SmartSceneData record);
int insertSelective(SmartSceneData record);
List<SmartSceneData> selectByExample(SmartSceneData example);
SmartSceneData selectByPrimaryKey(Long id);
int updateByExampleSelective(SmartSceneData record, SmartSceneData example);
int updateByExample(SmartSceneData record, SmartSceneData example);
int updateByPrimaryKeySelective(SmartSceneData record);
int updateByPrimaryKey(SmartSceneData record);
int updateBatch(List<SmartSceneData> list);
int updateBatchSelective(List<SmartSceneData> list);
int batchInsert(List<SmartSceneData> list);
}
......@@ -12,32 +12,18 @@ import com.glsx.smart.dao.entity.SmartScene;
*/
public interface SmartSceneService {
int deleteByExample(SmartScene example);
int deleteByPrimaryKey(Long id);
int insert(SmartScene record);
int insertOrUpdate(SmartScene record);
int insertOrUpdateSelective(SmartScene record);
int insertSelective(SmartScene record);
List<SmartScene> selectByExample(SmartScene example);
SmartScene selectByPrimaryKey(Long id);
int updateByExampleSelective(SmartScene record, SmartScene example);
int updateByExample(SmartScene record, SmartScene example);
int updateByPrimaryKeySelective(SmartScene record);
int updateByPrimaryKey(SmartScene record);
int updateBatch(List<SmartScene> list);
int updateBatchSelective(List<SmartScene> list);
int batchInsert(List<SmartScene> list);
......
......@@ -12,32 +12,18 @@ import com.glsx.smart.dao.entity.SmartSceneTemplate;
*/
public interface SmartSceneTemplateService {
int deleteByExample(SmartSceneTemplate example);
int deleteByPrimaryKey(Long id);
int insert(SmartSceneTemplate record);
int insertOrUpdate(SmartSceneTemplate record);
int insertOrUpdateSelective(SmartSceneTemplate record);
int insertSelective(SmartSceneTemplate record);
List<SmartSceneTemplate> selectByExample(SmartSceneTemplate example);
SmartSceneTemplate selectByPrimaryKey(Long id);
int updateByExampleSelective(SmartSceneTemplate record, SmartSceneTemplate example);
int updateByExample(SmartSceneTemplate record, SmartSceneTemplate example);
int updateByPrimaryKeySelective(SmartSceneTemplate record);
int updateByPrimaryKey(SmartSceneTemplate record);
int updateBatch(List<SmartSceneTemplate> list);
int updateBatchSelective(List<SmartSceneTemplate> list);
int batchInsert(List<SmartSceneTemplate> list);
......
package com.glsx.smart.service;
import java.util.List;
import com.github.pagehelper.PageInfo;
import com.glsx.smart.dao.entity.SmartSysCode;
import com.glsx.smart.pojo.SmartSysCodeReq;
/**
* <p>Description:
......@@ -12,35 +14,21 @@ import com.glsx.smart.dao.entity.SmartSysCode;
*/
public interface SmartSysCodeService {
List<SmartSysCode> getList(SmartSysCode sysCode);
PageInfo<SmartSysCode> getList(SmartSysCodeReq req);
int deleteByExample(SmartSysCode example);
int deleteByPrimaryKey(Long id);
int insert(SmartSysCode record);
int insertOrUpdate(SmartSysCode record);
int insertOrUpdateSelective(SmartSysCode record);
int insertSelective(SmartSysCode record);
List<SmartSysCode> selectByExample(SmartSysCode example);
SmartSysCode selectByPrimaryKey(Long id);
int updateByExampleSelective(SmartSysCode record, SmartSysCode example);
int updateByExample(SmartSysCode record, SmartSysCode example);
int updateByPrimaryKeySelective(SmartSysCode record);
int updateByPrimaryKey(SmartSysCode record);
int updateBatch(List<SmartSysCode> list);
int updateBatchSelective(List<SmartSysCode> list);
int batchInsert(List<SmartSysCode> list);
......
......@@ -12,32 +12,18 @@ import com.glsx.smart.dao.entity.SmartSysFile;
*/
public interface SmartSysFileService {
int deleteByExample(SmartSysFile example);
int deleteByPrimaryKey(Long id);
int insert(SmartSysFile record);
int insertOrUpdate(SmartSysFile record);
int insertOrUpdateSelective(SmartSysFile record);
int insertSelective(SmartSysFile record);
List<SmartSysFile> selectByExample(SmartSysFile example);
SmartSysFile selectByPrimaryKey(Long id);
int updateByExampleSelective(SmartSysFile record, SmartSysFile example);
int updateByExample(SmartSysFile record, SmartSysFile example);
int updateByPrimaryKeySelective(SmartSysFile record);
int updateByPrimaryKey(SmartSysFile record);
int updateBatch(List<SmartSysFile> list);
int updateBatchSelective(List<SmartSysFile> list);
int batchInsert(List<SmartSysFile> list);
......
......@@ -12,32 +12,18 @@ import com.glsx.smart.dao.entity.SmartTemplateParam;
*/
public interface SmartTemplateParamService {
int deleteByExample(SmartTemplateParam example);
int deleteByPrimaryKey(Long id);
int insert(SmartTemplateParam record);
int insertOrUpdate(SmartTemplateParam record);
int insertOrUpdateSelective(SmartTemplateParam record);
int insertSelective(SmartTemplateParam record);
List<SmartTemplateParam> selectByExample(SmartTemplateParam example);
SmartTemplateParam selectByPrimaryKey(Long id);
int updateByExampleSelective(SmartTemplateParam record, SmartTemplateParam example);
int updateByExample(SmartTemplateParam record, SmartTemplateParam example);
int updateByPrimaryKeySelective(SmartTemplateParam record);
int updateByPrimaryKey(SmartTemplateParam record);
int updateBatch(List<SmartTemplateParam> list);
int updateBatchSelective(List<SmartTemplateParam> list);
int batchInsert(List<SmartTemplateParam> list);
......
......@@ -12,32 +12,18 @@ import com.glsx.smart.dao.entity.SmartUserRelation;
*/
public interface SmartUserRelationService {
int deleteByExample(SmartUserRelation example);
int deleteByPrimaryKey(Long id);
int insert(SmartUserRelation record);
int insertOrUpdate(SmartUserRelation record);
int insertOrUpdateSelective(SmartUserRelation record);
int insertSelective(SmartUserRelation record);
List<SmartUserRelation> selectByExample(SmartUserRelation example);
SmartUserRelation selectByPrimaryKey(Long id);
int updateByExampleSelective(SmartUserRelation record, SmartUserRelation example);
int updateByExample(SmartUserRelation record, SmartUserRelation example);
int updateByPrimaryKeySelective(SmartUserRelation record);
int updateByPrimaryKey(SmartUserRelation record);
int updateBatch(List<SmartUserRelation> list);
int updateBatchSelective(List<SmartUserRelation> list);
int batchInsert(List<SmartUserRelation> list);
......
......@@ -2,11 +2,16 @@ package com.glsx.smart.service.impl;
import javax.annotation.Resource;
import java.util.List;
import com.github.pagehelper.PageInfo;
import com.glsx.smart.dao.entity.SmartProduct;
import com.glsx.smart.dao.mapper.SmartProductMapper;
import com.glsx.smart.exception.BusinessException;
import com.glsx.smart.exception.ResultEnum;
import com.glsx.smart.pojo.SmartProductReq;
import com.glsx.smart.service.BaseService;
import com.glsx.smart.service.SmartProductService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* <p>Description:
......@@ -18,29 +23,54 @@ import org.springframework.stereotype.Service;
@Service
public class SmartProductServiceImpl extends BaseService implements SmartProductService {
@Resource
private SmartProductMapper productMapper;
/**
* 获取产品列表。
*
* @param req 请求体
* @return 结果
*/
@Override
public List<SmartProduct> getList(SmartProduct product) {
super.startPagination(product);
List<SmartProduct> productList = productMapper.select(product);
return productList;
public PageInfo<SmartProduct> getList(SmartProductReq req) {
super.startPagination(req);
List<SmartProduct> productList = productMapper.getList(req);
PageInfo<SmartProduct> pageInfo = PageInfo.of(productList);
return pageInfo;
}
/**
* 根据 id 查询产品详情。
*
* @param id 产品 id
* @return 结果
*/
@Override
public SmartProduct getById(Long id) {
return productMapper.selectByPrimaryKey(id);
SmartProduct product = productMapper.selectByPrimaryKey(id);
return product;
}
/**
* 保存产品。无则插入,有则更新。
*
* @param product 产品
*/
@Override
@Transactional
public void save(SmartProduct product) {
SmartProduct record = productMapper.selectByPrimaryKey(product.getId());
if (record == null) {
if (product.getId() == null) {
super.logger.info("$$$$ Starting inserting...");
productMapper.insertSelective(product);
} else {
productMapper.updateByPrimaryKeySelective(product);
super.logger.info("$$$$ Starting updating...");
SmartProduct record = productMapper.selectByPrimaryKey(product.getId());
if (record != null) {
productMapper.updateByPrimaryKeySelective(product);
} else {
throw new BusinessException(ResultEnum.PRODUCT_NOT_FOUND);
}
}
}
......@@ -50,99 +80,12 @@ public class SmartProductServiceImpl extends BaseService implements SmartProduct
}
@Override
public void checkShopProductIdValid(String shopProductId) {
}
@Override
public void putOn(Long id) {
}
@Override
public void putOff(Long id) {
}
@Override
public long countByExample(SmartProduct example) {
return productMapper.selectCount(new SmartProduct());
}
@Override
public int deleteByExample(SmartProduct example) {
return productMapper.deleteByExample(example);
}
@Override
public int deleteByPrimaryKey(Long id) {
return productMapper.deleteByPrimaryKey(id);
}
@Override
public int insert(SmartProduct record) {
return productMapper.insert(record);
}
public void checkShopProductId(String shopProductId) {
@Override
public int insertOrUpdate(SmartProduct record) {
return productMapper.insertOrUpdate(record);
}
@Override
public int insertOrUpdateSelective(SmartProduct record) {
return productMapper.insertOrUpdateSelective(record);
}
public void putOnOff(Long id) {
@Override
public int insertSelective(SmartProduct record) {
return productMapper.insertSelective(record);
}
@Override
public List<SmartProduct> selectByExample(SmartProduct example) {
return productMapper.selectByExample(example);
}
@Override
public SmartProduct selectByPrimaryKey(Long id) {
return productMapper.selectByPrimaryKey(id);
}
@Override
public int updateByExampleSelective(SmartProduct record, SmartProduct example) {
return productMapper.updateByExampleSelective(record, example);
}
@Override
public int updateByExample(SmartProduct record, SmartProduct example) {
return productMapper.updateByExample(record, example);
}
@Override
public int updateByPrimaryKeySelective(SmartProduct record) {
return productMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(SmartProduct record) {
return productMapper.updateByPrimaryKey(record);
}
@Override
public int updateBatch(List<SmartProduct> list) {
return productMapper.updateBatch(list);
}
@Override
public int updateBatchSelective(List<SmartProduct> list) {
return productMapper.updateBatchSelective(list);
}
@Override
public int batchInsert(List<SmartProduct> list) {
return productMapper.batchInsert(list);
}
}
......@@ -22,38 +22,18 @@ public class SmartProductTypeParamServiceImpl implements SmartProductTypeParamSe
private SmartProductTypeParamMapper smartProductTypeParamMapper;
@Override
public int deleteByExample(SmartProductTypeParam example) {
return smartProductTypeParamMapper.deleteByExample(example);
}
@Override
public int deleteByPrimaryKey(Long id) {
return smartProductTypeParamMapper.deleteByPrimaryKey(id);
}
@Override
public int insert(SmartProductTypeParam record) {
return smartProductTypeParamMapper.insert(record);
}
@Override
public int insertOrUpdate(SmartProductTypeParam record) {
return smartProductTypeParamMapper.insertOrUpdate(record);
}
@Override
public int insertOrUpdateSelective(SmartProductTypeParam record) {
return smartProductTypeParamMapper.insertOrUpdateSelective(record);
}
@Override
public int insertSelective(SmartProductTypeParam record) {
return smartProductTypeParamMapper.insertSelective(record);
}
@Override
public List<SmartProductTypeParam> selectByExample(SmartProductTypeParam example) {
return smartProductTypeParamMapper.selectByExample(example);
return smartProductTypeParamMapper.select(example);
}
@Override
......@@ -62,32 +42,11 @@ public class SmartProductTypeParamServiceImpl implements SmartProductTypeParamSe
}
@Override
public int updateByExampleSelective(SmartProductTypeParam record,
SmartProductTypeParam example) {
return smartProductTypeParamMapper.updateByExampleSelective(record, example);
}
@Override
public int updateByExample(SmartProductTypeParam record, SmartProductTypeParam example) {
return smartProductTypeParamMapper.updateByExample(record, example);
}
@Override
public int updateByPrimaryKeySelective(SmartProductTypeParam record) {
return smartProductTypeParamMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(SmartProductTypeParam record) {
return smartProductTypeParamMapper.updateByPrimaryKey(record);
}
@Override
public int updateBatch(List<SmartProductTypeParam> list) {
return smartProductTypeParamMapper.updateBatch(list);
}
@Override
public int updateBatchSelective(List<SmartProductTypeParam> list) {
return smartProductTypeParamMapper.updateBatchSelective(list);
}
......@@ -96,5 +55,4 @@ public class SmartProductTypeParamServiceImpl implements SmartProductTypeParamSe
public int batchInsert(List<SmartProductTypeParam> list) {
return smartProductTypeParamMapper.batchInsert(list);
}
}
package com.glsx.smart.service.impl;
import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;
import com.glsx.smart.dao.entity.SmartProductType;
import com.glsx.smart.dao.mapper.SmartProductTypeMapper;
import com.glsx.smart.exception.BusinessException;
import com.glsx.smart.exception.ResultEnum;
import com.glsx.smart.service.SmartProductTypeService;
import org.springframework.stereotype.Service;
......@@ -17,7 +20,6 @@ import org.springframework.stereotype.Service;
@Service
public class SmartProductTypeServiceImpl implements SmartProductTypeService {
@Resource
private SmartProductTypeMapper productTypeMapper;
......@@ -33,94 +35,20 @@ public class SmartProductTypeServiceImpl implements SmartProductTypeService {
@Override
public void save(SmartProductType productType) {
SmartProductType record = productTypeMapper.selectByPrimaryKey(
productType.getId());
if (record == null) {
if (productType.getId() == null) {
productTypeMapper.insertSelective(productType);
} else {
productTypeMapper.updateByPrimaryKeySelective(productType);
SmartProductType record = productTypeMapper.selectByPrimaryKey(productType.getId());
if (record != null) {
productTypeMapper.updateByPrimaryKeySelective(productType);
} else {
throw new BusinessException(ResultEnum.ID_NOT_FOUND);
}
}
}
@Override
public List<String> getShopTagList() {
return null;
return Arrays.asList("牛逼", "干翻苹果");
}
@Override
public int deleteByExample(SmartProductType example) {
return productTypeMapper.deleteByExample(example);
}
@Override
public int deleteByPrimaryKey(Long id) {
return productTypeMapper.deleteByPrimaryKey(id);
}
@Override
public int insert(SmartProductType record) {
return productTypeMapper.insert(record);
}
@Override
public int insertOrUpdate(SmartProductType record) {
return productTypeMapper.insertOrUpdate(record);
}
@Override
public int insertOrUpdateSelective(SmartProductType record) {
return productTypeMapper.insertOrUpdateSelective(record);
}
@Override
public int insertSelective(SmartProductType record) {
return productTypeMapper.insertSelective(record);
}
@Override
public List<SmartProductType> selectByExample(SmartProductType example) {
return productTypeMapper.selectByExample(example);
}
@Override
public SmartProductType selectByPrimaryKey(Long id) {
return productTypeMapper.selectByPrimaryKey(id);
}
@Override
public int updateByExampleSelective(SmartProductType record, SmartProductType example) {
return productTypeMapper.updateByExampleSelective(record, example);
}
@Override
public int updateByExample(SmartProductType record, SmartProductType example) {
return productTypeMapper.updateByExample(record, example);
}
@Override
public int updateByPrimaryKeySelective(SmartProductType record) {
return productTypeMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(SmartProductType record) {
return productTypeMapper.updateByPrimaryKey(record);
}
@Override
public int updateBatch(List<SmartProductType> list) {
return productTypeMapper.updateBatch(list);
}
@Override
public int updateBatchSelective(List<SmartProductType> list) {
return productTypeMapper.updateBatchSelective(list);
}
@Override
public int batchInsert(List<SmartProductType> list) {
return productTypeMapper.batchInsert(list);
}
}
......@@ -4,6 +4,8 @@ import javax.annotation.Resource;
import java.util.List;
import com.glsx.smart.dao.entity.SmartSceneData;
import com.glsx.smart.dao.mapper.SmartSceneDataMapper;
import com.glsx.smart.exception.BusinessException;
import com.glsx.smart.exception.ResultEnum;
import com.glsx.smart.service.SmartSceneDataService;
import org.springframework.stereotype.Service;
......@@ -22,28 +24,22 @@ public class SmartSceneDataServiceImpl implements SmartSceneDataService {
private SmartSceneDataMapper smartSceneDataMapper;
@Override
public int deleteByExample(SmartSceneData example) {
return smartSceneDataMapper.deleteByExample(example);
}
@Override
public int deleteByPrimaryKey(Long id) {
return smartSceneDataMapper.deleteByPrimaryKey(id);
}
@Override
public int insert(SmartSceneData record) {
return smartSceneDataMapper.insert(record);
}
@Override
public int insertOrUpdate(SmartSceneData record) {
return smartSceneDataMapper.insertOrUpdate(record);
}
@Override
public int insertOrUpdateSelective(SmartSceneData record) {
return smartSceneDataMapper.insertOrUpdateSelective(record);
public int insertOrUpdate(SmartSceneData sceneData) {
if (sceneData.getId() == null) {
return smartSceneDataMapper.insertOrUpdateSelective(sceneData);
} else {
SmartSceneData record = smartSceneDataMapper.selectByPrimaryKey(sceneData.getId());
if (record != null) {
return smartSceneDataMapper.updateByPrimaryKeySelective(sceneData);
} else {
throw new BusinessException(ResultEnum.ID_NOT_FOUND);
}
}
}
@Override
......@@ -53,7 +49,7 @@ public class SmartSceneDataServiceImpl implements SmartSceneDataService {
@Override
public List<SmartSceneData> selectByExample(SmartSceneData example) {
return smartSceneDataMapper.selectByExample(example);
return smartSceneDataMapper.select(example);
}
@Override
......@@ -62,31 +58,11 @@ public class SmartSceneDataServiceImpl implements SmartSceneDataService {
}
@Override
public int updateByExampleSelective(SmartSceneData record, SmartSceneData example) {
return smartSceneDataMapper.updateByExampleSelective(record, example);
}
@Override
public int updateByExample(SmartSceneData record, SmartSceneData example) {
return smartSceneDataMapper.updateByExample(record, example);
}
@Override
public int updateByPrimaryKeySelective(SmartSceneData record) {
return smartSceneDataMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(SmartSceneData record) {
return smartSceneDataMapper.updateByPrimaryKey(record);
}
@Override
public int updateBatch(List<SmartSceneData> list) {
return smartSceneDataMapper.updateBatch(list);
}
@Override
public int updateBatchSelective(List<SmartSceneData> list) {
return smartSceneDataMapper.updateBatchSelective(list);
}
......@@ -95,5 +71,4 @@ public class SmartSceneDataServiceImpl implements SmartSceneDataService {
public int batchInsert(List<SmartSceneData> list) {
return smartSceneDataMapper.batchInsert(list);
}
}
......@@ -4,6 +4,8 @@ import javax.annotation.Resource;
import java.util.List;
import com.glsx.smart.dao.entity.SmartScene;
import com.glsx.smart.dao.mapper.SmartSceneMapper;
import com.glsx.smart.exception.BusinessException;
import com.glsx.smart.exception.ResultEnum;
import com.glsx.smart.service.SmartSceneService;
import org.springframework.stereotype.Service;
......@@ -22,38 +24,32 @@ public class SmartSceneServiceImpl implements SmartSceneService {
private SmartSceneMapper smartSceneMapper;
@Override
public int deleteByExample(SmartScene example) {
return smartSceneMapper.deleteByExample(example);
}
@Override
public int deleteByPrimaryKey(Long id) {
return smartSceneMapper.deleteByPrimaryKey(id);
}
@Override
public int insert(SmartScene record) {
return smartSceneMapper.insert(record);
}
@Override
public int insertOrUpdate(SmartScene record) {
return smartSceneMapper.insertOrUpdate(record);
public int insertOrUpdate(SmartScene scene) {
if (scene.getId() == null) {
return smartSceneMapper.insertSelective(scene);
} else {
SmartScene record = smartSceneMapper.selectByPrimaryKey(scene.getId());
if (record != null) {
return smartSceneMapper.updateByPrimaryKeySelective(scene);
} else {
throw new BusinessException(ResultEnum.ID_NOT_FOUND);
}
}
}
@Override
public int insertOrUpdateSelective(SmartScene record) {
return smartSceneMapper.insertOrUpdateSelective(record);
}
@Override
public int insertSelective(SmartScene record) {
return smartSceneMapper.insertSelective(record);
public int insertSelective(SmartScene scene) {
return smartSceneMapper.insertSelective(scene);
}
@Override
public List<SmartScene> selectByExample(SmartScene example) {
return smartSceneMapper.selectByExample(example);
return smartSceneMapper.select(example);
}
@Override
......@@ -62,31 +58,11 @@ public class SmartSceneServiceImpl implements SmartSceneService {
}
@Override
public int updateByExampleSelective(SmartScene record, SmartScene example) {
return smartSceneMapper.updateByExampleSelective(record, example);
}
@Override
public int updateByExample(SmartScene record, SmartScene example) {
return smartSceneMapper.updateByExample(record, example);
}
@Override
public int updateByPrimaryKeySelective(SmartScene record) {
return smartSceneMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(SmartScene record) {
return smartSceneMapper.updateByPrimaryKey(record);
}
@Override
public int updateBatch(List<SmartScene> list) {
return smartSceneMapper.updateBatch(list);
}
@Override
public int updateBatchSelective(List<SmartScene> list) {
return smartSceneMapper.updateBatchSelective(list);
}
......
......@@ -4,6 +4,8 @@ import javax.annotation.Resource;
import java.util.List;
import com.glsx.smart.dao.entity.SmartSceneTemplate;
import com.glsx.smart.dao.mapper.SmartSceneTemplateMapper;
import com.glsx.smart.exception.BusinessException;
import com.glsx.smart.exception.ResultEnum;
import com.glsx.smart.service.SmartSceneTemplateService;
import org.springframework.stereotype.Service;
......@@ -22,28 +24,23 @@ public class SmartSceneTemplateServiceImpl implements SmartSceneTemplateService
private SmartSceneTemplateMapper smartSceneTemplateMapper;
@Override
public int deleteByExample(SmartSceneTemplate example) {
return smartSceneTemplateMapper.deleteByExample(example);
}
@Override
public int deleteByPrimaryKey(Long id) {
return smartSceneTemplateMapper.deleteByPrimaryKey(id);
}
@Override
public int insert(SmartSceneTemplate record) {
return smartSceneTemplateMapper.insert(record);
}
@Override
public int insertOrUpdate(SmartSceneTemplate record) {
return smartSceneTemplateMapper.insertOrUpdate(record);
}
@Override
public int insertOrUpdateSelective(SmartSceneTemplate record) {
return smartSceneTemplateMapper.insertOrUpdateSelective(record);
public int insertOrUpdate(SmartSceneTemplate sceneTemplate) {
if (sceneTemplate.getId() == null) {
return smartSceneTemplateMapper.insertSelective(sceneTemplate);
} else {
SmartSceneTemplate record = smartSceneTemplateMapper.selectByPrimaryKey(
sceneTemplate.getId());
if (record != null) {
return smartSceneTemplateMapper.updateByPrimaryKeySelective(sceneTemplate);
} else {
throw new BusinessException(ResultEnum.ID_NOT_FOUND);
}
}
}
@Override
......@@ -53,7 +50,7 @@ public class SmartSceneTemplateServiceImpl implements SmartSceneTemplateService
@Override
public List<SmartSceneTemplate> selectByExample(SmartSceneTemplate example) {
return smartSceneTemplateMapper.selectByExample(example);
return smartSceneTemplateMapper.select(example);
}
@Override
......@@ -62,32 +59,11 @@ public class SmartSceneTemplateServiceImpl implements SmartSceneTemplateService
}
@Override
public int updateByExampleSelective(SmartSceneTemplate record,
SmartSceneTemplate example) {
return smartSceneTemplateMapper.updateByExampleSelective(record, example);
}
@Override
public int updateByExample(SmartSceneTemplate record, SmartSceneTemplate example) {
return smartSceneTemplateMapper.updateByExample(record, example);
}
@Override
public int updateByPrimaryKeySelective(SmartSceneTemplate record) {
return smartSceneTemplateMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(SmartSceneTemplate record) {
return smartSceneTemplateMapper.updateByPrimaryKey(record);
}
@Override
public int updateBatch(List<SmartSceneTemplate> list) {
return smartSceneTemplateMapper.updateBatch(list);
}
@Override
public int updateBatchSelective(List<SmartSceneTemplate> list) {
return smartSceneTemplateMapper.updateBatchSelective(list);
}
......
......@@ -2,8 +2,12 @@ package com.glsx.smart.service.impl;
import javax.annotation.Resource;
import java.util.List;
import com.github.pagehelper.PageInfo;
import com.glsx.smart.dao.entity.SmartSysCode;
import com.glsx.smart.dao.mapper.SmartSysCodeMapper;
import com.glsx.smart.exception.BusinessException;
import com.glsx.smart.exception.ResultEnum;
import com.glsx.smart.pojo.SmartSysCodeReq;
import com.glsx.smart.service.BaseService;
import com.glsx.smart.service.SmartSysCodeService;
import org.springframework.stereotype.Service;
......@@ -22,36 +26,39 @@ public class SmartSysCodeServiceImpl extends BaseService implements SmartSysCode
@Resource
private SmartSysCodeMapper sysCodeMapper;
/**
* 获取代码集列表
*
* @param req 请求
* @return 结果
*/
@Override
public List<SmartSysCode> getList(SmartSysCode sysCode) {
super.startPagination(sysCode);
return sysCodeMapper.selectByExample(sysCode);
public PageInfo<SmartSysCode> getList(SmartSysCodeReq req) {
super.startPagination(req);
List<SmartSysCode> sysCodeList = sysCodeMapper.getList(req);
PageInfo<SmartSysCode> pageInfo = new PageInfo<>(sysCodeList);
return pageInfo;
}
@Override
public int deleteByExample(SmartSysCode example) {
return sysCodeMapper.deleteByExample(example);
}
@Override
public int deleteByPrimaryKey(Long id) {
return sysCodeMapper.deleteByPrimaryKey(id);
}
@Override
public int insert(SmartSysCode record) {
return sysCodeMapper.insert(record);
}
@Override
public int insertOrUpdate(SmartSysCode record) {
return sysCodeMapper.insertOrUpdate(record);
}
@Override
public int insertOrUpdateSelective(SmartSysCode record) {
return sysCodeMapper.insertOrUpdateSelective(record);
public int insertOrUpdate(SmartSysCode sysCode) {
if (sysCode.getId() == null) {
return sysCodeMapper.insertSelective(sysCode);
} else {
SmartSysCode record = sysCodeMapper.selectByPrimaryKey(
sysCode.getId());
if (record != null) {
return sysCodeMapper.updateByPrimaryKeySelective(sysCode);
} else {
throw new BusinessException(ResultEnum.ID_NOT_FOUND);
}
}
}
@Override
......@@ -61,7 +68,7 @@ public class SmartSysCodeServiceImpl extends BaseService implements SmartSysCode
@Override
public List<SmartSysCode> selectByExample(SmartSysCode example) {
return sysCodeMapper.selectByExample(example);
return sysCodeMapper.select(example);
}
@Override
......@@ -70,31 +77,11 @@ public class SmartSysCodeServiceImpl extends BaseService implements SmartSysCode
}
@Override
public int updateByExampleSelective(SmartSysCode record, SmartSysCode example) {
return sysCodeMapper.updateByExampleSelective(record, example);
}
@Override
public int updateByExample(SmartSysCode record, SmartSysCode example) {
return sysCodeMapper.updateByExample(record, example);
}
@Override
public int updateByPrimaryKeySelective(SmartSysCode record) {
return sysCodeMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(SmartSysCode record) {
return sysCodeMapper.updateByPrimaryKey(record);
}
@Override
public int updateBatch(List<SmartSysCode> list) {
return sysCodeMapper.updateBatch(list);
}
@Override
public int updateBatchSelective(List<SmartSysCode> list) {
return sysCodeMapper.updateBatchSelective(list);
}
......
......@@ -4,6 +4,8 @@ import javax.annotation.Resource;
import java.util.List;
import com.glsx.smart.dao.entity.SmartSysFile;
import com.glsx.smart.dao.mapper.SmartSysFileMapper;
import com.glsx.smart.exception.BusinessException;
import com.glsx.smart.exception.ResultEnum;
import com.glsx.smart.service.SmartSysFileService;
import org.springframework.stereotype.Service;
......@@ -22,28 +24,23 @@ public class SmartSysFileServiceImpl implements SmartSysFileService {
private SmartSysFileMapper smartSysFileMapper;
@Override
public int deleteByExample(SmartSysFile example) {
return smartSysFileMapper.deleteByExample(example);
}
@Override
public int deleteByPrimaryKey(Long id) {
return smartSysFileMapper.deleteByPrimaryKey(id);
}
@Override
public int insert(SmartSysFile record) {
return smartSysFileMapper.insert(record);
}
@Override
public int insertOrUpdate(SmartSysFile record) {
return smartSysFileMapper.insertOrUpdate(record);
}
@Override
public int insertOrUpdateSelective(SmartSysFile record) {
return smartSysFileMapper.insertOrUpdateSelective(record);
public int insertOrUpdate(SmartSysFile sysFile) {
if (sysFile.getId() == null) {
return smartSysFileMapper.insertSelective(sysFile);
} else {
SmartSysFile record = smartSysFileMapper.selectByPrimaryKey(
sysFile.getId());
if (record != null) {
return smartSysFileMapper.updateByPrimaryKeySelective(sysFile);
} else {
throw new BusinessException(ResultEnum.ID_NOT_FOUND);
}
}
}
@Override
......@@ -53,7 +50,7 @@ public class SmartSysFileServiceImpl implements SmartSysFileService {
@Override
public List<SmartSysFile> selectByExample(SmartSysFile example) {
return smartSysFileMapper.selectByExample(example);
return smartSysFileMapper.select(example);
}
@Override
......@@ -62,31 +59,11 @@ public class SmartSysFileServiceImpl implements SmartSysFileService {
}
@Override
public int updateByExampleSelective(SmartSysFile record, SmartSysFile example) {
return smartSysFileMapper.updateByExampleSelective(record, example);
}
@Override
public int updateByExample(SmartSysFile record, SmartSysFile example) {
return smartSysFileMapper.updateByExample(record, example);
}
@Override
public int updateByPrimaryKeySelective(SmartSysFile record) {
return smartSysFileMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(SmartSysFile record) {
return smartSysFileMapper.updateByPrimaryKey(record);
}
@Override
public int updateBatch(List<SmartSysFile> list) {
return smartSysFileMapper.updateBatch(list);
}
@Override
public int updateBatchSelective(List<SmartSysFile> list) {
return smartSysFileMapper.updateBatchSelective(list);
}
......
......@@ -4,6 +4,8 @@ import javax.annotation.Resource;
import java.util.List;
import com.glsx.smart.dao.entity.SmartTemplateParam;
import com.glsx.smart.dao.mapper.SmartTemplateParamMapper;
import com.glsx.smart.exception.BusinessException;
import com.glsx.smart.exception.ResultEnum;
import com.glsx.smart.service.SmartTemplateParamService;
import org.springframework.stereotype.Service;
......@@ -22,28 +24,23 @@ public class SmartTemplateParamServiceImpl implements SmartTemplateParamService
private SmartTemplateParamMapper smartTemplateParamMapper;
@Override
public int deleteByExample(SmartTemplateParam example) {
return smartTemplateParamMapper.deleteByExample(example);
}
@Override
public int deleteByPrimaryKey(Long id) {
return smartTemplateParamMapper.deleteByPrimaryKey(id);
}
@Override
public int insert(SmartTemplateParam record) {
return smartTemplateParamMapper.insert(record);
}
@Override
public int insertOrUpdate(SmartTemplateParam record) {
return smartTemplateParamMapper.insertOrUpdate(record);
}
@Override
public int insertOrUpdateSelective(SmartTemplateParam record) {
return smartTemplateParamMapper.insertOrUpdateSelective(record);
public int insertOrUpdate(SmartTemplateParam templateParam) {
if (templateParam.getId() == null) {
return smartTemplateParamMapper.insertSelective(templateParam);
} else {
SmartTemplateParam record = smartTemplateParamMapper.selectByPrimaryKey(
templateParam.getId());
if (record != null) {
return smartTemplateParamMapper.updateByPrimaryKeySelective(templateParam);
} else {
throw new BusinessException(ResultEnum.ID_NOT_FOUND);
}
}
}
@Override
......@@ -53,7 +50,7 @@ public class SmartTemplateParamServiceImpl implements SmartTemplateParamService
@Override
public List<SmartTemplateParam> selectByExample(SmartTemplateParam example) {
return smartTemplateParamMapper.selectByExample(example);
return smartTemplateParamMapper.select(example);
}
@Override
......@@ -62,32 +59,11 @@ public class SmartTemplateParamServiceImpl implements SmartTemplateParamService
}
@Override
public int updateByExampleSelective(SmartTemplateParam record,
SmartTemplateParam example) {
return smartTemplateParamMapper.updateByExampleSelective(record, example);
}
@Override
public int updateByExample(SmartTemplateParam record, SmartTemplateParam example) {
return smartTemplateParamMapper.updateByExample(record, example);
}
@Override
public int updateByPrimaryKeySelective(SmartTemplateParam record) {
return smartTemplateParamMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(SmartTemplateParam record) {
return smartTemplateParamMapper.updateByPrimaryKey(record);
}
@Override
public int updateBatch(List<SmartTemplateParam> list) {
return smartTemplateParamMapper.updateBatch(list);
}
@Override
public int updateBatchSelective(List<SmartTemplateParam> list) {
return smartTemplateParamMapper.updateBatchSelective(list);
}
......
......@@ -4,6 +4,8 @@ import javax.annotation.Resource;
import java.util.List;
import com.glsx.smart.dao.entity.SmartUserRelation;
import com.glsx.smart.dao.mapper.SmartUserRelationMapper;
import com.glsx.smart.exception.BusinessException;
import com.glsx.smart.exception.ResultEnum;
import com.glsx.smart.service.SmartUserRelationService;
import org.springframework.stereotype.Service;
......@@ -22,28 +24,23 @@ public class SmartUserRelationServiceImpl implements SmartUserRelationService {
private SmartUserRelationMapper smartUserRelationMapper;
@Override
public int deleteByExample(SmartUserRelation example) {
return smartUserRelationMapper.deleteByExample(example);
}
@Override
public int deleteByPrimaryKey(Long id) {
return smartUserRelationMapper.deleteByPrimaryKey(id);
}
@Override
public int insert(SmartUserRelation record) {
return smartUserRelationMapper.insert(record);
}
@Override
public int insertOrUpdate(SmartUserRelation record) {
return smartUserRelationMapper.insertOrUpdate(record);
}
@Override
public int insertOrUpdateSelective(SmartUserRelation record) {
return smartUserRelationMapper.insertOrUpdateSelective(record);
public int insertOrUpdate(SmartUserRelation userRelation) {
if (userRelation.getId() == null) {
return smartUserRelationMapper.insertSelective(userRelation);
} else {
SmartUserRelation record = smartUserRelationMapper.selectByPrimaryKey(
userRelation.getId());
if (record != null) {
return smartUserRelationMapper.updateByPrimaryKeySelective(userRelation);
} else {
throw new BusinessException(ResultEnum.ID_NOT_FOUND);
}
}
}
@Override
......@@ -53,7 +50,7 @@ public class SmartUserRelationServiceImpl implements SmartUserRelationService {
@Override
public List<SmartUserRelation> selectByExample(SmartUserRelation example) {
return smartUserRelationMapper.selectByExample(example);
return smartUserRelationMapper.select(example);
}
@Override
......@@ -62,32 +59,11 @@ public class SmartUserRelationServiceImpl implements SmartUserRelationService {
}
@Override
public int updateByExampleSelective(SmartUserRelation record,
SmartUserRelation example) {
return smartUserRelationMapper.updateByExampleSelective(record, example);
}
@Override
public int updateByExample(SmartUserRelation record, SmartUserRelation example) {
return smartUserRelationMapper.updateByExample(record, example);
}
@Override
public int updateByPrimaryKeySelective(SmartUserRelation record) {
return smartUserRelationMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(SmartUserRelation record) {
return smartUserRelationMapper.updateByPrimaryKey(record);
}
@Override
public int updateBatch(List<SmartUserRelation> list) {
return smartUserRelationMapper.updateBatch(list);
}
@Override
public int updateBatchSelective(List<SmartUserRelation> list) {
return smartUserRelationMapper.updateBatchSelective(list);
}
......
......@@ -19,6 +19,6 @@ logging.path=/data/java_log/jetty/smartService/chejia-smart-service
# PageHelper
pagehelper.helperDialect=mysql
pagehelper.reasonable=true
#pagehelper.reasonable=true
pagehelper.supportMethodsArguments=true
pagehelper.params=count=countSql
......@@ -25,6 +25,30 @@
id, product_name, icon, type_id, shop_product_id, platform_key, platform_product_id,
network_key, `status`, remark, create_time, create_by, update_time, update_by
</sql>
<select id="getList" resultMap="BaseResultMap">
select sp.id, sp.product_name, sp.icon, sp.type_id, sp.shop_product_id, sp.platform_key,
sp.platform_product_id, sp.network_key, sp.status, sp.remark, sp.create_time,
sp.create_by, sp.update_time, sp.update_by,
spt.type_name typeName,
sscp.dict_value platformName,
sscn.dict_value networkName
from smart_product sp
left join smart_product_type spt on spt.id = sp.type_id
left join smart_sys_code sscp on sscp.dict_key = sp.platform_key
left join smart_sys_code sscn on sscn.dict_key = sp.network_key
<where>
<if test="startTime != null and startTime != ''">
</if>
<if test="endTime != null and endTime != ''">
</if>
</where>
order by sp.create_time desc
</select>
<update id="updateBatch" parameterType="java.util.List">
<!--@mbg.generated-->
update smart_product
......
......@@ -24,6 +24,19 @@
id, dict_type, dict_key, dict_value, parent_key, sort, `status`, `level`, remark,
create_time, create_by, update_time, update_by
</sql>
<select id="getList" resultMap="BaseResultMap">
select *
from smart_sys_code ssc
<where>
<if test="dictType != null and dictType != ''">
and ssc.dict_type = #{dictType,jdbcType=VARCHAR}
</if>
</where>
order by ssc.create_time desc, ssc.sort asc
</select>
<update id="updateBatch" parameterType="java.util.List">
<!--@mbg.generated-->
update smart_sys_code
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!