# coffee-cloud **Repository Path**: andyhan-2000/coffee-cloud ## Basic Information - **Project Name**: coffee-cloud - **Description**: Coffee Cloud权限管理系统,基于VUE3.x、SpringCloud、Sa-Token、MyBatis-Plus等技术实现的前后端分离的权限管理系统。 可用于学习参考和项目开发。 - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-05-28 - **Last Updated**: 2022-05-28 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#### 代码生成
```
/** 按照个人需要,进行修改 */
public static final String AUTHOR = "Kevin";
public static final String PROJECT_PATH = "D:\\tempCode";
public static final String PACKAGE_PARENT = "com.coffee";
public static final String MODULE_NAME = "system";
/** 生成SQL脚本的上级菜单的ID,要开发的功能,需要放到XXX菜单下面,请找到XXX菜单的ID */
public static final String PARENT_MENU_ID = "1406064334403878913";
/** admin的ID,可以不用修改 */
public static final String CREATE_BY = "1";
public static final String UPDATE_BY = "1";
/** 默认菜单图标,可以不用修改,SQL脚本生成之后,在页面选择图标,进行修改即可 */
public static final String ICON = "ant-design:unordered-list-outlined";
// 是否导出excel
public static final Boolean exportExcel = false;
public static void main(String[] args) {
new CodeGenerator().generate(
"sys_example"
);
}
```
#### Excel导出
```
1、前端代码
a)Http请求
return defHttp.request(
{ url: Api.exportList, params: params, method: 'get', responseType: 'blob' },
{ isReturnNativeResponse: true },
);
b)文件下载
const res = await exportList(params);
const blob = res.data;
const headerFilename = res.headers['content-disposition'].split(';')[1].split('=')[1];
const filename = decodeURIComponent(escape(headerFilename));
downloadByData(blob, filename);
2、后端代码
String filename = "用户列表" + "_" + System.currentTimeMillis() + ".xlsx";
response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding("UTF-8");
response.setHeader("Content-Disposition", "attachment;filename=" + new String(filename.getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1));
EasyExcel.write(response.getOutputStream())
.head(SysUserListVO.class)
.sheet("用户列表")
.doWrite(sysUserService.list(req));
```
#### EasyExcel使用
```
excel标题宽度
两个字:@ColumnWidth(10)
四个字:@ColumnWidth(15)
```
#### Java规范
[Java开发手册](./doc/java开发手册/阿里巴巴Java开发手册(嵩山版).pdf)
#### Java编码规范
```
1、大道至简
2、IDEA安装Alibaba Java Coding Guidelines插件,编码规约扫描,代码中不要出现警告
```
#### Java命名规范
| 命名规范 | 描述 |
|---------------|--------------|
| XxDTO | 请求参数 |
| XxQueryDTO | 查询参数 |
| XxVO | 响应实体 |
| XxCloudDTO | Feign请求参数 |
| XxCloudVO | Feign响应实体 |
| XxController | Controller命名 |
| IXxService | Service接口命名 |
| XxServiceImpl | Service实现类命名 |
| XxMapper | Mapper层命名 |
| XxEntity | DB实体命名,和表名相同 |
#### MySQL建表规范
```
1、ID主键,bigint(20),雪花算法
2、审计字段,create_by、create_time、update_by、update_time
3、表中字段类型,主要采用varchar,万一迁移oracle、sqlserver数据库呢,好兼容
```
#### Vue编码规范
```
1、全局通用组件放在/src/components目录
2、业务组件放在./components目录
3、文件夹,使用camelCase命名格式
4、*.vue文件使用PascalCase命名格式,index.vue除外
5、属于类的*.js文件,使用PascalCase命名格式,index.js除外
6、属于Api的*.js文件,统一加上Api后缀,使用camelCase命名格式
7、其他类型的*.js文件,使用camelCase命名格式
8、样式文件、图片文件等,使用kebab-case命名格式
9、api模块和view模块,一一对应
10、方便记忆规则和项目开发
```
#### CSS编码规范
```
CSS编码规范,BEM:就是块(block)、元素(element)、修饰符(modifier)
.block{}
.block__element{}
.block--modifier{}
.block 代表了更高级别的抽象或组件。
.block__element 代表.block的后代,用于形成一个完整的.block的整体。
.block--modifier代表.block的不同状态或不同版本
```
### QQ群,问题反馈和Bug修复
805450144