diff --git a/ym-admin/src/main/java/com/cnbm/admin/entity/LoginUser.java b/ym-admin/src/main/java/com/cnbm/admin/entity/LoginUser.java index 7499d08..6d1b4f4 100644 --- a/ym-admin/src/main/java/com/cnbm/admin/entity/LoginUser.java +++ b/ym-admin/src/main/java/com/cnbm/admin/entity/LoginUser.java @@ -22,6 +22,8 @@ import java.util.stream.Collectors; @JsonIgnoreProperties(ignoreUnknown = true) public class LoginUser implements UserDetails{ + private static final long serialVersionUID = 1L; + private SysUserEntity sysUserEntity; private List permissions; diff --git a/ym-admin/src/main/java/com/cnbm/admin/service/impl/LoginServiceImpl.java b/ym-admin/src/main/java/com/cnbm/admin/service/impl/LoginServiceImpl.java index 27468aa..cdf977c 100644 --- a/ym-admin/src/main/java/com/cnbm/admin/service/impl/LoginServiceImpl.java +++ b/ym-admin/src/main/java/com/cnbm/admin/service/impl/LoginServiceImpl.java @@ -28,6 +28,7 @@ import java.util.Date; import java.util.HashMap; import java.util.Map; import java.util.Objects; +import java.util.concurrent.TimeUnit; /** * @Author weihongyang @@ -79,7 +80,7 @@ public class LoginServiceImpl implements LoginService { Map map = new HashMap<>(); map.put("token",jwt); //把完整的用户信息存入redis userid作为key - redisTemplate.opsForValue().set("login:"+userid,loginUser); + redisTemplate.opsForValue().set("login:"+userid,loginUser,1, TimeUnit.DAYS); //登录成功 log.setStatus(LoginStatusEnum.SUCCESS.value()); log.setCreator(loginUser.getSysUserEntity().getId()); diff --git a/ym-common/src/main/java/com/cnbm/common/utils/CountUtils.java b/ym-common/src/main/java/com/cnbm/common/utils/CountUtils.java new file mode 100644 index 0000000..5b522e0 --- /dev/null +++ b/ym-common/src/main/java/com/cnbm/common/utils/CountUtils.java @@ -0,0 +1,160 @@ +package com.cnbm.common.utils; + +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.ArrayList; +import java.util.List; + +import static java.math.BigDecimal.ROUND_HALF_UP; + +public class CountUtils { + +// private static final BigDecimal TWO = BigDecimal.valueOf(2); +// +// public static BigDecimal Mean(List data){ +// BigDecimal sum = new BigDecimal("0"); +// for (BigDecimal datum : data) { +// sum = sum.add(datum); +// } +// BigDecimal divide = sum.divide(BigDecimal.valueOf(data.size())); +// return divide; +// } +// +// // population variance 总体方差 +// public static BigDecimal POP_Variance(List data) { +// BigDecimal variance = new BigDecimal("0"); +// for (BigDecimal datum : data) { +// variance = variance.add(datum.subtract(Mean(data)).pow(2)); +// } +// variance = variance.divide(BigDecimal.valueOf(data.size())); +// return variance; +// } +// +// // population standard deviation 总体标准差 +// public static BigDecimal POP_STD_dev(List data) { +// BigDecimal sqrt = sqrt(POP_Variance(data), 4); +// return sqrt; +// } +// +// //sample variance 样本方差 +// public static BigDecimal Sample_Variance(List data) { +// BigDecimal variance = new BigDecimal("0"); +// for (BigDecimal datum : data) { +// variance = variance.add(datum.subtract(Mean(data)).pow(2)); +// } +// variance = variance.divide(BigDecimal.valueOf(data.size() - 1),4); +// return variance; +// } +// +// // sample standard deviation 样本标准差 +// public static BigDecimal Sample_STD_dev(List data) { +// BigDecimal sqrt = sqrt(Sample_Variance(data), 4); +// return sqrt; +// } +// +// public static BigDecimal sqrt(BigDecimal A, final int SCALE) { +// BigDecimal x0 = new BigDecimal("0"); +// BigDecimal x1 = new BigDecimal(Math.sqrt(A.doubleValue())); +// while (!x0.equals(x1)) { +// x0 = x1; +// x1 = A.divide(x0, SCALE, ROUND_HALF_UP); +// x1 = x1.add(x0); +// x1 = x1.divide(TWO, SCALE, ROUND_HALF_UP); +// +// } +// return x1; +// } + + + double Sum(double[] data) { + double sum = 0; + for (int i = 0; i < data.length; i++) + sum = sum + data[i]; + return sum; + } + + double Mean(double[] data) { + double mean = 0; + mean = Sum(data) / data.length; + return mean; + } + + // population variance 总体方差 + double POP_Variance(double[] data) { + double variance = 0; + for (int i = 0; i < data.length; i++) { + variance = variance + (Math.pow((data[i] - Mean(data)), 2)); + } + variance = variance / data.length; + return variance; + } + + // population standard deviation 总体标准差 + double POP_STD_dev(double[] data) { + double std_dev; + std_dev = Math.sqrt(POP_Variance(data)); + return std_dev; + } + + //sample variance 样本方差 + double Sample_Variance(double[] data) { + double variance = 0; + for (int i = 0; i < data.length; i++) { + variance = variance + (Math.pow((data[i] - Mean(data)), 2)); + } + variance = variance / (data.length-1); + return variance; + } + + // sample standard deviation 样本标准差 + double Sample_STD_dev(double[] data) { + double std_dev; + std_dev = Math.sqrt(Sample_Variance(data)); + return std_dev; + } + + + + public static void main(String[] args) { +// List data = new ArrayList<>(); +// +// data.add(new BigDecimal("10.023")); +// data.add(new BigDecimal("11.02")); +// data.add(new BigDecimal("9.99")); +// data.add(new BigDecimal("9.81")); +// data.add(new BigDecimal("10.12")); +// data.add(new BigDecimal("10.9")); +// data.add(new BigDecimal("9.99")); +// data.add(new BigDecimal("10.03")); +// data.add(new BigDecimal("9.99")); +// data.add(new BigDecimal("12.02")); +// CountUtils countUtils = new CountUtils(); +// +// BigDecimal mean = countUtils.Mean(data); +// System.out.println(mean.toString()); +// +// +// BigDecimal bigDecimal1 = POP_STD_dev(data); +// System.out.println(bigDecimal1.toString()); +// +// System.out.println(Sample_STD_dev(data).toString()); +// +// BigDecimal bigDecimal = POP_Variance(data); +// System.out.println(bigDecimal.toString()); +// +// +// System.out.println(Sample_Variance(data)); + + double[] data = new double[]{10.023,11.02,9.99,9.81,10.12,10.9,9.99,10.03,9.99,12.02}; + CountUtils countUtils = new CountUtils(); + + System.out.println(countUtils.Mean(data)); + System.out.println(countUtils.POP_STD_dev(data)); + System.out.println(countUtils.Sample_STD_dev(data)); + + System.out.println(countUtils.POP_Variance(data)); + System.out.println(countUtils.Sample_Variance(data)); + + } + +} diff --git a/ym-common/src/main/java/com/cnbm/common/utils/LeastSquares.java b/ym-common/src/main/java/com/cnbm/common/utils/LeastSquares.java new file mode 100644 index 0000000..5f63dd8 --- /dev/null +++ b/ym-common/src/main/java/com/cnbm/common/utils/LeastSquares.java @@ -0,0 +1,90 @@ +package com.cnbm.common.utils; + +public class LeastSquares +{ + + /* + * 杜航 功能:返回估计的y值 + */ + public static float estimate(float[] x, float[] y, float input) + { + float a = getA(x, y); + float b = getB(x, y); + System.out.println("线性回归系数a值:\t" + a + "\n" + "线性回归系数b值:\t" + b); + return (a * input + b); + } + + /* + * 杜航 功能:返回x的系数a 公式:a = ( n sum( xy ) - sum( x ) sum( y ) ) / ( n sum( x^2 ) + * - sum(x) ^ 2 ) + */ + public static float getA(float[] x, float[] y) + { + int n = x.length; + return (float) ((n * pSum(x, y) - sum(x) * sum(y)) / (n * sqSum(x) - Math + .pow(sum(x), 2))); + } + + /* + * 杜航 功能:返回常量系数系数b 公式:b = sum( y ) / n - a sum( x ) / n + */ + public static float getB(float[] x, float[] y) + { + int n = x.length; + float a = getA(x, y); + return sum(y) / n - a * sum(x) / n; + } + + /* + * 杜航 功能:求和 + */ + private static float sum(float[] ds) + { + float s = 0; + for (float d : ds) + { + s = s + d; + } + return s; + } + + /* + * 杜航 功能:求平方和 + */ + private static float sqSum(float[] ds) + { + float s = 0; + for (float d : ds) + { + s = (float) (s + Math.pow(d, 2)); + } + return s; + } + + /* + * 杜航 功能:返回对应项相乘后的和 + */ + private static float pSum(float[] x, float[] y) + { + float s = 0; + for (int i = 0; i < x.length; i++) + { + s = s + x[i] * y[i]; + } + return s; + } + + /* + * 杜航 功能:main()测试线性回归的最小二乘法java实现函数 + */ + public static void main(String[] args) + { + float[] x = +// { 540, 360, 240, 480, 420 }; + { 0.501F, 0.482F, 0.482F, 0.51F, 0.492F, 0.54F, 0.5F, 0.492F, 0.51F, 0.489F}; + float[] y = +// { 520, 475, 430, 386, 500 }; + {10.023F, 11.02F, 9.99F, 9.81F, 10.12F,10.9F, 9.99F, 10.03F, 9.99F, 12.02F }; + System.out.println("经线性回归后的y值:\t" + estimate(x, y,240)); + } +} diff --git a/ym-gateway/src/main/resources/application.yml b/ym-gateway/src/main/resources/application.yml index f6a9105..dd83b23 100644 --- a/ym-gateway/src/main/resources/application.yml +++ b/ym-gateway/src/main/resources/application.yml @@ -32,7 +32,7 @@ spring: max-request-size: 100MB enabled: true redis: - database: 2 + database: 6 host: redis.picaiba.com port: 6380 password: '@WSXcde3' # 密码(默认为空) diff --git a/ym-generator/src/main/java/com/cnbm/generator/build/CodeGenerator.java b/ym-generator/src/main/java/com/cnbm/generator/build/CodeGenerator.java index 1b2682c..96a87b5 100644 --- a/ym-generator/src/main/java/com/cnbm/generator/build/CodeGenerator.java +++ b/ym-generator/src/main/java/com/cnbm/generator/build/CodeGenerator.java @@ -19,7 +19,7 @@ public class CodeGenerator { @Test public void test(){ - mybatisPlusGenerator(new String[]{"sys_user","sys_role"}); + mybatisPlusGenerator(new String[]{"sys_user"}); } public static void mybatisPlusGenerator(String[] include){ diff --git a/ym-generator/src/main/java/com/cnbm/generator/code/controller/UserController.java b/ym-generator/src/main/java/com/cnbm/generator/code/controller/UserController.java new file mode 100644 index 0000000..aeb69f2 --- /dev/null +++ b/ym-generator/src/main/java/com/cnbm/generator/code/controller/UserController.java @@ -0,0 +1,116 @@ +package com.cnbm.generator.code.controller; + +import com.cnbm.admin.annotation.LogOperation; +import com.cnbm.common.constant.Constant; +import com.cnbm.common.page.PageData; +import com.cnbm.common.utils.ExcelUtils; +import com.cnbm.common.utils.Result; +import com.cnbm.common.validator.AssertUtils; +import com.cnbm.common.validator.ValidatorUtils; +import com.cnbm.common.validator.group.AddGroup; +import com.cnbm.common.validator.group.DefaultGroup; +import com.cnbm.common.validator.group.UpdateGroup; +import com.cnbm.generator.code.dto.UserDTO; +import com.cnbm.generator.code.excel.UserExcel; +import com.cnbm.generator.code.service.IUserService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import springfox.documentation.annotations.ApiIgnore; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 系统用户 前端控制器 + * + * @author why + * @since 2022-08-23 + */ +@RestController +@RequestMapping("/code/user") +@Api(tags="系统用户") +public class UserController { + @Autowired + private IUserService userService; + + @GetMapping("page") + @ApiOperation("分页") + @ApiImplicitParams({ + @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataTypeClass=Integer.class) , + @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataTypeClass=Integer.class) , + @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataTypeClass=String.class) , + @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataTypeClass=String.class) + }) + @PreAuthorize("@ex.hasAuthority('code:user:page')") + public Result> page(@ApiIgnore @RequestParam Map params){ + PageData page = userService.page(params); + + return new Result>().ok(page); + } + + @GetMapping("{id}") + @ApiOperation("信息") + @PreAuthorize("@ex.hasAuthority('code:user:info')") + public Result get(@PathVariable("id") Long id){ + UserDTO data = userService.get(id); + + return new Result().ok(data); + } + + @PostMapping + @ApiOperation("保存") + @LogOperation("保存") + @PreAuthorize("@ex.hasAuthority('code:user:save')") + public Result save(@RequestBody UserDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + + userService.save(dto); + + return new Result().ok(dto.getId()); + } + + @PutMapping + @ApiOperation("修改") + @LogOperation("修改") + @PreAuthorize("@ex.hasAuthority('code:user:update')") + public Result update(@RequestBody UserDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + + userService.update(dto); + + return new Result().ok(dto.getId()); + } + + @DeleteMapping + @ApiOperation("删除") + @LogOperation("删除") + @PreAuthorize("@ex.hasAuthority('code:user:delete')") + public Result delete(@RequestBody Long[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + + userService.delete(ids); + + return new Result(); + } + + @GetMapping("export") + @ApiOperation("导出") + @LogOperation("导出") + @PreAuthorize("@ex.hasAuthority('code:user:export')") + public void export(@ApiIgnore @RequestParam Map params, HttpServletResponse response) throws Exception { + List list = userService.list(params); + + ExcelUtils.exportExcelToTarget(response, null, list, UserExcel.class); + } + +} \ No newline at end of file diff --git a/ym-generator/src/main/java/com/cnbm/generator/code/dto/UserDTO.java b/ym-generator/src/main/java/com/cnbm/generator/code/dto/UserDTO.java new file mode 100644 index 0000000..00b077e --- /dev/null +++ b/ym-generator/src/main/java/com/cnbm/generator/code/dto/UserDTO.java @@ -0,0 +1,74 @@ +package com.cnbm.generator.code.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +import java.math.BigDecimal; + + +/** + * 系统用户 + * + * @author why + * @since 2022-08-23 + */ +@Data +@ApiModel(value = "系统用户DTO对象") +public class UserDTO implements Serializable { + private static final long serialVersionUID = 1L; + + + + @ApiModelProperty(value = "id") + private Long id; + + @ApiModelProperty(value = "用户名") + private String username; + + @ApiModelProperty(value = "密码") + private String password; + + @ApiModelProperty(value = "姓名") + private String realName; + + @ApiModelProperty(value = "头像") + private String headUrl; + + @ApiModelProperty(value = "性别 0:男 1:女 2:保密") + private Integer gender; + + @ApiModelProperty(value = "邮箱") + private String email; + + @ApiModelProperty(value = "手机号") + private String mobile; + + @ApiModelProperty(value = "部门ID") + private Long deptId; + + @ApiModelProperty(value = "超级管理员 0:否 1:是") + private Integer superAdmin; + + @ApiModelProperty(value = "状态 0:停用 1:正常") + private Integer status; + + @ApiModelProperty(value = "创建者") + private Long creator; + + @ApiModelProperty(value = "创建时间") + private LocalDateTime createDate; + + @ApiModelProperty(value = "更新者") + private Long updater; + + @ApiModelProperty(value = "更新时间") + private LocalDateTime updateDate; + + @ApiModelProperty(value = "删除标识,是否有效:1可用 0不可用") + private Integer valid; + +} \ No newline at end of file diff --git a/ym-generator/src/main/java/com/cnbm/generator/code/entity/User.java b/ym-generator/src/main/java/com/cnbm/generator/code/entity/User.java new file mode 100644 index 0000000..c7ed12c --- /dev/null +++ b/ym-generator/src/main/java/com/cnbm/generator/code/entity/User.java @@ -0,0 +1,76 @@ +package com.cnbm.generator.code.entity; + +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * 系统用户 + *

+ * + * @author why + * @since 2022-08-23 + */ +@Data +@TableName("sys_user") +@ApiModel(value = "User对象", description = "系统用户") +public class User implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("用户名") + private String username; + + @ApiModelProperty("密码") + private String password; + + @ApiModelProperty("姓名") + private String realName; + + @ApiModelProperty("头像") + private String headUrl; + + @ApiModelProperty("性别 0:男 1:女 2:保密") + private Integer gender; + + @ApiModelProperty("邮箱") + private String email; + + @ApiModelProperty("手机号") + private String mobile; + + @ApiModelProperty("部门ID") + private Long deptId; + + @ApiModelProperty("超级管理员 0:否 1:是") + private Integer superAdmin; + + @ApiModelProperty("状态 0:停用 1:正常") + private Integer status; + + @ApiModelProperty("创建者") + private Long creator; + + @ApiModelProperty("创建时间") + private LocalDateTime createDate; + + @ApiModelProperty("更新者") + private Long updater; + + @ApiModelProperty("更新时间") + private LocalDateTime updateDate; + + @ApiModelProperty("删除标识,是否有效:1可用 0不可用") + @TableLogic + private Integer valid; + + +} diff --git a/ym-generator/src/main/java/com/cnbm/generator/code/excel/UserExcel.java b/ym-generator/src/main/java/com/cnbm/generator/code/excel/UserExcel.java new file mode 100644 index 0000000..cf092ba --- /dev/null +++ b/ym-generator/src/main/java/com/cnbm/generator/code/excel/UserExcel.java @@ -0,0 +1,52 @@ +package com.cnbm.generator.code.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.time.LocalDateTime; +import java.math.BigDecimal; + +import java.util.Date; + +/** + * 系统用户 + * + * @author why + * @since 2022-08-23 + */ +@Data +public class UserExcel { + @Excel(name = "id") + private Long id; + @Excel(name = "用户名") + private String username; + @Excel(name = "密码") + private String password; + @Excel(name = "姓名") + private String realName; + @Excel(name = "头像") + private String headUrl; + @Excel(name = "性别 0:男 1:女 2:保密") + private Integer gender; + @Excel(name = "邮箱") + private String email; + @Excel(name = "手机号") + private String mobile; + @Excel(name = "部门ID") + private Long deptId; + @Excel(name = "超级管理员 0:否 1:是") + private Integer superAdmin; + @Excel(name = "状态 0:停用 1:正常") + private Integer status; + @Excel(name = "创建者") + private Long creator; + @Excel(name = "创建时间") + private LocalDateTime createDate; + @Excel(name = "更新者") + private Long updater; + @Excel(name = "更新时间") + private LocalDateTime updateDate; + @Excel(name = "删除标识,是否有效:1可用 0不可用") + private Integer valid; + +} \ No newline at end of file diff --git a/ym-generator/src/main/java/com/cnbm/generator/code/mapper/UserMapper.java b/ym-generator/src/main/java/com/cnbm/generator/code/mapper/UserMapper.java new file mode 100644 index 0000000..e938420 --- /dev/null +++ b/ym-generator/src/main/java/com/cnbm/generator/code/mapper/UserMapper.java @@ -0,0 +1,16 @@ +package com.cnbm.generator.code.mapper; + +import com.cnbm.common.dao.BaseDao; +import com.cnbm.generator.code.entity.User; +import org.apache.ibatis.annotations.Mapper; + +/** + * 系统用户 + * + * @author why + * @since 2022-08-23 + */ +@Mapper +public interface UserMapper extends BaseDao { + +} \ No newline at end of file diff --git a/ym-generator/src/main/java/com/cnbm/generator/code/mapper/UserMapper.xml b/ym-generator/src/main/java/com/cnbm/generator/code/mapper/UserMapper.xml new file mode 100644 index 0000000..239fea5 --- /dev/null +++ b/ym-generator/src/main/java/com/cnbm/generator/code/mapper/UserMapper.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ym-generator/src/main/java/com/cnbm/generator/code/mysql/Usermysql.sql b/ym-generator/src/main/java/com/cnbm/generator/code/mysql/Usermysql.sql new file mode 100644 index 0000000..8b8a987 --- /dev/null +++ b/ym-generator/src/main/java/com/cnbm/generator/code/mysql/Usermysql.sql @@ -0,0 +1,7 @@ +-- 菜单初始SQL +INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date)VALUES (1561967314641956865, 1067246875800000035, '系统用户', 'code/user', NULL, 0, 'icon-desktop', 0, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1561967315476623361, 1561967314641956865, '查看', NULL, 'code:user:page,code:user:info', 1, NULL, 0, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1561967315476623362, 1561967314641956865, '新增', NULL, 'code:user:save', 1, NULL, 1, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1561967315476623363, 1561967314641956865, '修改', NULL, 'code:user:update', 1, NULL, 2, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1561967315476623364, 1561967314641956865, '删除', NULL, 'code:user:delete', 1, NULL, 3, 1067246875800000001, now(), 1067246875800000001, now()); +INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1561967315476623365, 1561967314641956865, '导出', NULL, 'code:user:export', 1, NULL, 4, 1067246875800000001, now(), 1067246875800000001, now()); diff --git a/ym-generator/src/main/java/com/cnbm/generator/code/service/IUserService.java b/ym-generator/src/main/java/com/cnbm/generator/code/service/IUserService.java new file mode 100644 index 0000000..06a8e20 --- /dev/null +++ b/ym-generator/src/main/java/com/cnbm/generator/code/service/IUserService.java @@ -0,0 +1,15 @@ +package com.cnbm.generator.code.service; + +import com.cnbm.common.service.CrudService; +import com.cnbm.generator.code.dto.UserDTO; +import com.cnbm.generator.code.entity.User; + +/** + * 系统用户 + * + * @author why + * @since 2022-08-23 + */ +public interface IUserService extends CrudService { + +} \ No newline at end of file diff --git a/ym-generator/src/main/java/com/cnbm/generator/code/service/impl/UserServiceImpl.java b/ym-generator/src/main/java/com/cnbm/generator/code/service/impl/UserServiceImpl.java new file mode 100644 index 0000000..6a8c4f7 --- /dev/null +++ b/ym-generator/src/main/java/com/cnbm/generator/code/service/impl/UserServiceImpl.java @@ -0,0 +1,34 @@ +package com.cnbm.generator.code.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.cnbm.common.service.impl.CrudServiceImpl; +import com.cnbm.generator.code.dto.UserDTO; +import com.cnbm.generator.code.mapper.UserMapper; +import com.cnbm.generator.code.entity.User; +import com.cnbm.generator.code.service.IUserService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; + +import java.util.Map; + +/** + * 系统用户 + * + * @author why + * @since 2022-08-23 + */ +@Service +public class UserServiceImpl extends CrudServiceImpl implements IUserService { + + @Override + public QueryWrapper getWrapper(Map params){ + String id = (String)params.get("id"); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), "id", id); + + return wrapper; + } + + +} \ No newline at end of file diff --git a/ym-websocket/src/main/java/com/cnbm/websocket/task/SendMessageTask.java b/ym-websocket/src/main/java/com/cnbm/websocket/task/SendMessageTask.java index 0601de2..c7bdef0 100644 --- a/ym-websocket/src/main/java/com/cnbm/websocket/task/SendMessageTask.java +++ b/ym-websocket/src/main/java/com/cnbm/websocket/task/SendMessageTask.java @@ -9,8 +9,6 @@ import java.io.IOException; import java.util.Date; import java.util.Iterator; import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - /** * @Author weihongyang * @Date 2022/6/29 2:01 PM