jwt,oauth登录开发完成,系统管理开发完成,修复了若干bug
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
docker run --name mysql-master -d -p 3317:3306 -v /opt/mysql-master:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=studyj2e mysql:5.7
|
||||
# 修复了数据库中文乱码问题
|
||||
docker run --name mysql-master -d -p 3317:3306 -v /opt/mysql-master:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=studyj2e mysql:5.7 --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
|
||||
+3
-3
@@ -13,7 +13,7 @@ import org.springframework.validation.BindException;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -51,7 +51,7 @@ public class ${pojoName}Controller {
|
||||
|
||||
@ApiOperation("修改信息")
|
||||
@PutMapping("/{id}")
|
||||
public ServerResponse update${pojoName}(${pojoName} ${varPojoName},
|
||||
public ServerResponse update${pojoName}(@Valid ${pojoName} ${varPojoName},
|
||||
@NotBlank(message = BaseConst.BASEMSG_PREFIX+"请传入id") String id){
|
||||
${varPojoName}.setId(${mybatisGenerator.primaryKeyType}.valueOf(id));
|
||||
return ${varPojoName}Service.update(${varPojoName});
|
||||
@@ -59,7 +59,7 @@ public class ${pojoName}Controller {
|
||||
|
||||
@ApiOperation("根据id删除,传入数组")
|
||||
@DeleteMapping
|
||||
public ServerResponse delete${pojoName}(@NotEmpty(message = BaseConst.BASEMSG_PREFIX+"请传入ids") List<${mybatisGenerator.primaryKeyType}> ids){
|
||||
public ServerResponse delete${pojoName}(@NotEmpty(message = BaseConst.BASEMSG_PREFIX+"请传入ids") ArrayList<${mybatisGenerator.primaryKeyType}> ids){
|
||||
return ${varPojoName}Service.deleteByIds(ids);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,3 +14,8 @@
|
||||
- 对于数据源的切换方法是使用aop的方式对`@SwitchDataSource('数据源的名字')`进行拦截动态切换数据源,主数据源的名字是`master`,从数据源的名字是`slave`.对于没有注解默认的数据源是`master`.
|
||||
- PageHelper只对紧跟着的第一个SQL语句起作用
|
||||
- 如果向定义n个数据源,在自己项目使用中定义bean即可,但是数据源的名字请不要使用`salve` `master` `masterDataSource` `dataSource` `dynamicDataSource`
|
||||
### mybatis中传入参数的注意事项,通过反射是无法取到参数的名字的,知道这个很重要
|
||||
- 如果传入的是单参数且参数类型是一个List的时候,collection属性值为list .
|
||||
- 如果传入的是单参数且参数类型是一个array数组的时候,collection的属性值为array .
|
||||
- 如果传入的参数是多个的时候,我们就需要把它们封装成一个Map了,当然单参数也可以封装成map,实际上如果你在传入参数的时候,在MyBatis里面也是会把它封装成一个Map的,map的key就是参数名,所以这个时候collection属性值就是传入的List或array对象在自己封装的map里面的key.
|
||||
|
||||
|
||||
+3
-1
@@ -1,6 +1,8 @@
|
||||
package com.micro.fast.common.dao;
|
||||
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface SsmMapper<T,ID> {
|
||||
@@ -26,5 +28,5 @@ public interface SsmMapper<T,ID> {
|
||||
*/
|
||||
List<T> selectByCondition(T record);
|
||||
|
||||
int deleteByPrimaryKeys(List<ID> id);
|
||||
int deleteByPrimaryKeys(List<ID> ids);
|
||||
}
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ public class SsmServiceImpl<T, ID extends Serializable, MAPPER extends SsmMappe
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerResponse getByCondition(T pojo,int pageSize,int pageNum,String orderBy){
|
||||
public ServerResponse getByCondition(T pojo,int pageNum,int pageSize,String orderBy){
|
||||
// 判断是否排序
|
||||
if (StringUtils.isBlank(orderBy)) {
|
||||
PageHelper.startPage(pageNum, pageSize);
|
||||
|
||||
@@ -13,7 +13,7 @@ import org.springframework.validation.BindException;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* 系统管理
|
||||
@@ -31,7 +31,9 @@ public class UpmsSystemController {
|
||||
@PostMapping
|
||||
public ServerResponse addSystem(@Valid UpmsSystem upmsSystem) throws BindException {
|
||||
upmsSystem.setCtime(System.currentTimeMillis());
|
||||
upmsSystem.setStatus((byte)1);
|
||||
if (upmsSystem.getStatus() == null){
|
||||
upmsSystem.setStatus((byte)1);
|
||||
}
|
||||
return upmsSystemService.add(upmsSystem);
|
||||
}
|
||||
|
||||
@@ -53,7 +55,7 @@ public class UpmsSystemController {
|
||||
|
||||
@ApiOperation("修改信息")
|
||||
@PutMapping("/{id}")
|
||||
public ServerResponse updateSystem(UpmsSystem upmsSystem,
|
||||
public ServerResponse updateSystem(@Valid UpmsSystem upmsSystem,
|
||||
@NotBlank(message = BaseConst.BASEMSG_PREFIX+"请传入id") String id){
|
||||
upmsSystem.setId(Integer.valueOf(id));
|
||||
return upmsSystemService.update(upmsSystem);
|
||||
@@ -62,7 +64,7 @@ public class UpmsSystemController {
|
||||
@ApiOperation("根据id删除,传入数组")
|
||||
@DeleteMapping
|
||||
public ServerResponse deleteSystem(
|
||||
@NotEmpty(message = BaseConst.BASEMSG_PREFIX+"请传入id") List<Integer> ids){
|
||||
@NotEmpty(message = BaseConst.BASEMSG_PREFIX+"请传入id") @RequestParam("ids") ArrayList<Integer> ids){
|
||||
return upmsSystemService.deleteByIds(ids);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.micro.fast.upms.dao;
|
||||
|
||||
import com.micro.fast.common.dao.SsmMapper;
|
||||
import com.micro.fast.upms.pojo.UpmsSystem;
|
||||
import feign.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -29,5 +30,5 @@ public interface UpmsSystemMapper extends SsmMapper<UpmsSystem,Integer> {
|
||||
List<UpmsSystem> selectByCondition(UpmsSystem record);
|
||||
|
||||
@Override
|
||||
int deleteByPrimaryKeys(List<Integer> id);
|
||||
int deleteByPrimaryKeys(List<Integer> ids);
|
||||
}
|
||||
@@ -32,7 +32,7 @@ public interface UpmsUserMapper extends SsmMapper<UpmsUser,Integer>{
|
||||
List<UpmsUser> selectByCondition(UpmsUser record);
|
||||
|
||||
@Override
|
||||
int deleteByPrimaryKeys(List<Integer> id);
|
||||
int deleteByPrimaryKeys(List<Integer> ids);
|
||||
|
||||
/**
|
||||
* 根据用户名查找用户
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.micro.fast.upms.pojo;
|
||||
|
||||
import com.micro.fast.boot.starter.common.response.BaseConst;
|
||||
import org.hibernate.validator.constraints.NotBlank;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
@@ -14,17 +15,17 @@ public class UpmsSystem implements Serializable {
|
||||
|
||||
private String theme;
|
||||
|
||||
@NotNull(message = BaseConst.BASEMSG_PREFIX+"请填写系统路径")
|
||||
@NotBlank(message = BaseConst.BASEMSG_PREFIX+"请填写系统路径")
|
||||
private String basepath;
|
||||
|
||||
private Byte status;
|
||||
|
||||
@NotNull(message = BaseConst.BASEMSG_PREFIX+"请填写系统名称")
|
||||
@NotBlank(message = BaseConst.BASEMSG_PREFIX+"请填写系统名称")
|
||||
private String name;
|
||||
|
||||
private String title;
|
||||
|
||||
@NotNull(message = BaseConst.BASEMSG_PREFIX+"请填写系统描述")
|
||||
@NotBlank(message = BaseConst.BASEMSG_PREFIX+"请填写系统描述")
|
||||
private String description;
|
||||
|
||||
private Long ctime;
|
||||
|
||||
@@ -169,20 +169,23 @@
|
||||
SELECT <include refid="Base_Column_List"/> FROM upms_system
|
||||
<where>
|
||||
<if test="title != null">
|
||||
title like "%"#{title}"%"
|
||||
and title like #{title}
|
||||
</if>
|
||||
<if test="basepath !=null">
|
||||
and basepath like "%"#{basepath}"%"
|
||||
and basepath like #{basepath}
|
||||
</if>
|
||||
<if test="name != null">
|
||||
and name like "%"#{name}"%"
|
||||
and name like #{name}
|
||||
</if>
|
||||
<if test="status != null">
|
||||
and status = #{status}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKeys" parameterType="java.util.List">
|
||||
DELETE FROM upms_system
|
||||
WHERE id IN
|
||||
<foreach collection="ids" index="index" item="item" open="(" separator="," close=")">
|
||||
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
@@ -200,7 +200,7 @@
|
||||
<delete id="deleteByPrimaryKeys" parameterType="java.util.List">
|
||||
delete from upms_user
|
||||
where id IN
|
||||
<foreach collection="ids" index="index" item="item" open="(" separator="," close=")">
|
||||
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
Reference in New Issue
Block a user