Browse Source

接口api

liulingchao 4 years ago
parent
commit
35b3085622

+ 1 - 1
dgtly-api/src/main/java/com/dgtly/api/controller/SysNoticeInterface.java

@@ -78,7 +78,7 @@ public class SysNoticeInterface extends ApiBaseController {
         String noticeType = sysNotice.getNoticeType();
         if(StringUtils.isNotEmpty(noticeType)){
             startPage(obj);/*向分页传递 分页参数*/
-            List<SysNotice> sysNoticeList = sysNoticeService.selectNoticeTop3ByRole(sysNotice);
+            List<SysNotice> sysNoticeList = sysNoticeService.selectNoticeList(sysNotice);
             return AjaxResult.success(getDataTable(sysNoticeList));
         }else{
             return AjaxResult.error("参数为空");

+ 2 - 1
dgtly-member/dgtly-member-admin/src/main/java/com/dgtly/notice/controller/NoticeSupplyController.java

@@ -2,6 +2,7 @@ package com.dgtly.notice.controller;
 
 import java.util.List;
 
+import com.dgtly.common.annotation.DataScope;
 import com.dgtly.common.utils.StringUtils;
 import com.dgtly.common.utils.file.FileUploadUtils;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
@@ -46,7 +47,7 @@ public class NoticeSupplyController extends BaseController
     }
 
     /**
-     * 查询【请填写功能名称】列表
+     * 供应信息列表
      */
     @RequiresPermissions("notice:supply:list")
     @PostMapping("/list")

+ 3 - 0
dgtly-member/dgtly-member-common/src/main/java/com/dgtly/notice/service/impl/NoticeSupplyServiceImpl.java

@@ -1,6 +1,8 @@
 package com.dgtly.notice.service.impl;
 
 import java.util.List;
+
+import com.dgtly.common.annotation.DataScope;
 import com.dgtly.common.utils.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -40,6 +42,7 @@ public class NoticeSupplyServiceImpl implements INoticeSupplyService
      * @return 【请填写功能名称】
      */
     @Override
+    @DataScope(deptAlias = "d")
     public List<NoticeSupply> selectNoticeSupplyList(NoticeSupply noticeSupply)
     {
         return noticeSupplyMapper.selectNoticeSupplyList(noticeSupply);

+ 21 - 20
dgtly-member/dgtly-member-common/src/main/resources/mapper/notice/NoticeSupplyMapper.xml

@@ -30,17 +30,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <sql id="selectNoticeSupplyVo">
 SELECT
   n.id,
-  type_id,
-  t.`name`,
-  merchant_id,
-  supply_title,
-  supply_details,
-  manufacturer,
-  contacts,
-  telephone,
-  release_time,
-  picture,
-  `status`,
+  n.type_id,
+  t.name,
+  n.merchant_id,
+  n.supply_title,
+  n.supply_details,
+  n.manufacturer,
+  n.contacts,
+  n.telephone,
+  n.release_time,
+  n.picture,
+  n.status,
   n.create_by,
   n.create_time,
   n.update_by,
@@ -50,22 +50,23 @@ SELECT
 FROM
   notice_supply AS n
   LEFT JOIN goods_type AS t ON n.`type_id` = t.`id`
+  left join sys_user u on n.create_by = u.login_name
+  left join sys_dept d on d.dept_id = u.dept_id
   </sql>
 
     <select id="selectNoticeSupplyList" parameterType="NoticeSupply" resultMap="NoticeSupplyResult">
         <include refid="selectNoticeSupplyVo"/>
         <where>  
-            <if test="typeId != null "> and type_id = #{typeId}</if>
-            <if test="merchantId != null "> and merchant_id = #{merchantId}</if>
-            <if test="supplyTitle != null  and supplyTitle != ''"> and supply_title = #{supplyTitle}</if>
-            <if test="supplyDetails != null  and supplyDetails != ''"> and supply_details = #{supplyDetails}</if>
-            <if test="manufacturer != null  and manufacturer != ''"> and manufacturer = #{manufacturer}</if>
-            <if test="contacts != null  and contacts != ''"> and contacts = #{contacts}</if>
-            <if test="telephone != null  and telephone != ''"> and telephone = #{telephone}</if>
-            <if test="releaseTime != null "> and release_time = #{releaseTime}</if>
-            <if test="picture != null  and picture != ''"> and picture = #{picture}</if>
+            <if test="typeId != null "> and n.type_id = #{typeId}</if>
+            <if test="merchantId != null "> and n.merchant_id = #{merchantId}</if>
+            <if test="supplyTitle != null  and supplyTitle != ''"> and n.supply_title = #{supplyTitle}</if>
+            <if test="manufacturer != null  and manufacturer != ''"> and n.manufacturer = #{manufacturer}</if>
+            <if test="contacts != null  and contacts != ''"> and n.contacts = #{contacts}</if>
+            <if test="telephone != null  and telephone != ''"> and n.telephone = #{telephone}</if>
             <if test="status != null  and status != ''"> and n.status = #{status}</if>
+            ${params.dataScope}
         </where>
+
     </select>
     
     <select id="selectNoticeSupplyById" parameterType="Long" resultMap="NoticeSupplyResult">

+ 2 - 1
dgtly-system/src/main/resources/mapper/system/SysNoticeMapper.xml

@@ -63,6 +63,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 			<if test="createBy != null and createBy != ''">
 				AND create_by like concat('%', #{createBy}, '%')
 			</if>
+            ORDER BY create_time desc
 		</where>
     </select>
 
@@ -73,7 +74,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 AND sn.notice_title like concat('%', #{noticeTitle}, '%')
             </if>
             <if test="companyId != null and companyId != 0">
-                AND company_id = #{companyId}
+                AND sn.company_id = #{companyId}
             </if>
             <if test="noticeType != null and noticeType != ''">
                 AND sn.notice_type = #{noticeType}

+ 2 - 1
dgtly-system/src/main/resources/mapper/system/SysRoleMapper.xml

@@ -25,7 +25,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         from sys_role r
 	        left join sys_user_role ur on ur.role_id = r.role_id
 	        left join sys_user u on u.user_id = ur.user_id
-	        left join sys_dept d on u.dept_id = d.dept_id
+	        left join sys_user u1 on u1.login_name = r.create_by
+	        left join sys_dept d on u1.dept_id = d.dept_id
     </sql>
     
     <sql id="selectRoleVo">