Anglais | chinois simplifié
À partir de la conception de Sika, ce n'est pas seulement la conception de Sika.
- 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 // 标准脚手架组件
technologie | Site officiel | Remarque |
---|---|---|
Cadre de printemps | http://projects.spring.io/spring-framework/ | récipient |
Dépenses de printemps | https://spring.io/projects/spring-boot/ | Ne pas expliquer |
Apache Shiro | http://shiro.apache.org/ | Cadre de sécurité |
Mybatis | http://www.mybatis.org/mybatis-3/zh/index.html | Cadre ORM |
Mybatisplus | https://mp.baomidou.com/ | Cadre d'amélioration ORM |
Mybatis-plus-boot-starter | https://mp.baomidou.com/ | Cadre d'amélioration ORM |
Mybatis-plus-générateur | https://baomidou.gitee.io/mybatis- Plus-Doc / Genate- Code / | Cadre d'amélioration ORM |
Hikaricp | https://github.com/brettwooldridge/hikaricp/ | Pool de connexion à la base de données |
Shardingsphere | https://shardingsphere.apache.org/ | Composant de sous-contraction de la bibliothèque |
Redis | https://redis.io/ | Base de données de cache distribuée |
Collection des communs | http://commons.apache.org/proper/comons-collections/ | Composant de l'outil de collecte |
Log4j | http://logging.apache.org/log4j/1.2/ | Composant logo |
Fastjson | https://mvnrepository.com/artifact/com.alibaba/fastjson/ | Sérialisation JSON et composants désertifiés |
Lombok | https://www.projectlombok.org/ | Simplifier le composant de code Java |
Hutool | http://hutool.mydoc.io/ | Composants d'outils qui répondent à l'habitude des Chinois |
Mapstruct | http://mapstruct.org/ | Composant de conversion physique |
technologie | Site officiel | Remarque |
---|---|---|
Vue | https://cn.vuejs.org/ | Framework JavaScript progressif |
Quasar | http://www.quasarchs.com/ | Le cadre d'interface utilisateur avant basé sur la mise en œuvre de VUE |
Échartes | https://echarts.apache.org/zh/index.html/ | Bibliothèque du diagramme de visualisation open source basée sur JavaScript |
Lodashi | https://www.lodashjs.com/ | Cohérence, bibliothèque d'outils utilitaires JavaScript modulaire, haute performance |
Quasar Sika Design_Admin, basé sur 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());
}
}
Veuillez noter que nous recommandons fortement que ce projet utilise l'outil de gestion des packages de fils, afin qu'il puisse être chargé exactement la même version dépendante (yarn.lock) chargée par la station de démonstration de ce projet. Étant donné que nous ne contrôlons pas la version obligatoire des dépendances, lorsque la gestion des packages non -yarn est introduite, elle peut être causée par la mise à niveau de la bibliothèque sur laquelle Pro s'appuie et la nouvelle version a été introduite. L'auteur peut avoir des problèmes avec ce projet en tant que projet de base en raison de problèmes de temps qui ne peuvent pas être détectés à temps.
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
Le document est pour être parfait
Démarrer le pas
À propos des commentaires sur les problèmes (important! IMPORTANT! IMPORTANT!) Veuillez lire le contenu avant d'ouvrir les problèmes : Problèmes / suggestions d'écriture de relations publiques
Le quasar-CLI utilisé dans le projet, veuillez vous assurer que le quasar-CL que vous utilisez est une nouvelle version et que le tutoriel officiel de la CLI a été appris
Désactivez Eslint (non recommandé vue.config.js
Supprimez l' lintOnSave
du code false
nœud dans l' eslintConfig
dans package.json
Pour l'environnement de production, veuillez utiliser le code de version release
.
L'environnement Mysql
et Redis
fourni par le back-end appartient à l'environnement de test en ligne.
C'est-à-dire / bord | Incendier | Chrome | Safari | Opéra |
---|---|---|---|---|
IE10, bord | 2 dernières versions | 2 dernières versions | 2 dernières versions | 2 dernières versions |
Il existe ce projet que toutes les personnes qui contrôlent.
Voir configuration quasar.conf.js.