From e0a947f0507d3ec9060781567a236cd3f3c3ce3f Mon Sep 17 00:00:00 2001 From: LGH <1746689524@qq.com> Date: Tue, 8 Nov 2022 13:58:23 +0800 Subject: [PATCH] =?UTF-8?q?codeGenerator=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../code/controller/UserController.java | 116 ------------------ .../com/cnbm/generator/code/dto/UserDTO.java | 74 ----------- .../com/cnbm/generator/code/entity/User.java | 76 ------------ .../cnbm/generator/code/excel/UserExcel.java | 52 -------- .../generator/code/mapper/UserMapper.java | 16 --- .../cnbm/generator/code/mapper/UserMapper.xml | 23 ---- .../cnbm/generator/code/mysql/Usermysql.sql | 7 -- .../generator/code/service/IUserService.java | 15 --- .../code/service/impl/UserServiceImpl.java | 34 ----- 9 files changed, 413 deletions(-) delete mode 100644 ym-generator/src/main/java/com/cnbm/generator/code/controller/UserController.java delete mode 100644 ym-generator/src/main/java/com/cnbm/generator/code/dto/UserDTO.java delete mode 100644 ym-generator/src/main/java/com/cnbm/generator/code/entity/User.java delete mode 100644 ym-generator/src/main/java/com/cnbm/generator/code/excel/UserExcel.java delete mode 100644 ym-generator/src/main/java/com/cnbm/generator/code/mapper/UserMapper.java delete mode 100644 ym-generator/src/main/java/com/cnbm/generator/code/mapper/UserMapper.xml delete mode 100644 ym-generator/src/main/java/com/cnbm/generator/code/mysql/Usermysql.sql delete mode 100644 ym-generator/src/main/java/com/cnbm/generator/code/service/IUserService.java delete mode 100644 ym-generator/src/main/java/com/cnbm/generator/code/service/impl/UserServiceImpl.java 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 deleted file mode 100644 index aeb69f2..0000000 --- a/ym-generator/src/main/java/com/cnbm/generator/code/controller/UserController.java +++ /dev/null @@ -1,116 +0,0 @@ -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 deleted file mode 100644 index 00b077e..0000000 --- a/ym-generator/src/main/java/com/cnbm/generator/code/dto/UserDTO.java +++ /dev/null @@ -1,74 +0,0 @@ -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 deleted file mode 100644 index c7ed12c..0000000 --- a/ym-generator/src/main/java/com/cnbm/generator/code/entity/User.java +++ /dev/null @@ -1,76 +0,0 @@ -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 deleted file mode 100644 index cf092ba..0000000 --- a/ym-generator/src/main/java/com/cnbm/generator/code/excel/UserExcel.java +++ /dev/null @@ -1,52 +0,0 @@ -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 deleted file mode 100644 index e938420..0000000 --- a/ym-generator/src/main/java/com/cnbm/generator/code/mapper/UserMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -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 deleted file mode 100644 index 239fea5..0000000 --- a/ym-generator/src/main/java/com/cnbm/generator/code/mapper/UserMapper.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - 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 deleted file mode 100644 index 8b8a987..0000000 --- a/ym-generator/src/main/java/com/cnbm/generator/code/mysql/Usermysql.sql +++ /dev/null @@ -1,7 +0,0 @@ --- 菜单初始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 deleted file mode 100644 index 06a8e20..0000000 --- a/ym-generator/src/main/java/com/cnbm/generator/code/service/IUserService.java +++ /dev/null @@ -1,15 +0,0 @@ -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 deleted file mode 100644 index 6a8c4f7..0000000 --- a/ym-generator/src/main/java/com/cnbm/generator/code/service/impl/UserServiceImpl.java +++ /dev/null @@ -1,34 +0,0 @@ -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