czh 2 лет назад
Родитель
Сommit
31a18a6d86
23 измененных файлов с 193 добавлено и 41 удалено
  1. 13 7
      sckw-auth/src/main/java/com/sckw/auth/controller/AuthController.java
  2. 1 1
      sckw-auth/src/main/java/com/sckw/auth/model/vo/req/BusinessLicenseReqVo.java
  3. 0 1
      sckw-auth/src/main/java/com/sckw/auth/model/vo/req/ForgetPasswordReqVo.java
  4. 0 1
      sckw-auth/src/main/java/com/sckw/auth/model/vo/req/RegisterReqVo.java
  5. 0 1
      sckw-auth/src/main/java/com/sckw/auth/model/vo/req/UpdatePasswordReqVo.java
  6. 1 1
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/utils/PasswordUtils.java
  7. 1 1
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/web/model/EntCertificateInfo.java
  8. 1 1
      sckw-modules-api/sckw-system-api/src/main/java/com/sckw/system/api/model/dto/req/BusinessLicenseReqDto.java
  9. 1 1
      sckw-modules-api/sckw-system-api/src/main/java/com/sckw/system/api/model/dto/res/EntCertificateResDto.java
  10. 1 1
      sckw-modules/sckw-manage/src/main/java/com/sckw/manage/model/vo/res/QueryDetailCertificateResDto.java
  11. 3 1
      sckw-modules/sckw-system/src/main/java/com/sckw/system/controller/KwsRoleController.java
  12. 7 0
      sckw-modules/sckw-system/src/main/java/com/sckw/system/dao/KwsAuthorityDao.java
  13. 1 2
      sckw-modules/sckw-system/src/main/java/com/sckw/system/model/KwsEntCertificate.java
  14. 2 3
      sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/req/AddEntSettleReqVo.java
  15. 7 3
      sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/req/BusinessLicense.java
  16. 1 1
      sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/res/CertificateResVo.java
  17. 88 0
      sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/res/RoleResVo.java
  18. 1 2
      sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsEnterpriseService.java
  19. 33 2
      sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsRoleService.java
  20. 1 0
      sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsUserService.java
  21. 12 0
      sckw-modules/sckw-system/src/main/resources/mapper/KwsAuthorityDao.xml
  22. 10 10
      sckw-modules/sckw-system/src/main/resources/mapper/KwsEntCertificateDao.xml
  23. 8 1
      sckw-modules/sckw-system/src/main/resources/mapper/KwsRoleDao.xml

+ 13 - 7
sckw-auth/src/main/java/com/sckw/auth/controller/AuthController.java

@@ -41,28 +41,32 @@ public class AuthController {
     }
 
     /**
-     * @param reqDto 注册
+     * @param reqVo 注册
      * @return HttpResult
      * @desc: 用户注册
      * @author: czh
      * @date: 2023/6/16
      */
     @PostMapping("/register")
