Przeglądaj źródła

好友欢迎语 欢迎语列表查询修改、添加欢迎语修改、企微用户列表查询修改

Long 5 dni temu
rodzic
commit
63212d2573

+ 9 - 16
fs-company/src/main/java/com/fs/company/controller/qw/QwFriendWelcomeController.java

@@ -1,5 +1,6 @@
 package com.fs.company.controller.qw;
 
+import com.fs.common.annotation.DataScope;
 import com.fs.common.annotation.Log;
 import com.fs.common.core.controller.BaseController;
 import com.fs.common.core.domain.AjaxResult;
@@ -8,6 +9,7 @@ import com.fs.common.core.page.TableDataInfo;
 import com.fs.common.enums.BusinessType;
 import com.fs.common.utils.ServletUtils;
 import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.company.domain.CompanyUser;
 import com.fs.framework.security.LoginUser;
 import com.fs.framework.service.TokenService;
 import com.fs.qw.domain.QwFriendWelcome;
@@ -49,24 +51,13 @@ public class QwFriendWelcomeController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('qw:friendWelcome:list')")
     @GetMapping("/list")
+    @DataScope(deptAlias = "w", userAlias = "w")
     public TableDataInfo list(QwFriendWelcomeParam qwFriendWelcomeParam)
     {
-        startPage();
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
         qwFriendWelcomeParam.setCompanyId(loginUser.getCompany().getCompanyId());
-        if(qwFriendWelcomeParam.getType() != null){
-            if(qwFriendWelcomeParam.getType() == 1){
-                List<QwOptionsVO> qwOptionsVOS = qwUserService.selectQwUserListOptionsVOByCompanyUserId(loginUser.getUser().getUserId());
-                qwFriendWelcomeParam.setQwUserIds(qwOptionsVOS.stream().map(QwOptionsVO::getDictValue).collect(Collectors.joining(",")));
-                if(StringUtils.isEmpty(qwFriendWelcomeParam.getQwUserIds())){
-                    return getDataTable(Collections.EMPTY_LIST);
-                }
-            }
-            if(qwFriendWelcomeParam.getType() == 2){
-
-            }
-        }
-        List<QwFriendWelcome> list = qwFriendWelcomeService.selectQwFriendWelcomeListVO(qwFriendWelcomeParam);
+        startPage();
+        List<QwFriendWelcome> list = qwFriendWelcomeService.selectQwFriendWelcomeList(qwFriendWelcomeParam);
         return getDataTable(list);
     }
 
@@ -119,8 +110,10 @@ public class QwFriendWelcomeController extends BaseController
     public R add(@RequestBody QwFriendWelcomeParam qwFriendWelcomeParam)
     {
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
-        Long companyId = loginUser.getCompany().getCompanyId();
-        qwFriendWelcomeParam.setCompanyId(companyId);
+        CompanyUser companyUser = loginUser.getUser();
+        qwFriendWelcomeParam.setCompanyId(companyUser.getCompanyId());
+        qwFriendWelcomeParam.setCompanyUserId(companyUser.getUserId());
+        qwFriendWelcomeParam.setDeptId(companyUser.getDeptId());
         qwFriendWelcomeParam.setCreateTime(new Date());
         qwFriendWelcomeParam.setUpdateTime(new Date());
         return qwFriendWelcomeService.insertQwFriendWelcomeVO(qwFriendWelcomeParam);

+ 6 - 0
fs-service/src/main/java/com/fs/qw/domain/QwFriendWelcome.java

@@ -49,6 +49,12 @@ public class QwFriendWelcome extends BaseEntity
     @Excel(name = "公司id")
     private Long companyId;
 
+    /** 销售ID */
+    private Long userId;
+
+    /** 部门ID */
+    private Long deptId;
+
     /** 创建时间 */
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date createTime;

+ 7 - 0
fs-service/src/main/java/com/fs/qw/mapper/QwFriendWelcomeMapper.java

@@ -103,4 +103,11 @@ public interface QwFriendWelcomeMapper
      * @return 结果
      */
     public int deleteQwFriendWelcomeByIds(Long[] ids);
+
+    /**
+     * 查询欢迎语列表
+     * @param qwFriendWelcomeParam 参数
+     * @return  list
+     */
+    List<QwFriendWelcome> selectQwFriendWelcomeList(QwFriendWelcomeParam qwFriendWelcomeParam);
 }

+ 1 - 1
fs-service/src/main/java/com/fs/qw/mapper/QwUserMapper.java

@@ -190,7 +190,7 @@ public interface QwUserMapper extends BaseMapper<QwUser>
             "where qu.is_del=0 and qu.company_user_id is not null"+
             "            <if test=\"qwUserId != null  and qwUserId != ''\"> and qu.qw_user_id = #{qwUserId}</if>\n" +
             "            <if test=\"companyId != null \"> and qu.company_id = #{companyId}</if>\n" +
