瀏覽代碼

八项成本柱状图,将部门查询提出来

丁治程 1 年之前
父節點
當前提交
8079928807

+ 13 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/SysUserDepartMapper.xml

@@ -60,4 +60,17 @@
             and (a.username like #{bindKeyword} or a.realname like #{bindKeyword})
         </if>
     </select>
+
+	<resultMap id="DepartMap" type="String">
+		<result column="depart_name"></result>
+	</resultMap>
+	<!-- 根据登录时的用户名 查询该用户所属部门 -->
+	<select id="getDepartByUsername" resultMap="DepartMap">
+		SELECT depart_name
+		FROM sys_depart
+		WHERE id IN
+			  (SELECT dep_id FROM sys_user_depart WHERE user_id IN
+														(SELECT id FROM sys_user WHERE username = #{username})
+			  )
+	</select>
 </mapper>

+ 9 - 7
module_kzks/src/main/java/org/jeecg/modules/Index/mapper/IndexZcbMapper.java

@@ -3,6 +3,7 @@ package org.jeecg.modules.Index.mapper;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.jeecg.modules.Index.entity.vo.EightCosts;
+import org.jeecg.modules.dataSourceSwitch.annotation.TargetDataSource;
 import org.jeecg.modules.wzOutboundOrder.entity.WzOutboundOrderB;
 
 import java.math.BigDecimal;
@@ -16,6 +17,7 @@ import java.util.List;
  * @des 领导驾驶舱支出模块
  */
 @Mapper
+@TargetDataSource
 public interface IndexZcbMapper {
 
 
@@ -46,13 +48,13 @@ public interface IndexZcbMapper {
      */
     public BigDecimal getZcbByDate(@Param("nowDate") String nowDate);
 
-    /**
-     *   author: dzc
-     *   version: 1.0
-     *   des: 根据用户名查询部门名称
-     *   date: 2023/9/21
-     */
-    public List<String> getDepartByUsername(String username);
+    ///**
+    // *   author: dzc
+    // *   version: 1.0
+    // *   des: 根据用户名查询部门名称
+    // *   date: 2023/9/21
+    // */
+    //public List<String> getDepartByUsername(String username);
 
 
     /**

+ 12 - 12
module_kzks/src/main/java/org/jeecg/modules/Index/mapper/xml/IndexZcbMapper.xml

@@ -51,18 +51,18 @@
             YEAR = #{nowDate}
     </select>
 
-    <resultMap id="DepartMap" type="String">
-        <result column="depart_name"></result>
-    </resultMap>
-    <!-- 根据登录时的用户名 查询该用户所属部门 -->
-    <select id="getDepartByUsername" resultMap="DepartMap">
-        SELECT depart_name
-        FROM sys_depart
-        WHERE id IN
-              (SELECT dep_id FROM sys_user_depart WHERE user_id IN
-                (SELECT id FROM sys_user WHERE username = #{username})
-              )
-    </select>
+<!--    <resultMap id="DepartMap" type="String">-->
+<!--        <result column="depart_name"></result>-->
+<!--    </resultMap>-->
+<!--    &lt;!&ndash; 根据登录时的用户名 查询该用户所属部门 &ndash;&gt;-->
+<!--    <select id="getDepartByUsername" resultMap="DepartMap">-->
+<!--        SELECT depart_name-->
+<!--        FROM sys_depart-->
+<!--        WHERE id IN-->
+<!--              (SELECT dep_id FROM sys_user_depart WHERE user_id IN-->
+<!--                (SELECT id FROM sys_user WHERE username = #{username})-->
+<!--              )-->
+<!--    </select>-->
 
     <!-- 查询去年同期总成本 根据部门 -->
     <select id="getZcbByDepartAndUpDate" resultType="BigDecimal">

+ 8 - 3
module_kzks/src/main/java/org/jeecg/modules/Index/service/impl/IndexZcbServiceImpl.java

@@ -15,6 +15,7 @@ import org.jeecg.modules.Index.mapper.IndexZcbMapper;
 import org.jeecg.modules.Index.service.IndexZcbService;
 import org.jeecg.modules.Index.util.AuthMark;
 import org.jeecg.modules.Index.util.CommonMethod;
+import org.jeecg.modules.system.mapper.SysUserDepartMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -54,6 +55,10 @@ public class IndexZcbServiceImpl implements IndexZcbService {
     @SuppressWarnings("all")
     private CommonMethod commonMethod;
 
+    @Autowired
+    @SuppressWarnings("all")
+    private SysUserDepartMapper sysUserDepartMapper;
+
 
     /**
      *   author: dzc
@@ -74,7 +79,7 @@ public class IndexZcbServiceImpl implements IndexZcbService {
         //获取当前用户的角色的集合 (一个用户可能会有多个角色)
         String role = commonMethod.getRole(username);
         // 根据用户名查询对应的部门
-        List<String> deptList = indexZcbMapper.getDepartByUsername(username);
+        List<String> deptList = sysUserDepartMapper.getDepartByUsername(username);
         //处理当前系统日期
         SimpleDateFormat simpl = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         SimpleDateFormat simpl1 = new SimpleDateFormat("yyyy-MM");
@@ -320,7 +325,7 @@ public class IndexZcbServiceImpl implements IndexZcbService {
         //获取当前用户的角色的集合 (一个用户可能会有多个角色)
         String role = commonMethod.getRole(username);
         // 该用户的部门
-        List<String> deptList = indexZcbMapper.getDepartByUsername(username);
+        List<String> deptList = sysUserDepartMapper.getDepartByUsername(username);
         // 创建响应给前端的实体
         //ArrayList<IndexChartInfoVo> resultList = new ArrayList<>();
         ArrayList<EightCostChartInfoVo> resultList = new ArrayList<>();
@@ -694,7 +699,7 @@ public class IndexZcbServiceImpl implements IndexZcbService {
         // 查询当前用户的角色id (一个用户可能对应多个角色)
         String role = commonMethod.getRole(username);
         // 该用户的部门
-        List<String> deptList = indexZcbMapper.getDepartByUsername(username);
+        List<String> deptList = sysUserDepartMapper.getDepartByUsername(username);
         // 创建响应给前端的实体
         ArrayList<ResultEightCost> resultList = new ArrayList<>();
         // 获取前端传过来的 开始日期 和 结束日期