Compare commits
No commits in common. "master" and "main" have entirely different histories.
@ -1,11 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||
<data-source source="LOCAL" name="demo@106.52.88.120" uuid="494d4563-66cc-49c2-863b-5ab76f35808f">
|
||||
<data-source source="LOCAL" name="demo@106.52.88.120" uuid="162927cd-2825-459f-87c5-04b4b06d32a9">
|
||||
<driver-ref>mysql.8</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
|
||||
<jdbc-url>jdbc:mysql://106.52.88.120:3306/demo?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai</jdbc-url>
|
||||
<jdbc-url>jdbc:mysql://106.52.88.120:3306/demo</jdbc-url>
|
||||
<jdbc-additional-properties>
|
||||
<property name="com.intellij.clouds.kubernetes.db.host.port" />
|
||||
<property name="com.intellij.clouds.kubernetes.db.enabled" value="false" />
|
||||
|
@ -8,7 +8,7 @@
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_23" default="true" project-jdk-name="17" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="17" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
6
.idea/sqldialects.xml
Normal file
6
.idea/sqldialects.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="SqlDialectMappings">
|
||||
<file url="PROJECT" dialect="MySQL" />
|
||||
</component>
|
||||
</project>
|
@ -1,7 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
@ -1,118 +0,0 @@
|
||||
package net.carbon.config;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.stereotype.Component;
|
||||
import springfox.documentation.builders.*;
|
||||
import springfox.documentation.oas.annotations.EnableOpenApi;
|
||||
import springfox.documentation.schema.ScalarType;
|
||||
import springfox.documentation.service.*;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@EnableOpenApi
|
||||
@Data
|
||||
public class SwaggerConfiguration {
|
||||
|
||||
|
||||
/**
|
||||
* C端文档
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
public Docket webApiDoc() {
|
||||
|
||||
|
||||
return new Docket(DocumentationType.OAS_30)
|
||||
.groupName("用户端接口文档")
|
||||
.pathMapping("/")
|
||||
// 定义是否开启swagger,false为关闭,可以通过变量控制,线上关闭
|
||||
.enable(true)
|
||||
//配置api文档元信息
|
||||
.apiInfo(apiInfo())
|
||||
// 选择哪些接口作为swagger的doc发布
|
||||
.select()
|
||||
.apis(RequestHandlerSelectors.basePackage("net.carbon"))
|
||||
//正则匹配请求路径,并分配至当前分组
|
||||
.paths(PathSelectors.ant("/api/**"))
|
||||
.build()
|
||||
//新版swagger3.0配置
|
||||
.globalRequestParameters(getGlobalRequestParameters())
|
||||
.globalResponses(HttpMethod.GET, getGlobalResponseMessage())
|
||||
.globalResponses(HttpMethod.POST, getGlobalResponseMessage());
|
||||
}
|
||||
|
||||
|
||||
private ApiInfo apiInfo() {
|
||||
return new ApiInfoBuilder()
|
||||
.title("碳中和")
|
||||
.description("接口文档")
|
||||
.contact(new Contact("jieyuu", "https://106.52.88.120", "645634619@qq.com"))
|
||||
.version("12")
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 管理端文档
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
public Docket adminApiDoc() {
|
||||
return new Docket(DocumentationType.OAS_30)
|
||||
.groupName("管理端接口文档")
|
||||
.pathMapping("/")
|
||||
// 定义是否开启swagger,false为关闭,可以通过变量控制,线上关闭
|
||||
.enable(true)
|
||||
//配置api文档元信息
|
||||
.apiInfo(apiInfo())
|
||||
// 选择哪些接口作为swagger的doc发布
|
||||
.select()
|
||||
.apis(RequestHandlerSelectors.basePackage("net.jieyuu"))
|
||||
//正则匹配请求路径,并分配至当前分组
|
||||
.paths(PathSelectors.ant("/admin/**"))
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成全局通用参数, 支持配置多个响应参数
|
||||
* @return
|
||||
*/
|
||||
private List<RequestParameter> getGlobalRequestParameters() {
|
||||
List<RequestParameter> parameters = new ArrayList<>();
|
||||
parameters.add(new RequestParameterBuilder()
|
||||
.name("token")
|
||||
.description("登录令牌")
|
||||
.in(ParameterType.HEADER)
|
||||
.query(q -> q.model(m -> m.scalarModel(ScalarType.STRING)))
|
||||
.required(false)
|
||||
.build());
|
||||
|
||||
// parameters.add(new RequestParameterBuilder()
|
||||
// .name("version")
|
||||
// .description("版本号")
|
||||
// .required(true)
|
||||
// .in(ParameterType.HEADER)
|
||||
// .query(q -> q.model(m -> m.scalarModel(ScalarType.STRING)))
|
||||
// .required(false)
|
||||
// .build());
|
||||
return parameters;
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成通用响应信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private List<Response> getGlobalResponseMessage() {
|
||||
List<Response> responseList = new ArrayList<>();
|
||||
responseList.add(new ResponseBuilder().code("4xx").description("请求错误,根据code和msg检查").build());
|
||||
return responseList;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package net.carbon.controller;
|
||||
|
||||
import net.carbon.model.vo.AchievementVO;
|
||||
import net.carbon.result.Result;
|
||||
import net.carbon.service.AchievementService;
|
||||
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.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/achievement/v1")
|
||||
public class AchievementController {
|
||||
@Autowired
|
||||
private AchievementService achievementService;
|
||||
|
||||
@GetMapping("/list")
|
||||
public Result<List<AchievementVO>> getList(@RequestParam("page") Long page, @RequestParam("pageSize") Long pageSize, @RequestParam("projectID") String projectID){
|
||||
List<AchievementVO> list = achievementService.getList(page,pageSize,projectID);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
}
|
@ -5,6 +5,7 @@ import net.carbon.model.request.EconomicsUpdateRequest;
|
||||
import net.carbon.model.vo.EconomicsVO;
|
||||
import net.carbon.result.Result;
|
||||
import net.carbon.service.EconomicsService;
|
||||
import net.carbon.utils.JsonData;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -15,7 +16,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
* @since 2025-02-21 13:44:09
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/economics/v1/")
|
||||
@RequestMapping("/api/economics/v1")
|
||||
public class EconomicsController {
|
||||
|
||||
/**
|
||||
@ -114,5 +115,14 @@ public class EconomicsController {
|
||||
}
|
||||
return Result.error("删除失败");
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public JsonData add(@RequestBody EconomicsUpdateRequest economicsUpdateRequest){
|
||||
int row = economicsService.add(economicsUpdateRequest);
|
||||
if (row > 0) {
|
||||
return JsonData.buildCodeAndMsg(1,"添加成功");
|
||||
}
|
||||
return JsonData.buildError("添加失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,7 @@ import net.carbon.model.request.LabelUpdateRequest;
|
||||
import net.carbon.model.vo.LabelVO;
|
||||
import net.carbon.result.Result;
|
||||
import net.carbon.service.LabelService;
|
||||
import net.carbon.utils.JsonData;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -67,5 +68,14 @@ public class LabelController {
|
||||
return Result.error("删除失败");
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/add")
|
||||
public JsonData add(@RequestBody LabelUpdateRequest labelUpdateRequest){
|
||||
int row = labelService.add(labelUpdateRequest);
|
||||
if (row >0){
|
||||
return JsonData.buildCodeAndMsg(1,"添加成功");
|
||||
}
|
||||
return JsonData.buildError("添加失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,42 @@
|
||||
package net.carbon.controller;
|
||||
|
||||
import net.carbon.model.request.AchievementRequest;
|
||||
import net.carbon.model.request.ProjectRequest;
|
||||
import net.carbon.model.vo.ProjectVO;
|
||||
import net.carbon.service.ProjectService;
|
||||
import net.carbon.utils.JsonData;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/project/v1")
|
||||
public class ProjectController {
|
||||
|
||||
@Autowired
|
||||
private ProjectService projectService;
|
||||
@GetMapping("/info")
|
||||
public JsonData getUserProject(@RequestParam("userProjectId") String userProjectId){
|
||||
List<ProjectVO> projectVOList = projectService.userProject(userProjectId);
|
||||
return JsonData.buildSuccess(projectVOList);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
public JsonData addProject(@RequestBody ProjectRequest projectRequest){
|
||||
projectService.addProject(projectRequest);
|
||||
return JsonData.buildSuccess();
|
||||
}
|
||||
|
||||
@PutMapping("/edit")
|
||||
public JsonData editProject(@RequestBody AchievementRequest achievementRequest){
|
||||
projectService.editProject(achievementRequest);
|
||||
return JsonData.buildSuccess();
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
public JsonData deletePropertyAndProjectUser(@RequestParam("id") Long id){
|
||||
projectService.deleteProAndPU(id);
|
||||
return JsonData.buildSuccess();
|
||||
}
|
||||
}
|
@ -5,19 +5,21 @@ import net.carbon.model.request.TimelyWarningRequest;
|
||||
import net.carbon.model.vo.TimelyWarningVO;
|
||||
import net.carbon.result.Result;
|
||||
import net.carbon.service.TimelyWarningService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api")
|
||||
public class TimelyWarningController {
|
||||
|
||||
@Autowired
|
||||
private TimelyWarningService timelyWarningService;
|
||||
|
||||
@GetMapping("/TimelyWarning")
|
||||
@GetMapping("/api/TimelyWarning")
|
||||
public Result<PageResponse<TimelyWarningVO>> get(@RequestParam("pageSize") Long pageSize, @RequestParam("page") Long page) {
|
||||
return Result.success(timelyWarningService.getList(pageSize, page));
|
||||
}
|
||||
|
||||
@DeleteMapping("warn/delete")
|
||||
@DeleteMapping("/api/warn/delete")
|
||||
public Result<Boolean> delete(@RequestParam("id") Long id) {
|
||||
int row = timelyWarningService.delete(id);
|
||||
if (row > 0) {
|
||||
@ -26,7 +28,7 @@ public class TimelyWarningController {
|
||||
return Result.error("删除失败");
|
||||
}
|
||||
|
||||
@PostMapping("warn/edit")
|
||||
@PostMapping("/api/warn/edit")
|
||||
public Result update(@RequestBody TimelyWarningRequest timelyWarningRequest) {
|
||||
int row = timelyWarningService.updateById(timelyWarningRequest);
|
||||
if (row > 0) {
|
||||
@ -35,7 +37,7 @@ public class TimelyWarningController {
|
||||
return Result.error("修改失败");
|
||||
}
|
||||
|
||||
@PostMapping("warn/add")
|
||||
@PostMapping("/api/warn/add")
|
||||
public Result add(@RequestBody TimelyWarningRequest timelyWarningRequest) {
|
||||
timelyWarningService.add(timelyWarningRequest);
|
||||
return Result.success();
|
||||
|
@ -2,6 +2,8 @@ package net.carbon.controller;
|
||||
|
||||
//import io.swagger.annotations.ApiParam;
|
||||
|
||||
import net.carbon.model.po.UserDO;
|
||||
import net.carbon.model.vo.ProjectVO;
|
||||
import net.carbon.model.vo.UserVO;
|
||||
import net.carbon.model.request.UserRegisterRequest;
|
||||
import net.carbon.model.request.UserLoginRequest;
|
||||
@ -10,6 +12,8 @@ import net.carbon.utils.JsonData;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/user/v1")
|
||||
public class UserController {
|
||||
@ -57,4 +61,9 @@ public class UserController {
|
||||
return JsonData.buildSuccess(userinfo);
|
||||
}
|
||||
|
||||
@PutMapping("/updataUserinfo")
|
||||
public JsonData updateUserinfo(@RequestBody UserDO userDO) {
|
||||
userService.updateUserinfo(userDO);
|
||||
return JsonData.buildCodeAndMsg(200,"修改成功");
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package net.carbon.mapper;
|
||||
|
||||
import net.carbon.model.vo.AchievementVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface AchievementMapper {
|
||||
|
||||
List<AchievementVO> getList(@Param("startRow") Long startRow,@Param("pageSize") Long pageSize,@Param("projectID") String projectID);
|
||||
}
|
@ -3,6 +3,7 @@ package net.carbon.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import net.carbon.model.po.EconomicsDO;
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
|
||||
@ -17,4 +18,7 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
@Mapper
|
||||
public interface EconomicsMapper extends BaseMapper<EconomicsDO> {
|
||||
|
||||
@Insert("insert into economics (name, unit, data, attribute, is_system_date, is_delete) values " +
|
||||
"(#{name},#{unit},#{data},#{attribute},#{isSystemDate},#{isDelete})")
|
||||
Integer add(EconomicsDO economicsDO);
|
||||
}
|
@ -2,6 +2,7 @@ package net.carbon.mapper;
|
||||
|
||||
import net.carbon.model.po.LabelDO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
@ -15,4 +16,6 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
@Mapper
|
||||
public interface LabelMapper extends BaseMapper<LabelDO> {
|
||||
|
||||
@Insert("insert into label (name, unit, data_value, attribute, is_system_date, is_delete) values (#{name},#{unit},#{dataValue},#{attribute},#{isSystemDate},#{isDeleted})")
|
||||
int add(LabelDO labelDO);
|
||||
}
|
||||
|
30
server/src/main/java/net/carbon/mapper/ProjectMapper.java
Normal file
30
server/src/main/java/net/carbon/mapper/ProjectMapper.java
Normal file
@ -0,0 +1,30 @@
|
||||
package net.carbon.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import net.carbon.model.po.AchievementDO;
|
||||
import net.carbon.model.request.ProjectRequest;
|
||||
import net.carbon.model.vo.AchievementVO;
|
||||
import net.carbon.model.vo.ProjectVO;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface ProjectMapper extends BaseMapper<ProjectRequest> {
|
||||
|
||||
@Select("select * from project_user where projectId = #{userProjectId}")
|
||||
List<ProjectVO> userProject(String userProjectId);
|
||||
|
||||
void update(AchievementDO achievementDO);
|
||||
|
||||
@Delete("delete from project_property where id = #{id}")
|
||||
void deleteProperty(Long id);
|
||||
|
||||
@Delete("delete from project_user where property_id = #{propertyId}")
|
||||
void deleteProjectUser(Long propertyId);
|
||||
|
||||
@Select("select projectId from project_user where user_id = #{id}")
|
||||
String getProjectIdByUserId(Long id);
|
||||
}
|
@ -3,10 +3,15 @@ package net.carbon.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import net.carbon.model.po.TimelyWarningDO;
|
||||
import net.carbon.model.request.TimelyWarningRequest;
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
|
||||
@Mapper
|
||||
public interface TimelyWarningMapper extends BaseMapper<TimelyWarningDO> {
|
||||
|
||||
@Insert("insert into timely_warning (name, unit, data, direction) values " +
|
||||
"(#{name},#{unit},#{data},#{direction})")
|
||||
void add(TimelyWarningRequest timelyWarningRequest);
|
||||
}
|
@ -16,4 +16,5 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
@Mapper
|
||||
public interface UserMapper extends BaseMapper<UserDO> {
|
||||
|
||||
void updateUserinfo(UserDO userDO);
|
||||
}
|
||||
|
@ -1,61 +0,0 @@
|
||||
package net.carbon.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author jieyuu
|
||||
* @since 2024-12-29
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("carbon_emission")
|
||||
public class CarbonEmissionDO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
private String city;
|
||||
|
||||
private BigDecimal wastewaterDischargeTotal;
|
||||
|
||||
private BigDecimal airQualityAchievementRate;
|
||||
|
||||
private BigDecimal gdpElectricityConsumption;
|
||||
|
||||
private BigDecimal wasteResourceIndustryValue;
|
||||
|
||||
private BigDecimal forestCoverageRate;
|
||||
|
||||
private BigDecimal ecologicalIndex;
|
||||
|
||||
private BigDecimal importExportTotal;
|
||||
|
||||
private Integer foreignInvestmentEnterprises;
|
||||
|
||||
private BigDecimal tourismIncome;
|
||||
|
||||
private Integer overnightTourists;
|
||||
|
||||
private BigDecimal publicManagementDensity;
|
||||
|
||||
private BigDecimal perCapitaServiceFunds;
|
||||
|
||||
private BigDecimal averageAnnualSalary;
|
||||
|
||||
private BigDecimal urbanPerCapitaIncome;
|
||||
|
||||
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
package net.carbon.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author jieyuu
|
||||
* @since 2024-11-23
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("user")
|
||||
public class UserDO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
private String username;
|
||||
|
||||
private String password;
|
||||
}
|
20
server/src/main/java/net/carbon/model/po/AchievementDO.java
Normal file
20
server/src/main/java/net/carbon/model/po/AchievementDO.java
Normal file
@ -0,0 +1,20 @@
|
||||
package net.carbon.model.po;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class AchievementDO {
|
||||
private Long id;
|
||||
private String nodex;
|
||||
private String unit;
|
||||
private String arribure;
|
||||
private String dataValue;
|
||||
private String updataData;
|
||||
private String leibi;
|
||||
private String indexClassification;
|
||||
private String assess;
|
||||
}
|
@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
@Data
|
||||
@ -28,4 +29,11 @@ public class TimelyWarningDO implements Serializable {
|
||||
|
||||
@TableField("direction")
|
||||
private String direction;
|
||||
|
||||
@TableField("add_time")
|
||||
private LocalDateTime addTime;
|
||||
|
||||
@TableField("update_time")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,20 @@
|
||||
package net.carbon.model.request;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class AchievementRequest {
|
||||
private Long id;
|
||||
private String nodex;
|
||||
private String unit;
|
||||
private String arribure;
|
||||
private String dataValue;
|
||||
private String updataData;
|
||||
private String leibi;
|
||||
private String indexClassification;
|
||||
private String assess;
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package net.carbon.model.request;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName("project_user")
|
||||
public class ProjectRequest {
|
||||
@TableField("user_id")
|
||||
private String userid;
|
||||
@TableField("projectName")
|
||||
private String projectName;
|
||||
@TableField("projectTeritory")
|
||||
private String projectTeritory;
|
||||
private String principal;
|
||||
private String type;
|
||||
@TableField("projectId")
|
||||
private String projectId;
|
||||
private Long propertyId;
|
||||
}
|
20
server/src/main/java/net/carbon/model/vo/AchievementVO.java
Normal file
20
server/src/main/java/net/carbon/model/vo/AchievementVO.java
Normal file
@ -0,0 +1,20 @@
|
||||
package net.carbon.model.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class AchievementVO {
|
||||
private Long id;
|
||||
private String nodex;
|
||||
private String unit;
|
||||
private String arribure;
|
||||
private String dataValue;
|
||||
private String updataData;
|
||||
private String leibi;
|
||||
private String indexClassification;
|
||||
private String assess;
|
||||
}
|
14
server/src/main/java/net/carbon/model/vo/ProjectVO.java
Normal file
14
server/src/main/java/net/carbon/model/vo/ProjectVO.java
Normal file
@ -0,0 +1,14 @@
|
||||
package net.carbon.model.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ProjectVO {
|
||||
private Long id;
|
||||
private String projectName;
|
||||
private String projectTeritory;
|
||||
private String principal;
|
||||
private String type;
|
||||
private String projectId;
|
||||
private String propertyId;
|
||||
}
|
@ -1,7 +1,10 @@
|
||||
package net.carbon.model.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class TimelyWarningVO {
|
||||
|
||||
@ -14,4 +17,10 @@ public class TimelyWarningVO {
|
||||
private Double data;
|
||||
|
||||
private String direction;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime addTime;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
|
@ -42,4 +42,9 @@ public class UserVO {
|
||||
* 用户地址
|
||||
*/
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 用户项目
|
||||
*/
|
||||
private String userProjectId;
|
||||
}
|
||||
|
@ -1,20 +0,0 @@
|
||||
package net.carbon.request;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "登录对象", description = "用户登录请求对象")
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class UserLoginRequest {
|
||||
|
||||
@ApiModelProperty(value = "用户名", example = "jieyuu")
|
||||
private String username;
|
||||
|
||||
@ApiModelProperty(value = "密码", example = "123456")
|
||||
private String password;
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
package net.carbon.request;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "用户注册实体类")
|
||||
public class UserRegisterRequest {
|
||||
|
||||
@ApiModelProperty(value = "用户名", example = "123456")
|
||||
private String username;
|
||||
|
||||
@ApiModelProperty(value = "密码", example = "123456")
|
||||
private String password;
|
||||
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package net.carbon.service;
|
||||
|
||||
import net.carbon.model.vo.AchievementVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface AchievementService {
|
||||
List<AchievementVO> getList(Long page, Long pageSize, String projectID);
|
||||
}
|
@ -20,5 +20,6 @@ public interface EconomicsService extends IService<EconomicsDO> {
|
||||
|
||||
Integer updateById(EconomicsUpdateRequest economicsUpdateReq);
|
||||
|
||||
Integer add(EconomicsUpdateRequest economicsUpdateRequest);
|
||||
}
|
||||
|
||||
|
@ -25,4 +25,5 @@ public interface LabelService extends IService<LabelDO> {
|
||||
|
||||
int updateById(LabelUpdateRequest labelUpdateReq);
|
||||
|
||||
int add(LabelUpdateRequest labelUpdateRequest);
|
||||
}
|
||||
|
17
server/src/main/java/net/carbon/service/ProjectService.java
Normal file
17
server/src/main/java/net/carbon/service/ProjectService.java
Normal file
@ -0,0 +1,17 @@
|
||||
package net.carbon.service;
|
||||
|
||||
import net.carbon.model.request.AchievementRequest;
|
||||
import net.carbon.model.request.ProjectRequest;
|
||||
import net.carbon.model.vo.ProjectVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ProjectService {
|
||||
List<ProjectVO> userProject(String userProjectId);
|
||||
|
||||
void addProject(ProjectRequest projectRequest);
|
||||
|
||||
void editProject(AchievementRequest achievementRequest);
|
||||
|
||||
void deleteProAndPU(Long id);
|
||||
}
|
@ -3,11 +3,14 @@ package net.carbon.service;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import net.carbon.model.po.UserDO;
|
||||
|
||||
import net.carbon.model.vo.ProjectVO;
|
||||
import net.carbon.model.vo.UserVO;
|
||||
import net.carbon.model.request.UserRegisterRequest;
|
||||
import net.carbon.model.request.UserLoginRequest;
|
||||
import net.carbon.utils.JsonData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@ -36,4 +39,6 @@ public interface UserService extends IService<UserDO> {
|
||||
JsonData login(UserLoginRequest loginRequest);
|
||||
|
||||
UserVO userinfo();
|
||||
|
||||
void updateUserinfo(UserDO userDO);
|
||||
}
|
||||
|
@ -0,0 +1,21 @@
|
||||
package net.carbon.service.impl;
|
||||
|
||||
import net.carbon.mapper.AchievementMapper;
|
||||
import net.carbon.model.vo.AchievementVO;
|
||||
import net.carbon.service.AchievementService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class AchievementServiceImpl implements AchievementService {
|
||||
|
||||
@Autowired
|
||||
private AchievementMapper achievementMapper;
|
||||
@Override
|
||||
public List<AchievementVO> getList(Long page, Long pageSize, String projectID) {
|
||||
Long startRow = (page-1)*pageSize;
|
||||
return achievementMapper.getList(startRow,pageSize,projectID);
|
||||
}
|
||||
}
|
@ -70,5 +70,16 @@ public class EconomicsServiceImpl extends ServiceImpl<EconomicsMapper, Economics
|
||||
int row = economicsMapper.updateById(economicsDO);
|
||||
return row;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer add(EconomicsUpdateRequest economicsUpdateRequest) {
|
||||
EconomicsDO economicsDO = new EconomicsDO();
|
||||
BeanUtils.copyProperties(economicsUpdateRequest, economicsDO);
|
||||
// 设置为0
|
||||
economicsDO.setIsDelete((byte) 0);
|
||||
economicsDO.setIsSystemDate(0);
|
||||
int row = economicsMapper.add(economicsDO);
|
||||
return row;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -73,4 +73,14 @@ public class LabelServiceImpl extends ServiceImpl<LabelMapper, LabelDO> implemen
|
||||
int row = labelMapper.updateById(labelDO);
|
||||
return row;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int add(LabelUpdateRequest labelUpdateRequest) {
|
||||
LabelDO labelDO = new LabelDO();
|
||||
BeanUtils.copyProperties(labelUpdateRequest,labelDO);
|
||||
labelDO.setIsSystemDate(0);
|
||||
labelDO.setIsDeleted(0);
|
||||
int row = labelMapper.add(labelDO);
|
||||
return row;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,44 @@
|
||||
package net.carbon.service.impl;
|
||||
|
||||
import net.carbon.mapper.ProjectMapper;
|
||||
import net.carbon.model.po.AchievementDO;
|
||||
import net.carbon.model.request.AchievementRequest;
|
||||
import net.carbon.model.request.ProjectRequest;
|
||||
import net.carbon.model.vo.ProjectVO;
|
||||
import net.carbon.service.ProjectService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class ProjectServiceImpl implements ProjectService{
|
||||
@Autowired
|
||||
private ProjectMapper projectMapper;
|
||||
@Override
|
||||
public List<ProjectVO> userProject(String userProjectId) {
|
||||
List<ProjectVO> userProjectList = projectMapper.userProject(userProjectId);
|
||||
return userProjectList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addProject(ProjectRequest projectRequest) {
|
||||
projectMapper.insert(projectRequest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void editProject(AchievementRequest achievementRequest) {
|
||||
AchievementDO achievementDO = new AchievementDO();
|
||||
BeanUtils.copyProperties(achievementRequest,achievementDO);
|
||||
projectMapper.update(achievementDO);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void deleteProAndPU(Long id) {
|
||||
projectMapper.deleteProperty(id);
|
||||
projectMapper.deleteProjectUser(id);
|
||||
}
|
||||
}
|
@ -58,8 +58,6 @@ public class TimelyWarningServiceImpl implements TimelyWarningService {
|
||||
|
||||
@Override
|
||||
public void add(TimelyWarningRequest timelyWarningRequest) {
|
||||
TimelyWarningDO timelyWarningDO = new TimelyWarningDO();
|
||||
BeanUtils.copyProperties(timelyWarningRequest, timelyWarningDO);
|
||||
timelyWarningMapper.insert(timelyWarningDO);
|
||||
timelyWarningMapper.add(timelyWarningRequest);
|
||||
}
|
||||
}
|
||||
|
@ -7,10 +7,12 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.carbon.enums.BizCodeEnum;
|
||||
import net.carbon.interceptor.LoginInterceptor;
|
||||
import net.carbon.mapper.ProjectMapper;
|
||||
import net.carbon.mapper.UserMapper;
|
||||
import net.carbon.model.LoginUser;
|
||||
import net.carbon.model.po.UserDO;
|
||||
|
||||
import net.carbon.model.vo.ProjectVO;
|
||||
import net.carbon.model.vo.UserVO;
|
||||
import net.carbon.model.request.UserRegisterRequest;
|
||||
import net.carbon.model.request.UserLoginRequest;
|
||||
@ -25,6 +27,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -41,6 +44,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserDO> implements
|
||||
|
||||
@Autowired
|
||||
private UserMapper userMapper;
|
||||
@Autowired
|
||||
private ProjectMapper projectMapper;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = RuntimeException.class, propagation = Propagation.REQUIRED)
|
||||
@ -133,7 +138,14 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserDO> implements
|
||||
UserDO userDO = userMapper.selectOne(queryWrapper);
|
||||
UserVO userVO = new UserVO();
|
||||
BeanUtils.copyProperties(userDO, userVO);
|
||||
userVO.setUserProjectId(projectMapper.getProjectIdByUserId(userVO.getId()));
|
||||
|
||||
return userVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateUserinfo(UserDO userDO) {
|
||||
userDO.setUpdateTime(LocalDateTime.now());
|
||||
userMapper.updateUserinfo(userDO);
|
||||
}
|
||||
}
|
||||
|
7
server/src/main/resources/mapper/AchievementMapper.xml
Normal file
7
server/src/main/resources/mapper/AchievementMapper.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?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="net.carbon.mapper.AchievementMapper">
|
||||
<select id="getList" resultType="net.carbon.model.vo.AchievementVO">
|
||||
select * from project_property where project_id = #{projectID} limit #{startRow},#{pageSize}
|
||||
</select>
|
||||
</mapper>
|
33
server/src/main/resources/mapper/ProjectMapper.xml
Normal file
33
server/src/main/resources/mapper/ProjectMapper.xml
Normal file
@ -0,0 +1,33 @@
|
||||
<?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="net.carbon.mapper.ProjectMapper">
|
||||
<update id="update">
|
||||
update project_property
|
||||
<set>
|
||||
<if test="nodex != null and nodex != '' ">
|
||||
nodex = #{nodex},
|
||||
</if>
|
||||
<if test="unit != null and unit != '' ">
|
||||
unit = #{unit},
|
||||
</if>
|
||||
<if test="arribure != null and arribure != '' ">
|
||||
arribure = #{arribure},
|
||||
</if>
|
||||
<if test="dataValue != null and dataValue != '' ">
|
||||
dataValue = #{dataValue},
|
||||
</if>
|
||||
<if test="updataData != null and updataData != '' ">
|
||||
updataData = #{updataData},
|
||||
</if>
|
||||
<if test="leibi != null and leibi != '' ">
|
||||
leibi = #{leibi},
|
||||
</if>
|
||||
<if test="indexClassification != null and indexClassification != '' ">
|
||||
indexClassification = #{indexClassification},
|
||||
</if>
|
||||
<if test="assess != null and assess != '' ">
|
||||
assess = #{assess},
|
||||
</if>
|
||||
</set>
|
||||
</update>
|
||||
</mapper>
|
@ -23,5 +23,8 @@
|
||||
id
|
||||
, username, password, avatar, role, description, name, phone, address, creationTime, updateTime, is_delete
|
||||
</sql>
|
||||
<update id="updateUserinfo">
|
||||
update user set username = #{username},phone = #{phone},address = #{address},avatar = #{avatar},updateTime = #{updateTime} where id = #{id}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
Loading…
Reference in New Issue
Block a user