Quellcode durchsuchen

增加根据用户获取station_id

MS-QJVSRANLTYEO\Administrator vor 4 Jahren
Ursprung
Commit
03152c29d4

+ 7 - 0
Yijia-SaaS/yijia-customer/src/main/resources/mapper/customer/CustomerGradeSettingMapper.xml

@@ -55,6 +55,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="oilName != null  and oilName != ''"> and oil_name like concat('%', #{oilName}, '%')</if>
             <if test="memberConditStart != null "> and member_condit_start = #{memberConditStart}</if>
             <if test="memberConditEnd != null "> and member_condit_end = #{memberConditEnd}</if>
+            <if test="stationIdList != null ">
+                and station_id in
+                <foreach item="item" index="index" collection="stationIdList"
+                         open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
         </where>
     </select>
     

+ 7 - 0
Yijia-SaaS/yijia-customer/src/main/resources/mapper/customer/CustomerManageMapper.xml

@@ -69,6 +69,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="liters != null "> and liters = #{liters}</if>
             <if test="amt != null "> and amt = #{amt}</if>
             <if test="unionId != null  and unionId != ''"> and union_id = #{unionId}</if>
+            <if test="stationIdList != null ">
+                and station_id in
+                <foreach item="item" index="index" collection="stationIdList"
+                         open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
         </where>
     </select>
     

+ 7 - 0
Yijia-SaaS/yijia-market/src/main/resources/mapper/market/MarkertPlanMapper.xml

@@ -39,6 +39,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="stationId != null "> and station_id = #{stationId}</if>
             <if test="stationName != null  and stationName != ''"> and station_name like concat('%', #{stationName}, '%')</if>
             <if test="status != null  and status != ''"> and status = #{status}</if>
+            <if test="stationIdList != null ">
+                and station_id in
+                <foreach item="item" index="index" collection="stationIdList"
+                         open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
         </where>
     </select>
     

+ 7 - 0
Yijia-SaaS/yijia-system/src/main/java/com/yijia/system/service/ISysUserService.java

@@ -172,4 +172,11 @@ public interface ISysUserService
      * @return
      */
     public boolean getUserRole(LoginUser currentUser);
+
+    /**
+     * 根据角色判断用户对应的油站id
+     * @param currentUser
+     * @return
+     */
+    public String getUserRoleDeptId(LoginUser currentUser);
 }

+ 35 - 1
Yijia-SaaS/yijia-system/src/main/java/com/yijia/system/service/impl/SysUserServiceImpl.java

@@ -3,7 +3,9 @@ package com.yijia.system.service.impl;
 import java.util.ArrayList;
 import java.util.List;
 
+import com.yijia.common.core.domain.entity.SysDept;
 import com.yijia.common.core.domain.model.LoginUser;
+import com.yijia.system.service.ISysDeptService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -54,7 +56,8 @@ public class SysUserServiceImpl implements ISysUserService
 
     @Autowired
     private ISysConfigService configService;
-
+    @Autowired
+    private ISysDeptService sysDeptService;
     /**
      * 根据条件分页查询用户列表
      * 
@@ -468,4 +471,35 @@ public class SysUserServiceImpl implements ISysUserService
         }
         return flag;
     }
+
+    /**
+     * 根据角色判断用户对应的油站id
+     * @param currentUser
+     * @return
+     */
+    @Override
+    public String getUserRoleDeptId(LoginUser currentUser) {
+        //根据当前用户的detpid ,查看dept是组织机构中的哪个站。 jibie 0平台。1为集团, 2为油站
+        SysDept sysDept = sysDeptService.selectDeptById(currentUser.getUser().getDeptId());
+        String deptid="";
+        if(sysDept!=null){
+            if(sysDept.getJiBie()==2){
+                deptid =sysDept.getDeptId().toString();
+            }else if(sysDept.getJiBie()==1){
+                SysDept dept = new SysDept();
+                dept.setParentId(sysDept.getDeptId());
+               List<SysDept> list= sysDeptService.selectDeptList(dept);
+               if(list!=null&& list.size()>0){
+                   for(SysDept sd:list){
+                       if(deptid==""){
+                           deptid = sd.getDeptId().toString();
+                       }else{
+                           deptid =deptid+","+ sd.getDeptId().toString();
+                       }
+                   }
+               }
+            }
+        }
+        return deptid;
+    }
 }

+ 5 - 1
Yijia-SaaS/yijia-system/src/main/resources/mapper/system/SysDeptMapper.xml

@@ -20,10 +20,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		<result property="createTime" column="create_time" />
 		<result property="updateBy"   column="update_by"   />
 		<result property="updateTime" column="update_time" />
+		<result property="jiBie" column="ji_bie" />
 	</resultMap>
 	
 	<sql id="selectDeptVo">
-        select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time 
+        select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time ,d.ji_bie
         from sys_dept d
     </sql>
     
@@ -97,6 +98,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="email != null and email != ''">email,</if>
  			<if test="status != null">status,</if>
  			<if test="createBy != null and createBy != ''">create_by,</if>
+ 			<if test="jiBie != null">ji_bie,</if>
  			create_time
  		)values(
  			<if test="deptId != null and deptId != 0">#{deptId},</if>
@@ -109,6 +111,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="email != null and email != ''">#{email},</if>
  			<if test="status != null">#{status},</if>
  			<if test="createBy != null and createBy != ''">#{createBy},</if>
+ 			<if test="jiBie != null">#{jiBie},</if>
  			sysdate()
  		)
 	</insert>
@@ -125,6 +128,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="email != null">email = #{email},</if>
  			<if test="status != null and status != ''">status = #{status},</if>
  			<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
+			<if test="jiBie != null">ji_bie = #{jiBie},</if>
  			update_time = sysdate()
  		</set>
  		where dept_id = #{deptId}