@@ -14,4 +14,4 @@ import java.util.List; | |||
*/ | |||
public interface AreaService{ | |||
public List<AreaVO> getAllArea(); | |||
} | |||
} |
@@ -1,5 +1,9 @@ | |||
package com.hp.user.client.service; | |||
import com.hp.user.client.entity.CustomerCompanyVO; | |||
import java.util.List; | |||
/** | |||
* <p> | |||
* 企业/公司 服务类 | |||
@@ -9,5 +13,10 @@ package com.hp.user.client.service; | |||
* @since 2020-11-20 | |||
*/ | |||
public interface CustomerCompanyService { | |||
public boolean insert(CustomerCompanyVO company); | |||
public boolean delete(Long companyId); | |||
public boolean update(CustomerCompanyVO company); | |||
public CustomerCompanyVO queryCompanyByCompanyId(Long companyId); | |||
public List<CustomerCompanyVO> queryAllCompany(); | |||
} |
@@ -49,8 +49,10 @@ | |||
<exclusion> | |||
<artifactId>spring-boot-starter-json</artifactId> | |||
<groupId>org.springframework.boot</groupId> | |||
</exclusion> | |||
<exclusion> | |||
<groupId>org.springframework</groupId> | |||
<artifactId>spring-beans</artifactId> | |||
<artifactId>spring-beans</artifactId> | |||
</exclusion> | |||
</exclusions> | |||
</dependency> | |||
@@ -149,7 +149,7 @@ public class CodeGeneractor { | |||
//设置自定义继承的Controller类全称,带包名 | |||
//strategy.setSuperControllerClass("com.jiangfeixiang.mpdemo.BaseController"); | |||
//设置自定义基础的Entity类,公共字段 | |||
// strategy.setSuperEntityColumns("id"); | |||
strategy.setSuperEntityColumns("id"); | |||
//驼峰转连字符 | |||
strategy.setControllerMappingHyphenStyle(true); | |||
//表名前缀 | |||
@@ -14,11 +14,9 @@ import org.springframework.context.annotation.ComponentScan; | |||
* @since 2020/11/18 | |||
* | |||
*/ | |||
@EnableSwagger2 | |||
@MapperScan("com.hp.user.service.dao") //扫描的mapper | |||
@SpringBootApplication | |||
@NacosPropertySource(dataId = "userdatasource", autoRefreshed = true) | |||
@ComponentScan("com.hp.user.service.config") | |||
public class UserServiceApplaction { | |||
public static void main(String[] args) { | |||
SpringApplication.run(UserServiceApplaction.class, args); | |||
@@ -15,8 +15,6 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; | |||
@Configuration | |||
@EnableSwagger2 | |||
public class SwaggerConfig1{ | |||
/** | |||
* 创建API应用 | |||
* apiInfo() 增加API相关信息 | |||
@@ -46,91 +44,4 @@ public class SwaggerConfig1{ | |||
.version("1.0") | |||
.build(); | |||
} | |||
// public static final String VERSION = "1.0.0"; | |||
// public static final String SWAGGER_SCAN_BASE_PACKAGE = "com.hp.user.service.controller"; | |||
// | |||
// | |||
// | |||
// @Bean | |||
// public Docket createRestApi() { | |||
// return new Docket(DocumentationType.SWAGGER_2) | |||
// .select() | |||
// /*此处为你的访问层接口包路径,即控制层所对应的包路径,这里 | |||
// *如果没有编写正确,会造成的在访问swagger2页面时没有接口信息出现 | |||
// */ | |||
// .apis(RequestHandlerSelectors.basePackage(SWAGGER_SCAN_BASE_PACKAGE)) | |||
// .paths(PathSelectors.any()) | |||
// .build().apiInfo(new ApiInfoBuilder() | |||
// //标题 | |||
// .title("基础框架系统开发文档API总览界面") | |||
// //描述 | |||
// .description("基础框架系统接口详细信息......") | |||
// //版本号 | |||
// .version("9.0") | |||
// //联系方式 | |||
//// .contact(new Contact("指尖上跳动的旋律","blog.csdn.net","xxx@qq.com")) | |||
//// //许可证 | |||
//// .license("指尖上跳动的旋律") | |||
// //许可证访问链接 | |||
//// .licenseUrl("https://blog.csdn.net/xuguoxing123") | |||
// .build()); | |||
// } | |||
// public void addResourceHandlers(ResourceHandlerRegistry registry) { | |||
// registry.addResourceHandler("**/swagger-ui.html") | |||
// .addResourceLocations("classpath:/META-INF/resources/"); | |||
// registry.addResourceHandler("/webjars*") | |||
// .addResourceLocations("classpath:/META-INF/resources/webjars/"); | |||
// } | |||
// private ApiInfo apiInfo() { | |||
// return new ApiInfoBuilder() | |||
// // 设置页面标题 | |||
// .title("使用swagger2构建后端api接口文档") | |||
// // 描述 | |||
// .description("欢迎访问后端接口文档,这里是描述信息") | |||
// // 定义版本号 | |||
// .version("1.0").build(); | |||
// } | |||
// @Bean | |||
// public Docket createRestApi() { | |||
// return new Docket(DocumentationType.SWAGGER_2) | |||
// .apiInfo(apiInfo()) | |||
// .select() | |||
// .apis(RequestHandlerSelectors.basePackage(SWAGGER_SCAN_BASE_PACKAGE)) | |||
// .paths(PathSelectors.any()) | |||
// .build(); | |||
// } | |||
// @Bean | |||
// RestDocConfig _swaggerConfig() | |||
// { | |||
// return RestDocConfig.builder() | |||
// .apiTitle("rest doc ywpt") | |||
// .apiDescription("用户信息系统") | |||
// .apiVersion("1.0.0") | |||
// .packages(Arrays.asList("com.hp.user.service.controller")) | |||
// .build(); | |||
// } | |||
// private ApiInfo apiInfo() { | |||
// return new ApiInfoBuilder() | |||
// .title("rest doc user") | |||
// .description("用户信息系统") | |||
//// .termsOfServiceUrl("http://www.cnblogs.com/congc/") | |||
// .version(VERSION) | |||
// .build(); | |||
// } | |||
// RestDocConfig _swaggerConfig() | |||
// { | |||
// return RestDocConfig.builder() | |||
// .apiTitle("rest doc user") | |||
// .apiDescription("用户信息系统") | |||
// .apiVersion("1.0.0") | |||
// .packages(Arrays.asList("com.hp.user.service.controller")) | |||
// .build(); | |||
// } | |||
} |
@@ -1,15 +1,13 @@ | |||
package com.hp.user.service.controller; | |||
import com.hp.user.client.entity.AreaVO; | |||
import com.hp.user.service.dao.AreaMapper; | |||
import com.hp.user.service.entity.Area; | |||
import com.hp.user.utils.HttpResult; | |||
import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiOperation; | |||
import com.hp.user.client.service.UserAreaService; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.GetMapping; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RequestMethod; | |||
import org.springframework.web.bind.annotation.RestController; | |||
import java.util.List; | |||
@@ -28,6 +26,7 @@ public class AreaController { | |||
@GetMapping("/queryAllArea") | |||
@ApiOperation(value = "获取所有地区信息", notes = "获取所有地区信息", httpMethod = "GET") | |||
public List<AreaVO> queryAllArea(){ | |||
return areaService.getAllArea(); | |||
List<AreaVO> areas = areaService.getAllArea(); | |||
return areas; | |||
} | |||
} |
@@ -1,14 +1,14 @@ | |||
package com.hp.user.service.controller; | |||
import com.hp.user.client.entity.CustomerCompanyVO; | |||
import com.hp.user.client.service.CustomerCompanyService; | |||
import com.hp.user.utils.HttpResult; | |||
import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiOperation; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.PostMapping; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RestController; | |||
import org.springframework.web.bind.annotation.*; | |||
@Api(description = "公司API接口") | |||
@Api(tags = "企业/服务商API接口") | |||
@RestController | |||
@RequestMapping("/company") | |||
public class CompanyController { | |||
@@ -16,45 +16,53 @@ public class CompanyController { | |||
private CustomerCompanyService customerCompanyService; | |||
/** | |||
* 添加企业 | |||
* 需要企业信息 | |||
*/ | |||
@ApiOperation(value="新增企业") | |||
@ApiOperation(value = "新增企业", notes = "新增企业", httpMethod = "POST") | |||
@PostMapping("/addCompany") | |||
public void addCompany(){ | |||
public HttpResult addCompany(@RequestBody CustomerCompanyVO company){ | |||
company.setCustomerId(123L); | |||
boolean flag=customerCompanyService.insert(company); | |||
if(flag) return HttpResult.success(company.getCustomerId()); | |||
else return HttpResult.fail(); | |||
} | |||
/** | |||
* 更新企业信息 | |||
* 需要企业信息 | |||
*/ | |||
@RequestMapping("/updateCompany") | |||
public void updateCompany(){ | |||
@ApiOperation(value = "更新企业信息", notes = "更新企业信息", httpMethod = "POST") | |||
@PostMapping("/updateCompany") | |||
public HttpResult updateCompany(@RequestBody CustomerCompanyVO company){ | |||
boolean flag=customerCompanyService.update(company); | |||
if(flag) return HttpResult.success(); | |||
else return HttpResult.fail(); | |||
} | |||
/** | |||
* 根据企业Id删除企业 | |||
* @param companyId 企业Id | |||
*/ | |||
@RequestMapping("/deleteCompanyByCompanyId") | |||
public void deleteCompanyByCompanyId(String companyId){ | |||
@ApiOperation(value = "删除企业", notes = "删除企业", httpMethod = "GET") | |||
@GetMapping("/deleteCompanyByCompanyId") | |||
public HttpResult deleteCompanyByCompanyId(@RequestParam String companyId){ | |||
boolean flag=customerCompanyService.delete(Long.parseLong(companyId)); | |||
if(flag) return HttpResult.success(); | |||
else return HttpResult.fail(); | |||
} | |||
/** | |||
* 根据企业Id查询某企业全部信息 | |||
* 根据企业Id查询某企业信息 | |||
* @param companyId 企业Id | |||
*/ | |||
@RequestMapping("/queryCompanyByCompanyId") | |||
public void queryCompanyByCompanyId(String companyId){ | |||
@ApiOperation(value="根据企业Id查询某企业信息") | |||
@GetMapping("/queryCompanyByCompanyId") | |||
public CustomerCompanyVO queryCompanyByCompanyId(@RequestParam String companyId){ | |||
return customerCompanyService.queryCompanyByCompanyId(Long.parseLong(companyId)); | |||
} | |||
/** | |||
* 查询所有企业基本信息 | |||
*/ | |||
@RequestMapping("/queryAllCompany") | |||
@GetMapping("/queryAllCompany") | |||
public void queryAllCompany(){ | |||
} | |||
@@ -63,7 +71,7 @@ public class CompanyController { | |||
* 查询某企业的所有用户 | |||
* @param companyId 企业Id | |||
*/ | |||
@RequestMapping("/queryAllUserOfCompany") | |||
@GetMapping("/queryAllUserOfCompany") | |||
public void queryAllUserOfCompany(String companyId){ | |||
} | |||
@@ -73,7 +81,7 @@ public class CompanyController { | |||
* @param companyId 企业Id | |||
* @param userId 用户Id | |||
*/ | |||
@RequestMapping("/associateCompanyAndUser") | |||
@GetMapping("/associateCompanyAndUser") | |||
public void associateCompanyAndUser(String companyId,String userId){ | |||
} | |||
@@ -83,7 +91,7 @@ public class CompanyController { | |||
* @param companyId 企业Id | |||
* @param userId 用户Id | |||
*/ | |||
@RequestMapping("/dissociateCompanyAndUser") | |||
@GetMapping("/dissociateCompanyAndUser") | |||
public void dissociateCompanyAndUser(String companyId,String userId){ | |||
} | |||
@@ -1,5 +1,7 @@ | |||
package com.hp.user.service.entity; | |||
import com.baomidou.mybatisplus.annotation.IdType; | |||
import com.baomidou.mybatisplus.annotation.TableId; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import java.util.Date; | |||
@@ -21,6 +23,7 @@ public class Account extends Base{ | |||
/** | |||
* 用户Id | |||
*/ | |||
@TableId(value = "user_id") | |||
private Long userId; | |||
/** | |||
* 用户名 | |||
@@ -1,5 +1,7 @@ | |||
package com.hp.user.service.entity; | |||
import com.baomidou.mybatisplus.annotation.IdType; | |||
import com.baomidou.mybatisplus.annotation.TableId; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import java.math.BigDecimal; | |||
@@ -22,6 +24,7 @@ public class Address extends Base{ | |||
/** | |||
* 地址Id | |||
*/ | |||
@TableId(value = "address_id") | |||
private Long addressId; | |||
/** | |||
* 所属Id | |||
@@ -1,5 +1,7 @@ | |||
package com.hp.user.service.entity; | |||
import com.baomidou.mybatisplus.annotation.IdType; | |||
import com.baomidou.mybatisplus.annotation.TableId; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import java.io.Serializable; | |||
@@ -19,6 +21,7 @@ public class Area implements Serializable { | |||
/** | |||
* 地区Id | |||
*/ | |||
@TableId(value = "id") | |||
private Long id; | |||
/** | |||
* 区划编码 | |||
@@ -12,59 +12,60 @@ public class Base implements Serializable { | |||
/** | |||
* 创建时间 | |||
*/ | |||
private Date createTime; | |||
private Date sysCreateTime; | |||
/** | |||
* 创建用户Id | |||
*/ | |||
private Long createUserId; | |||
private Long sysCreateUserId; | |||
/** | |||
* 更新时间 | |||
*/ | |||
private Date updateTime; | |||
private Date sysUpdateTime; | |||
/** | |||
* 更新用户Id | |||
*/ | |||
private Long updateUserId; | |||
private Long syspdateUserId; | |||
public Base(){ | |||
} | |||
public Base(Date createTime, Long createUserId, Date updateTime, Long updateUserId) { | |||
this.createTime = createTime; | |||
this.createUserId = createUserId; | |||
this.updateTime = updateTime; | |||
this.updateUserId = updateUserId; | |||
public Base(Date sysCreateTime, Long sysCreateUserId, Date sysUpdateTime, Long syspdateUserId) { | |||
this.sysCreateTime = sysCreateTime; | |||
this.sysCreateUserId = sysCreateUserId; | |||
this.sysUpdateTime = sysUpdateTime; | |||
this.syspdateUserId = syspdateUserId; | |||
} | |||
public Date getCreateTime() { | |||
return createTime; | |||
public Date getSysCreateTime() { | |||
return sysCreateTime; | |||
} | |||
public void setCreateTime(Date createTime) { | |||
this.createTime = createTime; | |||
public void setSysCreateTime(Date sysCreateTime) { | |||
this.sysCreateTime = sysCreateTime; | |||
} | |||
public Long getCreateUserId() { | |||
return createUserId; | |||
public Long getSysCreateUserId() { | |||
return sysCreateUserId; | |||
} | |||
public void setCreateUserId(Long createUserId) { | |||
this.createUserId = createUserId; | |||
public void setSysCreateUserId(Long sysCreateUserId) { | |||
this.sysCreateUserId = sysCreateUserId; | |||
} | |||
public Date getUpdateTime() { | |||
return updateTime; | |||
public Date getSysUpdateTime() { | |||
return sysUpdateTime; | |||
} | |||
public void setUpdateTime(Date updateTime) { | |||
this.updateTime = updateTime; | |||
public void setSysUpdateTime(Date sysUpdateTime) { | |||
this.sysUpdateTime = sysUpdateTime; | |||
} | |||
public Long getUpdateUserId() { | |||
return updateUserId; | |||
public Long getSyspdateUserId() { | |||
return syspdateUserId; | |||
} | |||
public void setUpdateUserId(Long updateUserId) { | |||
this.updateUserId = updateUserId; | |||
public void setSyspdateUserId(Long syspdateUserId) { | |||
this.syspdateUserId = syspdateUserId; | |||
} | |||
} |
@@ -1,5 +1,7 @@ | |||
package com.hp.user.service.entity; | |||
import com.baomidou.mybatisplus.annotation.IdType; | |||
import com.baomidou.mybatisplus.annotation.TableId; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import java.util.Date; | |||
@@ -20,6 +22,7 @@ public class CustomerCompany extends Base { | |||
/** | |||
* 客户Id | |||
*/ | |||
@TableId(value = "customer_id") | |||
private Long customerId; | |||
/** | |||
* 企业名称 | |||
@@ -1,5 +1,7 @@ | |||
package com.hp.user.service.entity; | |||
import com.baomidou.mybatisplus.annotation.IdType; | |||
import com.baomidou.mybatisplus.annotation.TableId; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import java.io.Serializable; | |||
@@ -17,6 +19,12 @@ import java.io.Serializable; | |||
//@Accessors(chain = true) | |||
@TableName("r_customer_service_provider_enterprise") | |||
public class CustomerServiceProviderEnterprise implements Serializable { | |||
/** | |||
* Id | |||
*/ | |||
@TableId(value = "id") | |||
private Long Id; | |||
/** | |||
* 服务商Id | |||
*/ | |||
@@ -1,5 +1,7 @@ | |||
package com.hp.user.service.entity; | |||
import com.baomidou.mybatisplus.annotation.IdType; | |||
import com.baomidou.mybatisplus.annotation.TableId; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import java.math.BigDecimal; | |||
@@ -21,6 +23,7 @@ public class Station extends Base{ | |||
/** | |||
* 站点Id | |||
*/ | |||
@TableId(value = "station_id") | |||
private Long stationId; | |||
/** | |||
* 站点名称 | |||
@@ -1,8 +1,16 @@ | |||
package com.hp.user.service.impl; | |||
import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; | |||
import com.hp.user.client.entity.CustomerCompanyVO; | |||
import com.hp.user.client.service.CustomerCompanyService; | |||
import com.hp.user.service.dao.CustomerCompanyMapper; | |||
import com.hp.user.service.entity.CustomerCompany; | |||
import org.springframework.beans.BeanUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import java.util.List; | |||
/** | |||
* <p> | |||
* 企业/公司 服务实现类 | |||
@@ -13,5 +21,37 @@ import org.springframework.stereotype.Service; | |||
*/ | |||
@Service | |||
public class CustomerCompanyServiceImpl implements CustomerCompanyService { | |||
@Autowired | |||
private CustomerCompanyMapper customerCompanyMapper; | |||
@Override | |||
public boolean insert(CustomerCompanyVO company) { | |||
CustomerCompany temp=new CustomerCompany(); | |||
BeanUtils.copyProperties(company,temp); | |||
// 判断数据库操作是否成功 | |||
return SqlHelper.retBool(customerCompanyMapper.insert(temp)); | |||
} | |||
@Override | |||
public boolean delete(Long companyId) { | |||
// 判断数据库操作是否成功 | |||
return SqlHelper.retBool(customerCompanyMapper.deleteById(companyId)); | |||
} | |||
@Override | |||
public boolean update(CustomerCompanyVO company) { | |||
CustomerCompany temp=new CustomerCompany(); | |||
BeanUtils.copyProperties(company,temp); | |||
// 判断数据库操作是否成功 | |||
return SqlHelper.retBool(customerCompanyMapper.updateById(temp)); | |||
} | |||
@Override | |||
public CustomerCompanyVO queryCompanyByCompanyId(Long companyId) { | |||
return null; | |||
} | |||
@Override | |||
public List<CustomerCompanyVO> queryAllCompany() { | |||
return null; | |||
} | |||
} |
@@ -0,0 +1,56 @@ | |||
package com.hp.user.utils; | |||
import java.io.Serializable; | |||
public class HttpResult implements Serializable{ | |||
private int code; // 状态码 | |||
private String message; | |||
private Object data; | |||
public HttpResult(){ | |||
} | |||
public HttpResult(int code, String message, Object data){ | |||
this.code = code; | |||
this.message = message; | |||
this.data = data; | |||
} | |||
public static HttpResult success(){ | |||
return new HttpResult(0, "操作成功", ""); | |||
} | |||
public static HttpResult success(Object data){ | |||
return new HttpResult(0, "操作成功", data); | |||
} | |||
public static HttpResult fail(){ | |||
return new HttpResult(-1, "操作失败", ""); | |||
} | |||
public static HttpResult fail(String message){ | |||
return new HttpResult(-1, message, ""); | |||
} | |||
public int getCode() { | |||
return code; | |||
} | |||
public void setCode(int code) { | |||
this.code = code; | |||
} | |||
public String getMessage() { | |||
return message; | |||
} | |||
public void setMessage(String message) { | |||
this.message = message; | |||
} | |||
public Object getData() { | |||
return data; | |||
} | |||
public void setData(Object data) { | |||
this.data = data; | |||
} | |||
} |