mybatisplus自动生成修复

This commit is contained in:
hupeng committed 2019-10-02 13:55:44 +08:00
1 parent 674dbab8ed
commit 62f8d1ed38
13 files changed
+5 -401

No files matched your search

@@ -10,7 +10,7 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
*/ */
@SpringBootApplication @SpringBootApplication
//@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class }) //@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
@MapperScan(basePackages = {"com.ruoyi.app.common.persistence.dao"}) @MapperScan(basePackages = {"com.ruoyi.app.common.persistence.dao","com.ruoyi.app.modular.*.dao"})
public class LightSecurityApplication { public class LightSecurityApplication {
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(LightSecurityApplication.class, args); SpringApplication.run(LightSecurityApplication.class, args);
@@ -1,21 +0,0 @@
package com.ruoyi.app.common.web.controller;
import com.ruoyi.app.common.api.ApiResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
@RestController
@ApiIgnore
@Slf4j
public class IndexController {
@RequestMapping("/index")
public ApiResult<String> index(){
log.debug("index...");
return ApiResult.ok("Welcome to Spring Boot Plus Project...");
}
}
@@ -1,55 +0,0 @@
package com.ruoyi.app.modular.distribution.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableId;
import com.ruoyi.app.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* <p>
* 代发货表
* </p>
*
* @author hupeng
* @since 2019-09-30
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value="StoreSubstitute对象", description="代发货表")
public class StoreSubstitute extends BaseEntity {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
@ApiModelProperty(value = "用户id")
private Integer userId;
@ApiModelProperty(value = "收货人姓名")
private String username;
@ApiModelProperty(value = "收货手机号")
private String phone;
@ApiModelProperty(value = "城市信息")
private String cityInfo;
@ApiModelProperty(value = "收货详细地址")
private String address;
@ApiModelProperty(value = "产品明细")
private String productInfo;
@ApiModelProperty(value = "创建时间")
private Integer createTime;
private Date updatedAt;
}
@@ -1,40 +0,0 @@
package com.ruoyi.app.modular.distribution.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.app.modular.distribution.entity.StoreSubstitute;
import com.ruoyi.app.distribution.web.param.StoreSubstituteQueryParam;
import com.ruoyi.app.distribution.web.vo.StoreSubstituteQueryVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.io.Serializable;
/**
* <p>
* 代发货表 Mapper 接口
* </p>
*
* @author hupeng
* @since 2019-09-30
*/
@Repository
public interface StoreSubstituteMapper extends BaseMapper<StoreSubstitute> {
/**
* 根据ID获取查询对象
* @param id
* @return
*/
StoreSubstituteQueryVo getStoreSubstituteById(Serializable id);
/**
* 获取分页对象
* @param page
* @param storeSubstituteQueryParam
* @return
*/
IPage<StoreSubstituteQueryVo> getStoreSubstitutePageList(@Param("page") Page page, @Param("param") StoreSubstituteQueryParam storeSubstituteQueryParam);
}
@@ -1,35 +0,0 @@
package com.ruoyi.app.modular.distribution.service;
import com.ruoyi.app.modular.distribution.entity.StoreSubstitute;
import com.ruoyi.app.common.service.BaseService;
import com.ruoyi.app.distribution.web.param.StoreSubstituteQueryParam;
import com.ruoyi.app.distribution.web.vo.StoreSubstituteQueryVo;
import com.ruoyi.app.common.web.vo.Paging;
import java.io.Serializable;
/**
* <p>
* 代发货表 服务类
* </p>
*
* @author hupeng
* @since 2019-09-30
*/
public interface StoreSubstituteService extends BaseService<StoreSubstitute> {
/**
* 根据ID获取查询对象
* @param id
* @return
*/
StoreSubstituteQueryVo getStoreSubstituteById(Serializable id) throws Exception;
/**
* 获取分页对象
* @param storeSubstituteQueryParam
* @return
*/
Paging<StoreSubstituteQueryVo> getStoreSubstitutePageList(StoreSubstituteQueryParam storeSubstituteQueryParam) throws Exception;
}
@@ -1,49 +0,0 @@
package com.ruoyi.app.modular.distribution.service.impl;
import com.ruoyi.app.modular.distribution.entity.StoreSubstitute;
import com.ruoyi.app.modular.distribution.mapper.StoreSubstituteMapper;
import com.ruoyi.app.modular.distribution.service.StoreSubstituteService;
import com.ruoyi.app.distribution.web.param.StoreSubstituteQueryParam;
import com.ruoyi.app.distribution.web.vo.StoreSubstituteQueryVo;
import com.ruoyi.app.common.service.impl.BaseServiceImpl;
import com.ruoyi.app.common.web.vo.Paging;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.io.Serializable;
/**
* <p>
* 代发货表 服务实现类
* </p>
*
* @author hupeng
* @since 2019-09-30
*/
@Slf4j
@Service
@Transactional(rollbackFor = Exception.class)
public class StoreSubstituteServiceImpl extends BaseServiceImpl<StoreSubstituteMapper, StoreSubstitute> implements StoreSubstituteService {
@Autowired
private StoreSubstituteMapper storeSubstituteMapper;
@Override
public StoreSubstituteQueryVo getStoreSubstituteById(Serializable id) throws Exception{
return storeSubstituteMapper.getStoreSubstituteById(id);
}
@Override
public Paging<StoreSubstituteQueryVo> getStoreSubstitutePageList(StoreSubstituteQueryParam storeSubstituteQueryParam) throws Exception{
Page page = setPageParam(storeSubstituteQueryParam,OrderItem.desc("create_time"));
IPage<StoreSubstituteQueryVo> iPage = storeSubstituteMapper.getStoreSubstitutePageList(page,storeSubstituteQueryParam);
return new Paging(iPage);
}
}
@@ -1,91 +0,0 @@
package com.ruoyi.app.modular.distribution.web.controller;
import com.ruoyi.app.modular.distribution.entity.StoreSubstitute;
import com.ruoyi.app.modular.distribution.service.StoreSubstituteService;
import com.ruoyi.app.distribution.web.param.StoreSubstituteQueryParam;
import com.ruoyi.app.distribution.web.vo.StoreSubstituteQueryVo;
import com.ruoyi.app.common.web.controller.BaseController;
import com.ruoyi.app.common.api.ApiResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
import com.ruoyi.app.common.web.vo.Paging;
import com.ruoyi.app.common.web.param.IdParam;
/**
* <p>
* 代发货表 前端控制器
* </p>
*
* @author hupeng
* @since 2019-09-30
*/
@Slf4j
@RestController
@RequestMapping("/storeSubstitute")
@Api("代发货表 API")
public class StoreSubstituteController extends BaseController {
@Autowired
private StoreSubstituteService storeSubstituteService;
/**
* 添加代发货表
*/
@PostMapping("/add")
@ApiOperation(value = "添加StoreSubstitute对象",notes = "添加代发货表",response = ApiResult.class)
public ApiResult<Boolean> addStoreSubstitute(@Valid @RequestBody StoreSubstitute storeSubstitute) throws Exception{
boolean flag = storeSubstituteService.save(storeSubstitute);
return ApiResult.result(flag);
}
/**
* 修改代发货表
*/
@PostMapping("/update")
@ApiOperation(value = "修改StoreSubstitute对象",notes = "修改代发货表",response = ApiResult.class)
public ApiResult<Boolean> updateStoreSubstitute(@Valid @RequestBody StoreSubstitute storeSubstitute) throws Exception{
boolean flag = storeSubstituteService.updateById(storeSubstitute);
return ApiResult.result(flag);
}
/**
* 删除代发货表
*/
@PostMapping("/delete")
@ApiOperation(value = "删除StoreSubstitute对象",notes = "删除代发货表",response = ApiResult.class)
public ApiResult<Boolean> deleteStoreSubstitute(@Valid @RequestBody IdParam idParam) throws Exception{
boolean flag = storeSubstituteService.removeById(idParam.getId());
return ApiResult.result(flag);
}
/**
* 获取代发货表
*/
@PostMapping("/info")
@ApiOperation(value = "获取StoreSubstitute对象详情",notes = "查看代发货表",response = StoreSubstituteQueryVo.class)
public ApiResult<StoreSubstituteQueryVo> getStoreSubstitute(@Valid @RequestBody IdParam idParam) throws Exception{
StoreSubstituteQueryVo storeSubstituteQueryVo = storeSubstituteService.getStoreSubstituteById(idParam.getId());
return ApiResult.ok(storeSubstituteQueryVo);
}
/**
* 代发货表分页列表
*/
@PostMapping("/getPageList")
@ApiOperation(value = "获取StoreSubstitute分页列表",notes = "代发货表分页列表",response = StoreSubstituteQueryVo.class)
public ApiResult<Paging<StoreSubstituteQueryVo>> getStoreSubstitutePageList(@Valid @RequestBody(required = false) StoreSubstituteQueryParam storeSubstituteQueryParam) throws Exception{
Paging<StoreSubstituteQueryVo> paging = storeSubstituteService.getStoreSubstitutePageList(storeSubstituteQueryParam);
return ApiResult.ok(paging);
}
}
@@ -1,22 +0,0 @@
package com.ruoyi.app.distribution.web.param;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.ruoyi.app.common.web.param.QueryParam;
/**
* <p>
* 代发货表 查询参数对象
* </p>
*
* @author hupeng
* @date 2019-09-30
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value="StoreSubstituteQueryParam对象", description="代发货表查询参数")
public class StoreSubstituteQueryParam extends QueryParam {
private static final long serialVersionUID = 1L;
}
@@ -1,48 +0,0 @@
package com.ruoyi.app.distribution.web.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 代发货表 查询结果对象
* </p>
*
* @author hupeng
* @date 2019-09-30
*/
@Data
@ApiModel(value="StoreSubstituteQueryVo对象", description="代发货表查询参数")
public class StoreSubstituteQueryVo implements Serializable{
private static final long serialVersionUID = 1L;
private Long id;
@ApiModelProperty(value = "用户id")
private Integer userId;
@ApiModelProperty(value = "收货人姓名")
private String username;
@ApiModelProperty(value = "收货手机号")
private String phone;
@ApiModelProperty(value = "城市信息")
private String cityInfo;
@ApiModelProperty(value = "收货详细地址")
private String address;
@ApiModelProperty(value = "产品明细")
private String productInfo;
@ApiModelProperty(value = "创建时间")
private Integer createTime;
private Date updatedAt;
}
+1 -1
View File
@@ -43,7 +43,7 @@ light-security:
mybatis-plus: mybatis-plus:
mapper-locations: classpath*:com/ruoyi/app/common/persistence/dao/mapping/*.xml mapper-locations: classpath*:com/ruoyi/app/common/persistence/dao/mapping/*.xml,classpath*:mapper/**/*Mapper.xml
typeAliasesPackage: com.ruoyi.app.common.persistence.model typeAliasesPackage: com.ruoyi.app.common.persistence.model
global-config: global-config:
banner: false banner: false
@@ -1,18 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.app.modular.distribution.mapper.StoreSubstituteMapper">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, user_id, username, phone, city_info, address, product_info, create_time, updated_at
</sql>
<select id="getStoreSubstituteById" resultType="com.ruoyi.app.distribution.web.vo.StoreSubstituteQueryVo">
select <include refid="Base_Column_List"/> from store_substitute where id = #{id}
</select>
<select id="getStoreSubstitutePageList" resultType="com.ruoyi.app.distribution.web.vo.StoreSubstituteQueryVo">
select <include refid="Base_Column_List"/> from store_substitute
</select>
</mapper>
@@ -1,18 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.app.modular.distribution.mapper.StoreSubstituteMapper">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, user_id, username, phone, city_info, address, product_info, create_time, updated_at
</sql>
<select id="getStoreSubstituteById" resultType="com.ruoyi.app.modular.distribution.web.vo.StoreSubstituteQueryVo">
select <include refid="Base_Column_List"/> from store_substitute where id = #{id}
</select>
<select id="getStoreSubstitutePageList" resultType="com.ruoyi.app.modular.distribution.web.vo.StoreSubstituteQueryVo">
select <include refid="Base_Column_List"/> from store_substitute
</select>
</mapper>
@@ -43,7 +43,7 @@ public class CodeGenerator {
// 作者 // 作者
private static final String AUTHOR = "hupeng"; private static final String AUTHOR = "hupeng";
// 生成的表名称 // 生成的表名称
private static final String TABLE_NAME = "store_substitute"; private static final String TABLE_NAME = "store_goods_consult";
// 主键数据库列名称 // 主键数据库列名称
private static final String PK_ID_COLUMN_NAME = "id"; private static final String PK_ID_COLUMN_NAME = "id";
// 代码生成策略 true:All/false:SIMPLE // 代码生成策略 true:All/false:SIMPLE
@@ -62,7 +62,7 @@ public class CodeGenerator {
String projectPath = System.getProperty("user.dir"); String projectPath = System.getProperty("user.dir");
gc.setOutputDir(projectPath + "/ruoyi-api/src/main/java"); gc.setOutputDir(projectPath + "/ruoyi-api/src/main/java");
gc.setAuthor(AUTHOR); gc.setAuthor(AUTHOR);
gc.setOpen(true); // 是否打开输出目录 gc.setOpen(false); // 是否打开输出目录
gc.setSwagger2(true); // 启用swagger注解 gc.setSwagger2(true); // 启用swagger注解
gc.setIdType(IdType.ID_WORKER); // 主键类型:ID_WORKER gc.setIdType(IdType.ID_WORKER); // 主键类型:ID_WORKER
gc.setServiceName("%sService"); // 自定义文件命名,注意 %s 会自动填充表实体属性! gc.setServiceName("%sService"); // 自定义文件命名,注意 %s 会自动填充表实体属性!
@@ -85,6 +85,7 @@ public class CodeGenerator {
pc.setModuleName(MODULE_NAME); pc.setModuleName(MODULE_NAME);
pc.setParent("com.ruoyi.app.modular"); pc.setParent("com.ruoyi.app.modular");
pc.setController("web.controller"); pc.setController("web.controller");
pc.setMapper("dao");
mpg.setPackageInfo(pc); mpg.setPackageInfo(pc);