-            "            <if test=\"nickName != null  and nickName != ''\"> and cu.nick_name like concat( #{nickName}, '%') </if>\n" +
+            "            <if test=\"nickName != null  and nickName != ''\"> and cu.nick_name like concat('%', #{nickName}, '%') </if>\n" +
             "            <if test=\"qwUserName != null  and qwUserName != ''\"> and qu.qw_user_uame like concat( #{qwUserName}, '%') </if>\n" +
             "            <if test=\"companyUserId != null \"> and qu.company_user_id = #{companyUserId}</if>\n" +
             "            <if test=\"corpId != null \"> and qu.corp_id = #{corpId}</if>\n" +

+ 3 - 0
fs-service/src/main/java/com/fs/qw/param/QwFriendWelcomeParam.java

@@ -58,4 +58,7 @@ public class QwFriendWelcomeParam extends BaseEntity {
     @Excel(name = "公司员工id")
     private Long companyUserId;
 
+    /** 部门ID */
+    private Long deptId;
+
 }

+ 7 - 0
fs-service/src/main/java/com/fs/qw/service/IQwFriendWelcomeService.java

@@ -64,4 +64,11 @@ public interface IQwFriendWelcomeService
      * @return 结果
      */
     public int deleteQwFriendWelcomeById(Long id);
+
+    /**
+     * 查询欢迎语列表
+     * @param qwFriendWelcomeParam 参数
+     * @return list
+     */
+    List<QwFriendWelcome> selectQwFriendWelcomeList(QwFriendWelcomeParam qwFriendWelcomeParam);
 }

+ 10 - 0
fs-service/src/main/java/com/fs/qw/service/impl/QwFriendWelcomeServiceImpl.java

@@ -383,6 +383,16 @@ public class QwFriendWelcomeServiceImpl implements IQwFriendWelcomeService {
         return qwFriendWelcomeMapper.deleteQwFriendWelcomeById(id);
     }
 
+    /**
+     * 查询欢迎语列表
+     * @param qwFriendWelcomeParam 参数
+     * @return list
+     */
+    @Override
+    public List<QwFriendWelcome> selectQwFriendWelcomeList(QwFriendWelcomeParam qwFriendWelcomeParam) {
+        return qwFriendWelcomeMapper.selectQwFriendWelcomeList(qwFriendWelcomeParam);
+    }
+
     /**
      * url转临时文件filr
      */

+ 37 - 0
fs-service/src/main/resources/mapper/qw/QwFriendWelcomeMapper.xml

@@ -41,6 +41,39 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where id = #{id}
     </select>
 
+    <select id="selectQwFriendWelcomeList" resultType="com.fs.qw.domain.QwFriendWelcome">
+        select
+            w.*
+        from qw_friend_welcome w
+        <where>
+            <if test="qwUserIds != null  and qwUserIds != ''">
+                and FIND_IN_SET(#{qwUserIds},REPLACE(REPLACE(REPLACE(qw_user_ids, '[', ''), ']', ''), ' ', '')) > 0
+            </if>
+            <if test="isSendMsg != null ">
+                and is_send_msg = #{isSendMsg}
+            </if>
+            <if test="welcomeText != null  and welcomeText != ''">
+                and welcome_text = #{welcomeText}
+            </if>
+            <if test="isDayparting != null ">
+                and is_dayparting = #{isDayparting}
+            </if>
+            <if test="companyId != null ">
+                and company_id = #{companyId}
+            </if>
+            <if test="createTime != null ">
+                and create_time = #{createTime}
+            </if>
+            <if test="corpId != null ">
+                and corp_id = #{corpId}
+            </if>
+            <if test="updateTime != null ">
+                and update_time = #{updateTime}
+            </if>
+            ${params.dataScope}
+        </where>
+    </select>
+
     <insert id="insertQwFriendWelcomeVO" parameterType="QwFriendWelcome" useGeneratedKeys="true" keyProperty="id">
         insert into qw_friend_welcome
         <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -51,6 +84,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="isDayparting != null">is_dayparting,</if>
             <if test="daypartingItemlist != null">dayparting_ItemList,</if>
             <if test="companyId != null">company_id,</if>
+            <if test="companyUserId != null">user_id,</if>
+            <if test="deptId != null">dept_id,</if>
             <if test="createTime != null">create_time,</if>
             <if test="updateTime != null">update_time,</if>
             <if test="corpId != null">corp_id,</if>
@@ -63,6 +98,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="isDayparting != null">#{isDayparting},</if>
             <if test="daypartingItemlist != null">#{daypartingItemlist},</if>
             <if test="companyId != null">#{companyId},</if>
+            <if test="companyUserId != null">#{companyUserId},</if>
+            <if test="deptId != null">#{deptId},</if>
             <if test="createTime != null">#{createTime},</if>
             <if test="updateTime != null">#{updateTime},</if>
             <if test="corpId != null">#{corpId},</if>