-    public HttpResult register(@Valid @RequestBody RegisterReqVo reqDto) throws SystemException {
-        authService.register(reqDto);
+    public HttpResult register(@Valid @RequestBody RegisterReqVo reqVo,
+                               @RequestHeader(name = "System-Type", required = true) int systemType) throws SystemException {
+        reqVo.setSystemType(systemType);
+        authService.register(reqVo);
         return HttpResult.ok(HttpStatus.MSG_007);
     }
 
     /**
-     * @param reqDto 忘记密码入参
+     * @param reqVo 忘记密码入参
      * @return HttpResult
      * @desc: 忘记密码
      * @author: czh
      * @date: 2023/6/19
      */
     @PostMapping("/forgetPassword")
-    public HttpResult forgetPassword(@Valid @RequestBody ForgetPasswordReqVo reqDto) throws SystemException {
-        authService.forgetPassword(reqDto);
+    public HttpResult forgetPassword(@Valid @RequestBody ForgetPasswordReqVo reqVo,
+                                     @RequestHeader(name = "System-Type", required = true) int systemType) throws SystemException {
+        reqVo.setSystemType(systemType);
+        authService.forgetPassword(reqVo);
         return HttpResult.ok(HttpStatus.MSG_002);
     }
 
@@ -73,7 +77,9 @@ public class AuthController {
      * @date 2023/06/02
      **/
     @PostMapping("/updatePassword")
-    public HttpResult updatePassword(@Valid @RequestBody UpdatePasswordReqVo reqVo) {
+    public HttpResult updatePassword(@Valid @RequestBody UpdatePasswordReqVo reqVo,
+                                     @RequestHeader(name = "System-Type", required = true) int systemType) {
+        reqVo.setSystemType(systemType);
         authService.updatePassword(reqVo);
         return HttpResult.ok(HttpStatus.MSG_002);
     }

+ 1 - 1
sckw-auth/src/main/java/com/sckw/auth/model/vo/req/BusinessLicenseReqVo.java

@@ -35,7 +35,7 @@ public class BusinessLicenseReqVo implements Serializable {
     /**
      * 证书正面
      */
-    private String certificateMian;
+    private String certificateMain;
 
     /**
      * 证书反面

+ 0 - 1
sckw-auth/src/main/java/com/sckw/auth/model/vo/req/ForgetPasswordReqVo.java

@@ -39,7 +39,6 @@ public class ForgetPasswordReqVo implements Serializable {
     /**
      * 系统类型(1运营端、2企业开户)
      */
-    @NotNull(message = "系统类型不能为空")
     private int systemType;
 
 }

+ 0 - 1
sckw-auth/src/main/java/com/sckw/auth/model/vo/req/RegisterReqVo.java

@@ -39,7 +39,6 @@ public class RegisterReqVo implements Serializable {
     /**
      * 系统类型(1运营端、2企业开户)
      */
-    @NotNull(message = "系统类型不能为空")
     private Integer systemType;
 
     /**

+ 0 - 1
sckw-auth/src/main/java/com/sckw/auth/model/vo/req/UpdatePasswordReqVo.java

@@ -39,7 +39,6 @@ public class UpdatePasswordReqVo implements Serializable {
     /**
      * 系统类型(1运营端、2企业开户)
      */
-    @NotNull(message = "系统类型不能为空")
     private int systemType;
 
 }

+ 1 - 1
sckw-common/sckw-common-core/src/main/java/com/sckw/core/utils/PasswordUtils.java

@@ -123,7 +123,7 @@ public class PasswordUtils {
     public static void main(String[] args) {
 
         String password = PasswordUtils.entryptPassword(PasswordUtils.md5("17358629958"));
-        String md5 = PasswordUtils.md5("17358629958");
+        String md5 = PasswordUtils.md5("123456");
         System.out.println(password);
         System.out.println(md5);
         System.out.println(validatePassword(md5, password));

+ 1 - 1
sckw-common/sckw-common-core/src/main/java/com/sckw/core/web/model/EntCertificateInfo.java

@@ -30,7 +30,7 @@ public class EntCertificateInfo implements Serializable {
     /**
      * 证书正面
      */
-    private String certificateMian;
+    private String certificateMain;
 
     /**
      * 证书反面

+ 1 - 1
sckw-modules-api/sckw-system-api/src/main/java/com/sckw/system/api/model/dto/req/BusinessLicenseReqDto.java

@@ -35,7 +35,7 @@ public class BusinessLicenseReqDto implements Serializable {
     /**
      * 证书正面
      */
-    private String certificateMian;
+    private String certificateMain;
 
     /**
      * 证书反面

+ 1 - 1
sckw-modules-api/sckw-system-api/src/main/java/com/sckw/system/api/model/dto/res/EntCertificateResDto.java

@@ -77,7 +77,7 @@ public class EntCertificateResDto implements Serializable {
     /**
      * 证书正面URL地址
      */
-    private String certificateMian;
+    private String certificateMain;
 
     /**
      * 证书反面URL地址

+ 1 - 1
sckw-modules/sckw-manage/src/main/java/com/sckw/manage/model/vo/res/QueryDetailCertificateResDto.java

@@ -29,7 +29,7 @@ public class QueryDetailCertificateResDto implements Serializable {
     /**
      * 正面
      */
-    private String certificateMian;
+    private String certificateMain;
 
     /**
      * 反面

+ 3 - 1
sckw-modules/sckw-system/src/main/java/com/sckw/system/controller/KwsRoleController.java

@@ -5,11 +5,13 @@ import com.github.pagehelper.PageInfo;
 import com.sckw.core.exception.SystemException;
 import com.sckw.core.model.page.PageHelperUtil;
 import com.sckw.core.model.page.PageResult;
+import com.sckw.core.utils.BeanUtils;
 import com.sckw.core.web.constant.HttpStatus;
 import com.sckw.core.web.response.HttpResult;
 import com.sckw.system.model.KwsRole;
 import com.sckw.system.model.vo.req.EditRoleReqVo;
 import com.sckw.system.model.vo.req.UserBindRoleReqVo;
+import com.sckw.system.model.vo.res.RoleResVo;
 import com.sckw.system.service.KwsRoleService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -51,7 +53,7 @@ public class KwsRoleController {
     public HttpResult select(@RequestBody HashMap params) throws SystemException {
         // 设置分页参数
         PageHelper.startPage(PageResult.getPage(params), PageResult.getPageSize(params));
-        List<KwsRole> list = kwsRoleService.findPage(params);
+        List<RoleResVo> list = kwsRoleService.findPage(params);
         PageResult pageResult = PageHelperUtil.getPageResult(new PageInfo<>(list));
         return HttpResult.ok(pageResult);
     }

+ 7 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/dao/KwsAuthorityDao.java

@@ -35,6 +35,13 @@ public interface KwsAuthorityDao {
      */
     List<KwsAuthority> selectByRoleId(Long id);
 
+    /**
+     * 详情查询
+     * @param list
+     * @return
+     */
+    List<KwsAuthority> selectByRoleIds(List<Long> list);
+
     /**
      * @param list KwsAuthority
      * @return int

+ 1 - 2
sckw-modules/sckw-system/src/main/java/com/sckw/system/model/KwsEntCertificate.java

@@ -3,7 +3,6 @@ package com.sckw.system.model;
 import com.sckw.core.model.base.BaseModel;
 import lombok.Data;
 
-import java.io.Serializable;
 import java.util.Date;
 
 /**
@@ -32,7 +31,7 @@ public class KwsEntCertificate extends BaseModel {
     /**
      * 证书正面URL地址
      */
-    private String certificateMian;
+    private String certificateMain;
 
     /**
      * 证书反面URL地址

+ 2 - 3
sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/req/AddEntSettleReqVo.java

@@ -33,7 +33,6 @@ public class AddEntSettleReqVo implements Serializable {
     /**
      * 企业编号
      */
-    @NotBlank(message = "企业编号不能为空")
     private String code;
 
     /**
@@ -87,7 +86,7 @@ public class AddEntSettleReqVo implements Serializable {
     /**
      * 企业地址
      */
-    @NotNull(message = "企业地址编码不能为空")
+//    @NotNull(message = "企业地址编码不能为空")
     private Integer cityCode;
 
     /**
@@ -119,7 +118,7 @@ public class AddEntSettleReqVo implements Serializable {
     /**
      * 专属客户经理(用户ID)
      */
-    private long manager;
+    private Long manager;
 
     /**
      * 备注

+ 7 - 3
sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/req/BusinessLicense.java

@@ -1,5 +1,7 @@
 package com.sckw.system.model.vo.req;
 
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotNull;
 import lombok.Data;
 
 import java.util.Date;
@@ -15,22 +17,24 @@ public class BusinessLicense {
     /**
      * 执照记录id,新增时为空
      */
-    private long id;
+    private Long id;
 
     /**
      * 执照编号
      */
+    @NotBlank(message = "证书编号不能为空")
     private String code;
 
     /**
      * 证书类型 (1联系人身份证 2法人身份证 3营业执照 4道路运输许可证 5开户许可证号 6授权证书 6电子签章授权书)
      */
-    private int type;
+    @NotNull(message = "证书类型不能为空")
+    private Integer type;
 
     /**
      * 证书正面
      */
-    private String certificateMian;
+    private String certificateMain;
 
     /**
      * 证书反面

+ 1 - 1
sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/res/CertificateResVo.java

@@ -26,7 +26,7 @@ public class CertificateResVo implements Serializable {
     /**
      * 证书正面URL地址
      */
-    private String certificateMian;
+    private String certificateMain;
 
     /**
      * 证书反面

+ 88 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/res/RoleResVo.java

@@ -0,0 +1,88 @@
+package com.sckw.system.model.vo.res;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.sckw.core.utils.LongToStringUtils;
+import lombok.Data;
+
+import java.io.Serial;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @author czh
+ * @desc 岗位权限
+ * @date 2023/7/13
+ */
+@Data
+public class RoleResVo implements Serializable {
+
+    @Serial
+    private static final long serialVersionUID = 5730563666152178762L;
+
+    /**
+     * 角色名称
+     */
+    private String name;
+
+    /**
+     * 当前单位id,可以是机构也可以是企业,目前产品设计是企业
+     */
+    private Long deptId;
+
+    /**
+     * 主键
+     */
+    @JsonSerialize(using = LongToStringUtils.class)
+    private Long id;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    /**
+     * 状态:0正常/1锁定
+     */
+    private Integer status;
+
+    /**
+     * 创建人
+     */
+    @JsonSerialize(using = LongToStringUtils.class)
+    private Long createBy;
+
+    /**
+     * 创建时间
+     */
+    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date createTime;
+
+    /**
+     * 更新人
+     */
+    @JsonSerialize(using = LongToStringUtils.class)
+    private Long updateBy;
+
+    /**
+     * 更新时间
+     */
+    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date updateTime;
+
+    /**
+     * 删除标识(0正常/-1删除)
+     */
+    private Integer delFlag = 0;
+
+    /**
+     * 数据权限ids
+     */
+    private String deptIds;
+
+    /**
+     * 菜单权限ids
+     */
+    private String menuIds;
+
+}

+ 1 - 2
sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsEnterpriseService.java

@@ -19,7 +19,6 @@ import com.sckw.core.web.context.LoginUserHolder;
 import com.sckw.core.web.model.EntCertificateInfo;
 import com.sckw.system.api.model.dto.req.RegisterReqDto;
 import com.sckw.system.api.model.dto.res.RegisterResDto;
-import com.sckw.system.api.model.dto.res.UserCacheResDto;
 import com.sckw.system.dao.*;
 import com.sckw.system.dubbo.RemoteSystemServiceImpl;
 import com.sckw.system.model.*;
@@ -556,7 +555,7 @@ public class KwsEnterpriseService {
             }
 
             kwsEntCertificate.setCode(businessLicense.getCode());
-            kwsEntCertificate.setCertificateMian(businessLicense.getCertificateMian());
+            kwsEntCertificate.setCertificateMain(businessLicense.getCertificateMain());
             kwsEntCertificate.setCertificateRevolt(businessLicense.getCertificateRevolt());
             kwsEntCertificate.setExpireTime(businessLicense.getExpireTime());
             kwsEntCertificate.setRemark(businessLicense.getRemark());

+ 33 - 2
sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsRoleService.java

@@ -4,6 +4,7 @@ import java.util.Date;
 
 import com.sckw.core.exception.SystemException;
 import com.sckw.core.model.constant.Global;
+import com.sckw.core.utils.BeanUtils;
 import com.sckw.core.utils.CollectionUtils;
 import com.sckw.core.utils.IdWorker;
 import com.sckw.core.utils.StringUtils;
@@ -19,11 +20,13 @@ import com.sckw.system.model.vo.req.RoleBindMenuReqVo;
 import com.sckw.system.model.vo.req.UserBindRoleReqVo;
 import com.sckw.system.model.vo.res.IdResVo;
 import com.sckw.system.model.vo.res.KwsMenuResVo;
+import com.sckw.system.model.vo.res.RoleResVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * 角色service接口
@@ -236,8 +239,36 @@ public class KwsRoleService {
      * @param params 分页入参
      * @return List
      */
-    public List<KwsRole> findPage(Map<String, Object> params) throws SystemException {
-        return kwsRoleDao.findPage(params);
+    public List<RoleResVo> findPage(Map<String, Object> params) throws SystemException {
+        List<KwsRole> list = kwsRoleDao.findPage(params);
+        if (CollectionUtils.isEmpty(list)) {
+            return Collections.emptyList();
+        }
+
+        List<RoleResVo> roleResVos = BeanUtils.copyToList(list, RoleResVo.class);
+        List<Long> roleIdList = roleResVos.stream().map(RoleResVo::getId).toList();
+        List<KwsAuthority> kwsAuthorities = kwsAuthorityDao.selectByRoleIds(roleIdList);
+        if (CollectionUtils.isNotEmpty(kwsAuthorities)) {
+            Map<Long, List<KwsAuthority>> collectKwsAuthority = kwsAuthorities.stream().collect(Collectors.groupingBy(KwsAuthority::getRoleId));
+            roleResVos.forEach(item -> {
+                List<KwsAuthority> kwsAuthorityList = collectKwsAuthority.get(item.getId());
+                if (CollectionUtils.isNotEmpty(kwsAuthorityList)) {
+                    item.setDeptIds(String.join(Global.COMMA, kwsAuthorityList.stream().map(KwsAuthority::getDeptId).map(String::valueOf).toList()));
+                }
+            });
+        }
+
+        List<KwsMenuRights> kwsMenuRights = kwsMenuRightsDao.selectByRoleIds(roleIdList);
+        if (CollectionUtils.isNotEmpty(kwsMenuRights)) {
+            Map<Long, List<KwsMenuRights>> collectKwsMenuRights = kwsMenuRights.stream().collect(Collectors.groupingBy(KwsMenuRights::getRoleId));
+            roleResVos.forEach(item -> {
+                List<KwsMenuRights> kwsMenuRightsList = collectKwsMenuRights.get(item.getId());
+                if (CollectionUtils.isNotEmpty(kwsMenuRightsList)) {
+                    item.setMenuIds(String.join(Global.COMMA, kwsMenuRightsList.stream().map(KwsMenuRights::getMenuId).map(String::valueOf).toList()));
+                }
+            });
+        }
+        return roleResVos;
     }
 
     /**

+ 1 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsUserService.java

@@ -344,6 +344,7 @@ public class KwsUserService {
 
     private void updatePwd(String newPassword, KwsUser kwsUser) throws SystemException {
         kwsUser.setPassword(PasswordUtils.entryptPassword(newPassword));
+        kwsUser.setSalt(PasswordUtils.getSaltSubPwd(kwsUser.getPassword()));
         if (kwsUserDao.update(kwsUser) <= 0) {
             throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.UPDATE_FAIL);
         }

+ 12 - 0
sckw-modules/sckw-system/src/main/resources/mapper/KwsAuthorityDao.xml

@@ -24,6 +24,7 @@
     from kws_authority
     where id = #{id,jdbcType=BIGINT}
   </select>
+
   <select id="selectByRoleId" resultType="com.sckw.system.model.KwsAuthority">
     select a.*
       from kws_authority a
@@ -32,6 +33,17 @@
        and a.role_id = #{id}
   </select>
 
+  <select id="selectByRoleIds" resultType="com.sckw.system.model.KwsAuthority">
+    select a.*
+    from kws_authority a
+    where a.del_flag = 0
+      and a.status = 0
+      and a.role_id in
+    <foreach collection="list" item="item" open="(" close=")" separator=",">
+        #{item}
+    </foreach>
+  </select>
+
   <insert id="insert" parameterType="com.sckw.system.model.KwsDept">
     insert into kws_authority
     <trim prefix="(" suffix=")" suffixOverrides=",">

+ 10 - 10
sckw-modules/sckw-system/src/main/resources/mapper/KwsEntCertificateDao.xml

@@ -6,7 +6,7 @@
     <result column="ent_id" jdbcType="BIGINT" property="entId" />
     <result column="type" jdbcType="INTEGER" property="type" />
     <result column="code" jdbcType="VARCHAR" property="code" />
-    <result column="certificate_mian" jdbcType="VARCHAR" property="certificateMian" />
+    <result column="certificate_main" jdbcType="VARCHAR" property="certificateMain" />
     <result column="certificate_revolt" jdbcType="VARCHAR" property="certificateRevolt" />
     <result column="expire_time" jdbcType="TIMESTAMP" property="expireTime" />
     <result column="remark" jdbcType="VARCHAR" property="remark" />
@@ -19,7 +19,7 @@
   </resultMap>
 
   <sql id="Base_Column_List">
-    id, ent_id, type, code, certificate_mian, certificate_revolt, remark, status, create_by, 
+    id, ent_id, type, code, certificate_main, certificate_revolt, remark, status, create_by,
     create_time, update_by, update_time, del_flag, expire_time
   </sql>
 
@@ -53,8 +53,8 @@
       <if test="code != null">
         code,
       </if>
-      <if test="certificateMian != null">
-        certificate_mian,
+      <if test="certificateMain != null">
+        certificate_main,
       </if>
       <if test="certificateRevolt != null">
         certificate_revolt,
@@ -97,8 +97,8 @@
       <if test="code != null">
         #{code,jdbcType=VARCHAR},
       </if>
-      <if test="certificateMian != null">
-        #{certificateMian,jdbcType=VARCHAR},
+      <if test="certificateMain != null">
+        #{certificateMain,jdbcType=VARCHAR},
       </if>
       <if test="certificateRevolt != null">
         #{certificateRevolt,jdbcType=VARCHAR},
@@ -137,7 +137,7 @@
             ent_id,
             type,
             code,
-            certificate_mian,
+            certificate_main,
             certificate_revolt,
             remark,
             status,
@@ -155,7 +155,7 @@
             #{item.entId,jdbcType=BIGINT},
             #{item.type,jdbcType=INTEGER},
             #{item.code,jdbcType=VARCHAR},
-            #{item.certificateMian,jdbcType=VARCHAR},
+            #{item.certificateMain,jdbcType=VARCHAR},
             #{item.certificateRevolt,jdbcType=VARCHAR},
             #{item.remark,jdbcType=VARCHAR},
             #{item.status,jdbcType=INTEGER},
@@ -181,8 +181,8 @@
       <if test="code != null">
         code = #{code,jdbcType=VARCHAR},
       </if>
-      <if test="certificateMian != null">
-        certificate_mian = #{certificateMian,jdbcType=VARCHAR},
+      <if test="certificateMain != null">
+        certificate_main = #{certificateMain,jdbcType=VARCHAR},
       </if>
       <if test="certificateRevolt != null">
         certificate_revolt = #{certificateRevolt,jdbcType=VARCHAR},

+ 8 - 1
sckw-modules/sckw-system/src/main/resources/mapper/KwsRoleDao.xml

@@ -134,11 +134,18 @@
     from kws_role sr
     where sr.del_flag = 0
     <if test="name != null and name != ''">
-      and sr.name = #{name, jdbcType=VARCHAR}
+      and sr.name like concat('%', #{name, jdbcType=VARCHAR}, '%')
     </if>
     <if test="deptId != null and deptId != ''">
       and sr.deptId = #{deptId, jdbcType=VARCHAR}
     </if>
+    <if test="startTime != null and startTime != ''">
+      and sr.create_time >= #{startTime}
+    </if>
+    <if test="endTime != null and endTime != ''" >
+      and sr.create_time &lt;= #{startTime}
+    </if>
+
     ORDER BY sr.create_time desc
   </select>
   <select id="queryRoleByUserId" resultType="com.sckw.system.model.KwsRole">