Compare commits
No commits in common. "master" and "server_2024_3_23_liyongjie" have entirely different histories.
master
...
server_202
|
@ -14,10 +14,12 @@ spring:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 10.10.26.1:8848
|
server-addr: 101.43.11.6:8848
|
||||||
|
namespace: de2e4f3b-454d-4f11-848f-26df8b5284ad
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 10.10.26.1:8848
|
server-addr: 101.43.11.6:8848
|
||||||
|
namespace: de2e4f3b-454d-4f11-848f-26df8b5284ad
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -14,10 +14,12 @@ spring:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 10.10.26.1:8848
|
server-addr: 101.43.11.6:8848
|
||||||
|
namespace: de2e4f3b-454d-4f11-848f-26df8b5284ad
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 10.10.26.1:8848
|
server-addr: 101.43.11.6:8848
|
||||||
|
namespace: de2e4f3b-454d-4f11-848f-26df8b5284ad
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
@ -33,7 +35,7 @@ spring:
|
||||||
datasource:
|
datasource:
|
||||||
ds1:
|
ds1:
|
||||||
nacos:
|
nacos:
|
||||||
server-addr: 10.10.26.1:8848
|
server-addr: 101.43.11.6:8848
|
||||||
dataId: sentinel-muyu-gateway
|
dataId: sentinel-muyu-gateway
|
||||||
groupId: DEFAULT_GROUP
|
groupId: DEFAULT_GROUP
|
||||||
data-type: json
|
data-type: json
|
||||||
|
|
|
@ -14,10 +14,12 @@ spring:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 10.10.26.1:8848
|
server-addr: 101.43.11.6:8848
|
||||||
|
namespace: de2e4f3b-454d-4f11-848f-26df8b5284ad
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 10.10.26.1:8848
|
server-addr: 101.43.11.6:8848
|
||||||
|
namespace: de2e4f3b-454d-4f11-848f-26df8b5284ad
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -14,10 +14,12 @@ spring:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 10.10.26.1:8848
|
server-addr: 101.43.11.6:8848
|
||||||
|
namespace: de2e4f3b-454d-4f11-848f-26df8b5284ad
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 10.10.26.1:8848
|
server-addr: 101.43.11.6:8848
|
||||||
|
namespace: de2e4f3b-454d-4f11-848f-26df8b5284ad
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -14,10 +14,12 @@ spring:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 10.10.26.1:8848
|
server-addr: 101.43.11.6:8848
|
||||||
|
namespace: de2e4f3b-454d-4f11-848f-26df8b5284ad
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 10.10.26.1:8848
|
server-addr: 101.43.11.6:8848
|
||||||
|
namespace: de2e4f3b-454d-4f11-848f-26df8b5284ad
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -31,7 +31,6 @@ public class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper, SysConfig
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SysConfig> pageQuery (SysConfig config) {
|
public List<SysConfig> pageQuery (SysConfig config) {
|
||||||
|
|
||||||
LambdaQueryWrapper<SysConfig> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<SysConfig> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
if (StringUtils.isNotEmpty(config.getConfigName())){
|
if (StringUtils.isNotEmpty(config.getConfigName())){
|
||||||
queryWrapper.like(SysConfig::getConfigName, config.getConfigName());
|
queryWrapper.like(SysConfig::getConfigName, config.getConfigName());
|
||||||
|
@ -42,8 +41,6 @@ public class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper, SysConfig
|
||||||
if (StringUtils.isNotEmpty(config.getConfigKey())){
|
if (StringUtils.isNotEmpty(config.getConfigKey())){
|
||||||
queryWrapper.like(SysConfig::getConfigKey, config.getConfigKey());
|
queryWrapper.like(SysConfig::getConfigKey, config.getConfigKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Object beginTime = config.getParams().get("beginTime");
|
Object beginTime = config.getParams().get("beginTime");
|
||||||
if (Objects.nonNull(beginTime) && beginTime instanceof Date beginDate){
|
if (Objects.nonNull(beginTime) && beginTime instanceof Date beginDate){
|
||||||
queryWrapper.gt(SysConfig::getCreateTime, beginDate);
|
queryWrapper.gt(SysConfig::getCreateTime, beginDate);
|
||||||
|
@ -52,8 +49,6 @@ public class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper, SysConfig
|
||||||
if (Objects.nonNull(endTime) && endTime instanceof Date endDate){
|
if (Objects.nonNull(endTime) && endTime instanceof Date endDate){
|
||||||
queryWrapper.lt(SysConfig::getCreateTime, endDate);
|
queryWrapper.lt(SysConfig::getCreateTime, endDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return this.list(queryWrapper);
|
return this.list(queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,10 +14,12 @@ spring:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 10.10.26.1:8848
|
server-addr: 101.43.11.6:8848
|
||||||
|
namespace: de2e4f3b-454d-4f11-848f-26df8b5284ad
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 10.10.26.1:8848
|
server-addr: 101.43.11.6:8848
|
||||||
|
namespace: de2e4f3b-454d-4f11-848f-26df8b5284ad
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
package com.muyu.test.common;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ClassName Job
|
|
||||||
* @Description TODO
|
|
||||||
* @Author YinYuYang
|
|
||||||
* @Date 2024/3/24 10:33
|
|
||||||
* Version 1.0
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@TableName("t_job")
|
|
||||||
public class Job {
|
|
||||||
|
|
||||||
@TableField(exist = false)
|
|
||||||
private Integer jobId;
|
|
||||||
|
|
||||||
// @TableField(exist = false)
|
|
||||||
private String jobName;
|
|
||||||
}
|
|
|
@ -1,37 +0,0 @@
|
||||||
package com.muyu.test.common;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import lombok.Data;
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ClassName People
|
|
||||||
* @Description TODO
|
|
||||||
* @Author YinYuYang
|
|
||||||
* @Date 2024/3/24 10:33
|
|
||||||
* Version 1.0
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@TableName("t_people")
|
|
||||||
public class People extends Job{
|
|
||||||
|
|
||||||
@TableId
|
|
||||||
private Integer peopleId;
|
|
||||||
|
|
||||||
private String peopleName;
|
|
||||||
|
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
private Date peopleBirth;
|
|
||||||
|
|
||||||
private Integer jobId;
|
|
||||||
|
|
||||||
private String peopleImg;
|
|
||||||
|
|
||||||
private String peopleIntroduce;
|
|
||||||
}
|
|
|
@ -1,17 +0,0 @@
|
||||||
package com.muyu.test.common.domain;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Auth :肖凡
|
|
||||||
* Date :2024-03-24 11:59:22
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@TableName("t_class")
|
|
||||||
public class Class {
|
|
||||||
private Integer classId;
|
|
||||||
@TableField(exist = false)
|
|
||||||
private String className;
|
|
||||||
}
|
|
|
@ -1,25 +0,0 @@
|
||||||
package com.muyu.test.common.domain;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import lombok.Data;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Auth :肖凡
|
|
||||||
* Date :2024-03-24 09:53:41
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@TableName("t_student")
|
|
||||||
public class Student extends Class{
|
|
||||||
@TableId("student_id")
|
|
||||||
private Integer studentId;
|
|
||||||
private String studentName;
|
|
||||||
private String studentSex;
|
|
||||||
private Integer studentAge;
|
|
||||||
private String studentPhone;
|
|
||||||
private Date studentTime;
|
|
||||||
private String studentImg;
|
|
||||||
private Integer classId;
|
|
||||||
}
|
|
|
@ -1,32 +0,0 @@
|
||||||
package com.muyu.test.domain;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import lombok.Data;
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@TableName("t_employee")//映射数据库员工表
|
|
||||||
public class Employee extends Section{
|
|
||||||
//识别为
|
|
||||||
@TableId(type = IdType.AUTO)
|
|
||||||
private Integer empId;//id
|
|
||||||
|
|
||||||
private String empName;//姓名
|
|
||||||
private Integer empAge;//年龄
|
|
||||||
private Integer empSex;//性别
|
|
||||||
private String empImage;//图片
|
|
||||||
private String dictLabel;//性别
|
|
||||||
private String empRich;//富文本
|
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
private Date empDate;//入职日期
|
|
||||||
private Integer empSectionId;//部门id
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
package com.muyu.test.domain;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@TableName("t_section")
|
|
||||||
public class Section{
|
|
||||||
private Integer sectionId;
|
|
||||||
private String sectionName;
|
|
||||||
}
|
|
|
@ -1,4 +0,0 @@
|
||||||
package com.muyu.test.domain;
|
|
||||||
|
|
||||||
public class aa {
|
|
||||||
}
|
|
|
@ -1,17 +0,0 @@
|
||||||
package com.muyu.test.vo;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
|
||||||
import javax.validation.constraints.Size;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class ReqConditions {
|
|
||||||
private Integer pageNum=1;
|
|
||||||
private Integer pageSize=3;
|
|
||||||
private String empName;//员工名称查询
|
|
||||||
|
|
||||||
private Integer empSectionId;//部门id查询
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
package com.muyu.test.vo;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import lombok.Data;
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class VoEmployee {
|
|
||||||
private String empName;//姓名
|
|
||||||
private Integer empAge;//年龄
|
|
||||||
private String empImage;//图片
|
|
||||||
private String empRich;//富文本
|
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
private Date empDate;//入职日期
|
|
||||||
private Integer empSectionId;//部门id
|
|
||||||
}
|
|
|
@ -85,13 +85,6 @@
|
||||||
<artifactId>muyu-common-swagger</artifactId>
|
<artifactId>muyu-common-swagger</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- mybatis plus -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.baomidou</groupId>
|
|
||||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
|
||||||
<version>3.5.1</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -3,7 +3,6 @@ package com.muyu;
|
||||||
import com.muyu.common.security.annotation.EnableCustomConfig;
|
import com.muyu.common.security.annotation.EnableCustomConfig;
|
||||||
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
||||||
import com.muyu.common.swagger.annotation.EnableCustomSwagger2;
|
import com.muyu.common.swagger.annotation.EnableCustomSwagger2;
|
||||||
import org.mybatis.spring.annotation.MapperScan;
|
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
@ -11,7 +10,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
@EnableCustomSwagger2
|
@EnableCustomSwagger2
|
||||||
@EnableMyFeignClients
|
@EnableMyFeignClients
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@MapperScan("com.muyu.test.mapper")
|
|
||||||
public class MuYuTestApplication {
|
public class MuYuTestApplication {
|
||||||
public static void main (String[] args) {
|
public static void main (String[] args) {
|
||||||
SpringApplication.run(MuYuTestApplication.class, args);
|
SpringApplication.run(MuYuTestApplication.class, args);
|
||||||
|
|
|
@ -1,66 +0,0 @@
|
||||||
package com.muyu.test.controller;
|
|
||||||
|
|
||||||
import com.muyu.common.core.domain.Result;
|
|
||||||
import com.muyu.common.core.web.controller.BaseController;
|
|
||||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
|
||||||
import com.muyu.test.domain.Employee;
|
|
||||||
import com.muyu.test.service.EmployeeService;
|
|
||||||
import com.muyu.test.vo.ReqConditions;
|
|
||||||
import com.muyu.test.vo.VoEmployee;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/employee")
|
|
||||||
|
|
||||||
public class EmployeeController extends BaseController {
|
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private EmployeeService employeeMapper;
|
|
||||||
|
|
||||||
@PostMapping("/selectEmployeeConditions")
|
|
||||||
public Result selectEmployeeConditions(@RequestBody ReqConditions reqConditions) {//多条件查询
|
|
||||||
startPage();
|
|
||||||
List<Employee> list=employeeMapper.selectEmployeeConditions(reqConditions);
|
|
||||||
return Result.success(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
//查所有员工双表联查
|
|
||||||
@PostMapping("/selectAllEmployee")
|
|
||||||
public Result selectAllEmployee() {
|
|
||||||
List<Employee> list=employeeMapper.selectAllEmployee();
|
|
||||||
return Result.success(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/insertEmployee")
|
|
||||||
public Result insertEmployee(@RequestBody Employee employee) {
|
|
||||||
Integer i=employeeMapper.insertEmployee(employee);
|
|
||||||
return Result.success(i,i>0?"添加成功":"添加失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/updateEmployee")
|
|
||||||
|
|
||||||
public Result updateEmployee(@RequestBody Employee employee) {
|
|
||||||
Integer i=employeeMapper.updateEmployee(employee);
|
|
||||||
return Result.success(i,i>0?"修改成功":"修改失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/deleteEmployee/{empId}")
|
|
||||||
public Result deleteEmployee(@PathVariable Integer empId) {
|
|
||||||
Integer i=employeeMapper.deleteEmployee(empId);
|
|
||||||
return Result.success(i,i>0?"删除成功":"删除失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,49 +0,0 @@
|
||||||
package com.muyu.test.controller;
|
|
||||||
|
|
||||||
import com.muyu.common.core.domain.Result;
|
|
||||||
import com.muyu.common.core.web.controller.BaseController;
|
|
||||||
import com.muyu.common.core.web.page.TableDataInfo;
|
|
||||||
import com.muyu.test.common.People;
|
|
||||||
import com.muyu.test.service.PeopleService;
|
|
||||||
import io.swagger.models.auth.In;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ClassName PeopleController
|
|
||||||
* @Description TODO
|
|
||||||
* @Author YinYuYang
|
|
||||||
* @Date 2024/3/24 10:44
|
|
||||||
* Version 1.0
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/people")
|
|
||||||
public class PeopleController extends BaseController {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private PeopleService peopleService;
|
|
||||||
@GetMapping("/list")
|
|
||||||
public Result<TableDataInfo<People>> list(People people) {
|
|
||||||
List<People> list = peopleService.selectAll(people);
|
|
||||||
return getDataTable(list);
|
|
||||||
}
|
|
||||||
@PostMapping("/insert")
|
|
||||||
public Result add(@RequestBody People people){
|
|
||||||
int i = peopleService.insert(people);
|
|
||||||
return Result.success(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/update")
|
|
||||||
public Result update(@RequestBody People people){
|
|
||||||
int i = peopleService.updatePeople(people);
|
|
||||||
return Result.success(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/delete/{peopleId}")
|
|
||||||
public Result remove(@PathVariable Integer peopleId) {
|
|
||||||
int i = peopleService.delete(peopleId);
|
|
||||||
return Result.success(i);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,65 +0,0 @@
|
||||||
package com.muyu.test.controller;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import com.muyu.common.core.domain.Result;
|
|
||||||
import com.muyu.common.core.web.page.TableDataInfo;
|
|
||||||
import com.muyu.test.common.domain.Student;
|
|
||||||
import com.muyu.common.core.web.controller.BaseController;
|
|
||||||
import com.muyu.test.service.StudentService;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Auth :肖凡
|
|
||||||
* Date :2024-03-24 09:59:30
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@Slf4j
|
|
||||||
public class StudentController extends BaseController{
|
|
||||||
@Autowired
|
|
||||||
private StudentService studentService;
|
|
||||||
|
|
||||||
// @GetMapping("/list")
|
|
||||||
// public List<Student> list(Student student){
|
|
||||||
// List<Student> list=studentService.selectList(student);
|
|
||||||
// return list;
|
|
||||||
// }
|
|
||||||
@GetMapping("/list")
|
|
||||||
public Result<TableDataInfo<Student>> list(Student student){
|
|
||||||
startPage();
|
|
||||||
List<Student> list=studentService.selectList(student);
|
|
||||||
return getDataTable(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/add")
|
|
||||||
public Result add(@RequestBody Student student){
|
|
||||||
int i=studentService.add(student);
|
|
||||||
return Result.success(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/update")
|
|
||||||
public Result update(@RequestBody Student student){
|
|
||||||
int i=studentService.updateByIdTwo(student);
|
|
||||||
return Result.success(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/del/{studentId}")
|
|
||||||
public Result del(@PathVariable Integer studentId){
|
|
||||||
int i=studentService.del(studentId);
|
|
||||||
return Result.success(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,23 +0,0 @@
|
||||||
package com.muyu.test.mapper;
|
|
||||||
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.muyu.test.domain.Employee;
|
|
||||||
import com.muyu.test.vo.ReqConditions;
|
|
||||||
import org.apache.ibatis.annotations.Select;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface EmployeeMapper extends BaseMapper<Employee> {
|
|
||||||
@Select("select * from t_employee left join t_section on t_employee.emp_section_id=t_section.section_id")
|
|
||||||
List<Employee> selectAllEmployee();
|
|
||||||
|
|
||||||
|
|
||||||
List<Employee> selectEmployeeConditions(ReqConditions reqConditions);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,16 +0,0 @@
|
||||||
package com.muyu.test.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.muyu.test.common.People;
|
|
||||||
import org.apache.ibatis.annotations.Select;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public interface PeopleMapper extends BaseMapper<People> {
|
|
||||||
@Select("select * from t_people left join t_job on t_job.job_id = t_people.job_id ")
|
|
||||||
List<People> selectAll();
|
|
||||||
|
|
||||||
List<People> selectPeople(People people);
|
|
||||||
}
|
|
|
@ -1,24 +0,0 @@
|
||||||
package com.muyu.test.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.muyu.test.common.domain.Student;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.apache.ibatis.annotations.Select;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Auth :肖凡
|
|
||||||
* Date :2024-03-24 10:00:03
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface StudentMapper extends BaseMapper<Student> {
|
|
||||||
List<Student> selectList1(Student student);
|
|
||||||
|
|
||||||
|
|
||||||
// @Select("SELECT t_student.student_id,t_student.student_name,t_student.student_sex,t_student.student_age,t_student.student_phone,t_student.student_time,t_student.student_img,t_class.class_id,t_class.class_name FROM t_student LEFT JOIN t_class ON t_student.class_id = t_class.class_id")
|
|
||||||
// List<Student> selectList1(LambdaQueryWrapper<Student> queryWrapper);
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,32 +0,0 @@
|
||||||
package com.muyu.test.service;
|
|
||||||
|
|
||||||
import com.muyu.test.domain.Employee;
|
|
||||||
import com.muyu.test.domain.Section;
|
|
||||||
import com.muyu.test.vo.ReqConditions;
|
|
||||||
import com.muyu.test.vo.VoEmployee;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface EmployeeService {
|
|
||||||
|
|
||||||
|
|
||||||
List<Employee> selectAllEmployee();
|
|
||||||
|
|
||||||
|
|
||||||
Integer insertEmployee(Employee employee);
|
|
||||||
|
|
||||||
|
|
||||||
Integer updateEmployee(Employee employee);
|
|
||||||
|
|
||||||
|
|
||||||
Integer deleteEmployee(Integer empId);
|
|
||||||
|
|
||||||
|
|
||||||
List<Employee> selectEmployeeConditions(ReqConditions reqConditions);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,16 +0,0 @@
|
||||||
package com.muyu.test.service;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
import com.muyu.test.common.People;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface PeopleService extends IService<People> {
|
|
||||||
List<People> selectAll(People people);
|
|
||||||
|
|
||||||
int insert(People people);
|
|
||||||
|
|
||||||
int updatePeople(People people);
|
|
||||||
|
|
||||||
int delete(Integer peopleId);
|
|
||||||
}
|
|
|
@ -1,25 +0,0 @@
|
||||||
package com.muyu.test.service;
|
|
||||||
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
|
|
||||||
import com.muyu.test.common.domain.Student;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Auth :肖凡
|
|
||||||
* Date :2024-03-24 09:59:40
|
|
||||||
*/
|
|
||||||
public interface StudentService extends IService<Student> {
|
|
||||||
|
|
||||||
|
|
||||||
List<Student> selectList(Student student);
|
|
||||||
|
|
||||||
int add(Student student);
|
|
||||||
|
|
||||||
int updateByIdTwo(Student student);
|
|
||||||
|
|
||||||
|
|
||||||
int del(Integer studentId);
|
|
||||||
}
|
|
|
@ -1,53 +0,0 @@
|
||||||
package com.muyu.test.service.impl;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.muyu.common.core.utils.StringUtils;
|
|
||||||
import com.muyu.test.domain.Employee;
|
|
||||||
import com.muyu.test.mapper.EmployeeMapper;
|
|
||||||
import com.muyu.test.service.EmployeeService;
|
|
||||||
import com.muyu.test.vo.ReqConditions;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class EmployeeServiceImpl extends ServiceImpl<EmployeeMapper, Employee> implements EmployeeService
|
|
||||||
{
|
|
||||||
@Autowired
|
|
||||||
private EmployeeMapper employeeMapper;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Employee> selectAllEmployee() {
|
|
||||||
List<Employee> list=employeeMapper.selectAllEmployee();
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Integer insertEmployee(Employee employee) {
|
|
||||||
return employeeMapper.insert(employee);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Integer updateEmployee(Employee employee) {
|
|
||||||
return employeeMapper.updateById(employee);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Integer deleteEmployee(Integer empId) {
|
|
||||||
return employeeMapper.deleteById(empId);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Employee> selectEmployeeConditions(ReqConditions reqConditions) {
|
|
||||||
return employeeMapper.selectEmployeeConditions(reqConditions);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,62 +0,0 @@
|
||||||
package com.muyu.test.service.impl;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.muyu.common.core.utils.StringUtils;
|
|
||||||
import com.muyu.common.redis.configure.RedisConfig;
|
|
||||||
import com.muyu.test.mapper.PeopleMapper;
|
|
||||||
import com.muyu.test.service.PeopleService;
|
|
||||||
import com.muyu.test.common.People;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ClassName PeopleImpl
|
|
||||||
* @Description TODO
|
|
||||||
* @Author YinYuYang
|
|
||||||
* @Date 2024/3/24 10:44
|
|
||||||
* Version 1.0
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class PeopleServiceImpl extends ServiceImpl<PeopleMapper, People>
|
|
||||||
implements PeopleService {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private PeopleMapper peopleMapper;
|
|
||||||
@Override
|
|
||||||
public List<People> selectAll(People people) {
|
|
||||||
|
|
||||||
// LambdaQueryWrapper<People> queryWrapper = new LambdaQueryWrapper<>();
|
|
||||||
//
|
|
||||||
// if (StringUtils.isNotEmpty(people.getPeopleName())){
|
|
||||||
// queryWrapper.like(People::getPeopleName, people.getPeopleName());
|
|
||||||
// }
|
|
||||||
// if (people.getJobId() != null){
|
|
||||||
// queryWrapper.eq(People::getJobId, people.getJobId());
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// Map<String, Object> paramMap = new HashMap<>();
|
|
||||||
// String sqlSegment = queryWrapper.getCustomSqlSegment();
|
|
||||||
// paramMap.put("sqlSegment", sqlSegment);
|
|
||||||
|
|
||||||
return peopleMapper.selectPeople(people);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int insert(People people) {
|
|
||||||
return peopleMapper.insert(people);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int updatePeople(People people) {
|
|
||||||
return peopleMapper.updateById(people);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int delete(Integer peopleId) {
|
|
||||||
return peopleMapper.deleteById(peopleId);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,45 +0,0 @@
|
||||||
package com.muyu.test.service.impl;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.muyu.test.common.domain.Student;
|
|
||||||
|
|
||||||
import com.muyu.test.mapper.StudentMapper;
|
|
||||||
import com.muyu.test.service.StudentService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Auth :肖凡
|
|
||||||
* Date :2024-03-24 09:59:54
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class StudentServiceimpl extends ServiceImpl<StudentMapper, Student> implements StudentService {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private StudentMapper studentMapper;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Student> selectList(Student student) {
|
|
||||||
return studentMapper.selectList1(student);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int add(Student student) {
|
|
||||||
return studentMapper.insert(student);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int updateByIdTwo(Student student) {
|
|
||||||
return studentMapper.updateById(student);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int del(Integer studentId) {
|
|
||||||
return studentMapper.deleteById(studentId);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -25,4 +25,4 @@ spring:
|
||||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||||
logging:
|
logging:
|
||||||
level:
|
level:
|
||||||
com.muyu.test.mapper: DEBUG
|
com.muyu.system.mapper: DEBUG
|
||||||
|
|
|
@ -1,46 +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.muyu.test.mapper.EmployeeMapper">
|
|
||||||
|
|
||||||
|
|
||||||
<resultMap type="com.muyu.test.domain.Employee" id="EmployeeResult">
|
|
||||||
<id property="empId" column="emp_id"/>
|
|
||||||
<result property="empName" column="emp_name"/>
|
|
||||||
<result property="empAge" column="emp_age"/>
|
|
||||||
<result property="empImage" column="emp_image"/>
|
|
||||||
<result property="empRich" column="emp_rich"/>
|
|
||||||
<result property="empDate" column="emp_date"/>
|
|
||||||
<result property="empSex" column="emp_sex"/>
|
|
||||||
<result property="empSectionId" column="emp_section_id"/>
|
|
||||||
<result property="sectionId" column="section_id"/>
|
|
||||||
<result property="sectionName" column="section_name"/>
|
|
||||||
</resultMap>
|
|
||||||
|
|
||||||
<sql id="selectEmployeeVo">
|
|
||||||
SELECT DISTINCT emp_id, emp_name, emp_age, emp_image, emp_rich, emp_date, emp_section_id, section_name, sdd.dict_label
|
|
||||||
FROM t_employee
|
|
||||||
INNER JOIN t_section ON t_employee.emp_section_id = t_section.section_id
|
|
||||||
INNER JOIN sys_dict_data sdd ON sdd.dict_type = 'sys_user_sex'
|
|
||||||
AND sdd.dict_value = t_employee.emp_sex
|
|
||||||
</sql>
|
|
||||||
|
|
||||||
<select id="selectEmployeeConditions" resultType="com.muyu.test.domain.Employee" resultMap="EmployeeResult">
|
|
||||||
<include refid="selectEmployeeVo"/>
|
|
||||||
|
|
||||||
<where>
|
|
||||||
<if test="empName != null and empName != ''">
|
|
||||||
AND emp_name like concat('%', #{empName,jdbcType=VARCHAR}, '%')
|
|
||||||
</if>
|
|
||||||
<if test="empSectionId != null and empSectionId != 0">
|
|
||||||
AND emp_section_id = #{empSectionId,jdbcType=INTEGER}
|
|
||||||
</if>
|
|
||||||
</where>
|
|
||||||
|
|
||||||
</select>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
|
|
@ -1,45 +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">
|
|
||||||
<!--
|
|
||||||
1.在mybats的开发中namespace有特殊的意思,一定要是对应接口的全限定名
|
|
||||||
通过namespace可以简历mapper.xml和接口之间的关系(名字不重要,位置不重要)
|
|
||||||
-->
|
|
||||||
<mapper namespace="com.muyu.test.mapper.PeopleMapper">
|
|
||||||
<!-- 添加 -->
|
|
||||||
<resultMap id="PeopleResult" type="com.muyu.test.common.People">
|
|
||||||
<id property="peopleId" column="people_id" />
|
|
||||||
<result property="peopleName" column="people_name" />
|
|
||||||
<result property="peopleBirth" column="people_birth" />
|
|
||||||
<result property="jobId" column="job_id" />
|
|
||||||
<result property="peopleImg" column="people_img" />
|
|
||||||
<result property="peopleIntroduce" column="people_introduce" />
|
|
||||||
<result property="jobName" column="job_name" />
|
|
||||||
</resultMap>
|
|
||||||
|
|
||||||
<sql id="selectPeople">
|
|
||||||
SELECT
|
|
||||||
p.people_id,
|
|
||||||
p.people_name,
|
|
||||||
p.people_birth,
|
|
||||||
p.job_id,
|
|
||||||
p.people_img,
|
|
||||||
p.people_introduce,
|
|
||||||
j.job_name
|
|
||||||
FROM
|
|
||||||
t_people p
|
|
||||||
LEFT JOIN t_job j ON p.job_id = j.job_id
|
|
||||||
</sql>
|
|
||||||
<select id="selectPeople" resultType="com.muyu.test.common.People" resultMap="PeopleResult">
|
|
||||||
<include refid="selectPeople" />
|
|
||||||
<where>
|
|
||||||
<if test="peopleName != null and peopleName != ''">
|
|
||||||
AND p.people_name like concat('%', #{peopleName}, '%')
|
|
||||||
</if>
|
|
||||||
<if test="jobId != null">
|
|
||||||
AND p.job_id = #{jobId}
|
|
||||||
</if>
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
</mapper>
|
|
|
@ -1,24 +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.muyu.test.mapper.StudentMapper">
|
|
||||||
|
|
||||||
|
|
||||||
<select id="selectList1" resultType="com.muyu.test.common.domain.Student">
|
|
||||||
SELECT t_student.student_id,t_student.student_name,t_student.student_sex,t_student.student_age,t_student.student_phone,t_student.student_time,t_student.student_img,t_class.class_id,t_class.class_name FROM t_student
|
|
||||||
LEFT JOIN t_class ON t_student.class_id = t_class.class_id
|
|
||||||
<where>
|
|
||||||
<if test="studentName != null and studentName != ''">
|
|
||||||
AND t_student.student_name like concat('%', #{studentName}, '%')
|
|
||||||
</if>
|
|
||||||
<if test="studentSex != null and studentSex != ''">
|
|
||||||
AND t_student.student_sex = #{studentSex}
|
|
||||||
</if>
|
|
||||||
<if test="studentAge != null and studentAge != ''">
|
|
||||||
AND t_student.student_age = #{studentAge}
|
|
||||||
</if>
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
</mapper>
|
|
|
@ -14,10 +14,12 @@ spring:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 10.10.26.1:8848
|
server-addr: 101.43.11.6:8848
|
||||||
|
namespace: de2e4f3b-454d-4f11-848f-26df8b5284ad
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 10.10.26.1:8848
|
server-addr: 101.43.11.6:8848
|
||||||
|
namespace: de2e4f3b-454d-4f11-848f-26df8b5284ad
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
Loading…
Reference in New Issue