English | Simplified Chinese
Starting from Sika Design, it is not only Sika Design. Every detail is the ultimate experience vision: open source change the world, Sika Design Admin makes the world no difficult code.
- quasar-sika-design-admin
- quasar-sika-design // 前端-基于vue+quasar构建
- quasar-sika-design-server // 后端服务-基于springboot+mybatis
- doc // 文档说明
- sql // sql脚本
- quasar-sika-design-server-common // 基础公共模块;包括业务的constant+dto+query以及baseDTO+baseSrvice等等
- quasar-sika-design-server-core // 核心业务模块;包括业务的service,核心领域实现逻辑等等
- quasar-sika-design-server-ataaccess // 数据库访问层
- quasar-sika-design-server-generator // 代码生成器模块【无须开发】
- quasar-sika-design-server-web // controller层
- sika-code-cor // 核心公共组件,包括且不限于缓存组件、代码生成器组件、公共组件、数据访问、分布式锁、脚手架规范
- cache // 缓存组件
- code-generator // 代码生成器组件
- common // 公共组件
- databasse // 数据库访问组件
- hutool-starter // hutool基础集成
- lock // 分布式组件
- standard-footer // 标准脚手架组件
technology | Official website | Remark |
---|---|---|
Spring Framework | http://projects.spring.io/spring-Framework/ | container |
Spring-Boot-Dependencies | https://spring.io/projects/spring-boot/ | Not explain |
Apache Shiro | http://shiro.apache.org/ | Security framework |
Mybatis | http://www.mybatis.org/mybatis-3/zh/index.html | ORM framework |
Mybatisplus | https://mp.baomidou.com/ | ORM enhancement framework |
MyBatis-Plus-Boot-Starter | https://mp.baomidou.com/ | ORM enhancement framework |
MyBatis-Plus-Generator | https://baomidou.gitee.io/myBatis- Plus-doc/GENATE- Code/ | ORM enhancement framework |
Hikaricp | https://github.com/brettwooldridge/hikaricp/ | Database connection pool |
ShardingSphere | https://shardingsphere.apache.org/ | Library subcontraction component |
Redis | https://redis.io/ | Distributed cache database |
Commons-Collections | http://commons.apache.org/proper/commons-Collections/ | Collection tool component |
Log4j | http://logging.apache.org/log4j/1.2/ | Logo component |
Fastjson | https://mvnrepository.com/artifact/com.alibaba/fastjson/ | JSON serialization and desertified components |
Lombok | https://www.projectlombok.org/ | Simplify java code component |
Hutool | http://hutool.mydoc.io/ | Tool components that meet the habit of Chinese people |
MapStruct | http://mapStruct.org/ | Physical conversion component |
technology | Official website | Remark |
---|---|---|
Vue | https://cn.vuejs.org/ | Progressive JavaScript framework |
Quasar | http://www.quasarchs.com/ | The front -end UI framework based on Vue implementation |
ECharts | https://echarts.apache.org/zh/index.html/ | Open source visualization chart library based on JavaScript |
Lodashi | https://www.lodashjs.com/ | Consistency, modular, high -performance JavaScript utility tool library |
Quasar Sika Design_admin, based on quasar
package com.quasar.sika.design.server.business.menu.controller;
import java.util.List;
import com.sika.code.result.Result;
import com.sika.code.standard.base.controller.BaseStandardController;
import com.quasar.sika.design.server.business.menu.service.MenuService;
import com.quasar.sika.design.server.business.menu.pojo.dto.MenuDTO;
import com.quasar.sika.design.server.business.menu.pojo.query.MenuQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 菜单权限表 前端控制器
* </p>
*
* @author daiqi
* @since 2021-01-07 23:35:13
*/
@RestController(value = "menuController")
@RequestMapping("menu")
public class MenuController extends BaseStandardController {
@Autowired
private MenuService menuService;
@RequestMapping(value = "save")
public Result save(@RequestBody MenuDTO menuDto) {
return super.success(menuService.save(menuDto));
}
@RequestMapping(value = "save_batch")
public Result saveBatch(@RequestBody List<MenuDTO> menuDtos) {
return super.success(menuService.saveForBatch(menuDtos));
}
@RequestMapping(value = "update_by_id")
public Result updateById(@RequestBody MenuDTO menuDto) {
return super.success(menuService.updateById(menuDto));
}
@RequestMapping(value = "page")
public Result page(@RequestBody MenuQuery menuQuery) {
return super.success(menuService.page(menuQuery));
}
@RequestMapping(value = "find")
public Result find(@RequestBody MenuQuery menuQuery) {
return super.success(menuService.find(menuQuery));
}
@RequestMapping(value = "list")
public Result list(@RequestBody MenuQuery menuQuery) {
return super.success(menuService.list(menuQuery));
}
}
package com.quasar.sika.design.server.business.menu.service;
import com.quasar.sika.design.server.business.menu.pojo.dto.MenuDTO;
import com.sika.code.standard.base.service.BaseStandardService;
import java.util.List;
/**
* <p>
* 菜单权限表 服务类
* </p>
*
* @author daiqi
* @since 2021-01-07 23:35:09
*/
public interface MenuService extends BaseStandardService<MenuDTO> {
}
package com.quasar.sika.design.server.business.menu.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.google.common.collect.Lists;
import com.quasar.sika.design.server.business.menu.convert.MenuConvert;
import com.quasar.sika.design.server.business.menu.entity.MenuEntity;
import com.quasar.sika.design.server.business.menu.mapper.MenuMapper;
import com.quasar.sika.design.server.business.menu.pojo.dto.MenuDTO;
import com.quasar.sika.design.server.business.menu.pojo.query.MenuQuery;
import com.quasar.sika.design.server.business.menu.service.MenuService;
import com.quasar.sika.design.server.business.rolemenu.service.RoleMenuService;
import com.sika.code.standard.base.convert.BaseConvert;
import com.sika.code.standard.base.service.impl.BaseStandardServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Set;
/**
* <p>
* 菜单权限表 服务实现类
* </p>
*
* @author daiqi
* @since 2021-01-07 23:35:10
*/
@Service(value = "menuService")
public class MenuServiceImpl extends BaseStandardServiceImpl<MenuMapper, MenuEntity, MenuDTO> implements MenuService {
@Autowired
private MenuMapper menuMapper;
@Override
protected BaseConvert<MenuEntity, MenuDTO> convert() {
return MenuConvert.INSTANCE;
}
}
package com.quasar.sika.design.server.business.menu.mapper;
import com.quasar.sika.design.server.business.menu.entity.MenuEntity;
import org.springframework.stereotype.Repository;
import com.sika.code.standard.base.basemapper.BaseStandardMapper;
/**
* <p>
* 菜单权限表 Mapper 接口
* </p>
*
* @author daiqi
* @since 2021-01-07 23:35:08
*/
@Repository
public interface MenuMapper extends BaseStandardMapper<MenuEntity> {
}
<?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.quasar.sika.design.server.business.menu.mapper.MenuMapper">
<!-- 通用查询映射结果 -->
<resultMap id="ResultMap" type="com.quasar.sika.design.server.business.menu.entity.MenuEntity">
<result column="id" property="id" />
<result column="create_by" property="createBy" />
<result column="update_by" property="updateBy" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
<result column="version" property="version" />
<result column="available" property="available" />
<result column="is_deleted" property="isDeleted" />
<result column="remark" property="remark" />
<result column="menu_name" property="menuName" />
<result column="parent_id" property="parentId" />
<result column="order_num" property="orderNum" />
<result column="url" property="url" />
<result column="target" property="target" />
<result column="menu_type" property="menuType" />
<result column="visible" property="visible" />
<result column="perms" property="perms" />
<result column="icon" property="icon" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="columnList">
id, create_by, update_by, create_date, update_date, version, available, is_deleted, remark, menu_name, parent_id, order_num, url, target, menu_type, visible, perms, icon
</sql>
<!-- 根据查询条件获取列表信息 -->
<select id="listByQuery" resultMap="ResultMap" parameterType="com.quasar.sika.design.server.business.menu.pojo.query.MenuQuery" >
SELECT <include refid="columnList" />
FROM sika_menu
<where>
is_deleted = 0
<include refid="query_sql" />
</where>
</select>
<!-- 根据查询条件获取Id列表信息 -->
<select id="listIdByQuery" resultType="java.lang.Long" parameterType="com.quasar.sika.design.server.business.menu.pojo.query.MenuQuery" >
SELECT id
FROM sika_menu
<where>
is_deleted = 0
<include refid="query_sql" />
</where>
</select>
<!-- 根据查询条件获取实体信息 -->
<select id="findByQuery" resultMap="ResultMap" parameterType="com.quasar.sika.design.server.business.menu.pojo.query.MenuQuery" >
SELECT <include refid="columnList" />
FROM sika_menu
<where>
is_deleted = 0
<include refid="query_sql" />
</where>
LIMIT 1
</select>
<!-- 根据查询条件获取表id -->
<select id="findIdByQuery" resultType="java.lang.Long" parameterType="com.quasar.sika.design.server.business.menu.pojo.query.MenuQuery" >
SELECT id
FROM sika_menu
<where>
is_deleted = 0
<include refid="query_sql" />
</where>
LIMIT 1
</select>
<!-- 根据查询条件获取分页信息 -->
<select id="pageByQuery" resultMap="ResultMap" parameterType="com.quasar.sika.design.server.business.menu.pojo.query.MenuQuery" >
SELECT <include refid="columnList" />
FROM sika_menu
<where>
is_deleted = 0
<include refid="query_sql" />
</where>
<include refid="order_by_sql"/>
</select>
<!-- 根据查询条件获取总数量信息 -->
<select id="totalCountByQuery" resultType="Integer" parameterType="com.quasar.sika.design.server.business.menu.pojo.query.MenuQuery" >
SELECT count(*)
FROM sika_menu
<where>
is_deleted = 0
<include refid="query_sql" />
</where>
</select>
<!-- 根据查询条件SQL -->
<sql id="query_sql" >
<if test="query.id != null">AND id = #{query.id}</if>
<if test="query.menuId != null">AND id = #{query.menuId}</if>
<if test="query.menuName != null">AND menu_name = #{query.menuName}</if>
<if test="query.parentId != null">AND parent_id = #{query.parentId}</if>
<if test="query.orderNum != null">AND order_num = #{query.orderNum}</if>
<if test="query.url != null">AND url = #{query.url}</if>
<if test="query.target != null">AND target = #{query.target}</if>
<if test="query.menuType != null">AND menu_type = #{query.menuType}</if>
<if test="query.visible != null">AND visible = #{query.visible}</if>
<if test="query.perms != null">AND perms = #{query.perms}</if>
<if test="query.icon != null">AND icon = #{query.icon}</if>
<if test="query.ids != null and query.ids.size() > 0">
AND id in
<foreach item="item" collection="query.ids" separator="," open="(" close=")" index="">
#{item}
</foreach>
</if>
</sql>
<!-- 排序的sql -->
<sql id="order_by_sql">
<if test="query.sortColumn != null and query.sortType != null" >
ORDER BY
<include refid="order_by_column_sql"/>
<include refid="order_by_type_sql"/>
</if>
</sql>
<!-- 排序列名的sql -->
<sql id="order_by_column_sql">
<choose>
<when test="query.sortColumn == 'menuId'">
id
</when>
<otherwise>
id
</otherwise>
</choose>
</sql>
<!-- 排序类型的sql -->
<sql id="order_by_type_sql">
<choose>
<when test="query.sortType == 'DESC'">
DESC
</when>
<otherwise>
ASC
</otherwise>
</choose>
</sql>
</mapper>
package com.quasar.sika.design.server.common.auth.context;
import com.quasar.sika.design.server.common.auth.executor.AuthRegisterRequestExecutor;
import com.quasar.sika.design.server.common.auth.pojo.request.AuthRegisterRequest;
import com.quasar.sika.design.server.common.captcha.pojo.request.CaptchaCheckRequest;
import com.quasar.sika.design.server.common.mail.context.CheckMailCodeContext;
import com.quasar.sika.design.server.common.mail.pojo.request.CheckMailRequest;
import com.quasar.sika.design.server.common.shiro.util.SHA256Util;
import com.sika.code.standard.base.pojo.context.BaseStandardContext;
import com.sika.code.standard.base.pojo.executor.BaseStandardExecutor;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* @author daiqi
* @create 2021-01-09 18:02
*/
@Data
@Accessors(chain = true)
public class AuthRegisterContext extends BaseStandardContext {
private AuthRegisterRequest registerRequest;
private CheckMailRequest checkMailRequest;
protected CaptchaCheckRequest captchaCheckRequest;
private CheckMailCodeContext checkMailCodeContext;
private Boolean bindOauthUser;
@Override
public void initCustomer() {
checkMailCodeContext = new CheckMailCodeContext().setRequest(checkMailRequest);
registerRequest.setPassword(SHA256Util.sha256(registerRequest));
}
@Override
protected Class<? extends BaseStandardExecutor> buildExecutorClass() {
return AuthRegisterRequestExecutor.class;
}
}
package com.quasar.sika.design.server.common.auth.executor;
import cn.hutool.core.util.BooleanUtil;
import com.quasar.sika.design.server.common.auth.context.AuthRegisterContext;
import com.quasar.sika.design.server.common.auth.domain.AuthDomain;
import com.quasar.sika.design.server.common.auth.pojo.request.AuthLoginRequest;
import com.quasar.sika.design.server.common.auth.pojo.request.AuthRegisterRequest;
import com.quasar.sika.design.server.common.auth.pojo.response.AuthResponse;
import com.sika.code.basic.pojo.dto.ServiceResult;
import com.sika.code.exception.BusinessException;
import com.sika.code.standard.base.pojo.executor.BaseStandardExecutor;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* @author daiqi
* @create 2021-01-09 18:02
*/
@Data
@Accessors(chain = true)
public class AuthRegisterRequestExecutor extends BaseStandardExecutor<AuthRegisterContext> implements AuthDomain {
@Override
protected void executeBefore() {
verify();
}
protected void verify() {
// 图片验证码校验
captchaService().checkCaptchaVerifyCode(context.getCaptchaCheckRequest());
// 邮箱验证码校验
executorManager().execute(context.getCheckMailCodeContext());
// 校验用户名
AuthRegisterRequest registerRequest = context.getRegisterRequest();
authService().checkRegisterUsername(registerRequest);
// 校验邮箱
authService().checkRegisterEmail(registerRequest);
// 校验手机号
authService().checkRegisterPhone(registerRequest);
}
@Override
protected ServiceResult doExecute() {
AuthRegisterRequest registerRequest = context.getRegisterRequest();
boolean saveSuccess = userService().save(registerRequest);
if (BooleanUtil.isFalse(saveSuccess)) {
throw new BusinessException("保存失败,请校验注册参数");
}
return ServiceResult.newInstanceOfSucResult(AuthResponse.success(registerRequest));
}
@Override
protected void executeAfter() {
// 自动登录
AuthRegisterRequest registerRequest = context.getRegisterRequest();
AuthLoginRequest request = new AuthLoginRequest(registerRequest.getUsername(), registerRequest.getPassword());
request.setEncryptedPassword(true);
if (BooleanUtil.isTrue(context.getBindOauthUser())) {
authService().bindOauthUser(request);
} else {
authService().login(request);
}
// 移除缓存
captchaService().removeCaptchaVerifyCode(context.getCaptchaCheckRequest());
mailService().removeMailCode(context.getCheckMailRequest());
}
}
Please note that we strongly recommend that this project uses the Yarn package management tool, so that it can be loaded exactly the same dependent version (Yarn.lock) loaded by the demonstration station of this project. Since we do not control the compulsory version of the dependencies, when the non -YARN package management is introduced, it may be caused by the upgrade of the library that PRO relies on, and the new version has been introduced. The author may have problems with this project as a base project due to time problems that cannot be detected in time.
git clone https://github.com/dq-open-cloud/quasar-sika-design.git
cd quasar-sika-design
yarn install
quasar dev
quasar build
yarn run lint
The document is to be perfect
Start the step
About ISSUE feedback (important! Important! Important!) Please read the content before opening issues : Issue / PR writing suggestions
The Quasar-CLI used in the project, please make sure that the quasar-cli you use is a new version, and the CLI official documentation tutorial has been learned
Turn off ESLINT (not recommended) remove the entire node code in the eslintConfig
in package.json
, change lintOnSave
value under vue.config.js
change to false
For the production environment, please use the release
version code. Any problem with the Master code requires you to solve it by yourself
The Mysql
and Redis
environment provided by the back end belongs to the online test environment. Please do not add deletion fields during the internal testing stage
IE / EDGE | Firefox | Chrome | Safari | Opera |
---|---|---|---|---|
IE10, EDGE | last 2 versions | last 2 versions | last 2 versions | last 2 versions |
This project exist that all the people who control.
See configuration quasar.conf.js.