Explorar el Código

优化部门管理,油站价格,积分规则

MS-QJVSRANLTYEO\Administrator hace 4 años
padre
commit
6a8371f6e5
Se han modificado 19 ficheros con 291 adiciones y 201 borrados
  1. 11 1
      yijia-common/src/main/java/com/yijia/common/core/domain/entity/SysDept.java
  2. 29 6
      yijia-customer/src/main/java/com/yijia/customer/controller/CustomerGradeSettingController.java
  3. 13 1
      yijia-customer/src/main/java/com/yijia/customer/domain/CustomerGradeSetting.java
  4. 45 18
      yijia-customer/src/main/resources/mapper/customer/CustomerGradeSettingMapper.xml
  5. 1 0
      yijia-integral/src/main/java/com/yijia/integral/controller/IntegralRuleController.java
  6. 3 4
      yijia-integral/src/main/java/com/yijia/integral/controller/IntegralWaresController.java
  7. 18 28
      yijia-integral/src/main/java/com/yijia/integral/domain/IntegralRuleDetail.java
  8. 5 47
      yijia-integral/src/main/java/com/yijia/integral/service/impl/IntegralRuleServiceImpl.java
  9. 7 12
      yijia-integral/src/main/resources/mapper/integral/IntegralRuleDetailMapper.xml
  10. 24 2
      yijia-integral/src/main/resources/mapper/integral/IntegralRuleMapper.xml
  11. 15 19
      yijia-integral/src/main/resources/mapper/integral/IntegralWaresMapper.xml
  12. 10 4
      yijia-station/src/main/java/com/yijia/station/controller/StationOilPriceController.java
  13. 13 1
      yijia-station/src/main/java/com/yijia/station/domain/StationOilPrice.java
  14. 13 8
      yijia-station/src/main/java/com/yijia/station/mapper/StationOilPriceMapper.java
  15. 13 8
      yijia-station/src/main/java/com/yijia/station/service/IStationOilPriceService.java
  16. 16 8
      yijia-station/src/main/java/com/yijia/station/service/impl/StationOilPriceServiceImpl.java
  17. 21 0
      yijia-station/src/main/resources/mapper/station/StationOilPriceMapper.xml
  18. 17 20
      yijia-system/src/main/java/com/yijia/system/service/impl/SysDeptServiceImpl.java
  19. 17 14
      yijia-system/src/main/resources/mapper/system/SysDeptMapper.xml

+ 11 - 1
yijia-common/src/main/java/com/yijia/common/core/domain/entity/SysDept.java

@@ -11,7 +11,7 @@ import com.yijia.common.core.domain.BaseEntity;
 
 /**
  * 部门表 sys_dept
- * 
+ *
  * @author yijia
  */
 public class SysDept extends BaseEntity
@@ -83,6 +83,16 @@ public class SysDept extends BaseEntity
 
     private List<String> deptIdList;
 
+    private Long orDeptId;
+
+    public Long getOrDeptId() {
+        return orDeptId;
+    }
+
+    public void setOrDeptId(Long orDeptId) {
+        this.orDeptId = orDeptId;
+    }
+
     public List<String> getDeptIdList() {
         return deptIdList;
     }

+ 29 - 6
yijia-customer/src/main/java/com/yijia/customer/controller/CustomerGradeSettingController.java

@@ -2,6 +2,7 @@ package com.yijia.customer.controller;
 import java.util.List;
 import com.yijia.common.core.domain.entity.SysDept;
 import com.yijia.common.core.domain.model.LoginUser;
+import com.yijia.common.utils.DateUtils;
 import com.yijia.common.utils.SecurityUtils;
 import com.yijia.system.service.ISysDeptService;
 
@@ -54,6 +55,7 @@ public class CustomerGradeSettingController extends BaseController
             customerGradeSetting.setStationIdList(list);
             customerGradeSetting.setStationId(null);
         }
+        customerGradeSetting.setDelFlag("0");
         startPage();
         List<CustomerGradeSetting> settingList = customerGradeSettingService.selectCustomerGradeSettingList(customerGradeSetting);
         return getDataTable(settingList);
@@ -75,6 +77,7 @@ public class CustomerGradeSettingController extends BaseController
             customerGradeSetting.setStationIdList(list);
             customerGradeSetting.setStationId(null);
         }
+        customerGradeSetting.setDelFlag("0");
         List<CustomerGradeSetting> settingList = customerGradeSettingService.selectCustomerGradeSettingList(customerGradeSetting);
         ExcelUtil<CustomerGradeSetting> util = new ExcelUtil<CustomerGradeSetting>(CustomerGradeSetting.class);
         return util.exportExcel(settingList, "setting");
@@ -100,7 +103,9 @@ public class CustomerGradeSettingController extends BaseController
     {
         LoginUser currentUser = SecurityUtils.getLoginUser();
         customerGradeSetting.setStationId(currentUser.getUser().getDeptId());
-        customerGradeSetting.setStationName(currentUser.getUser().getDept().getDeptName());
+        customerGradeSetting.setCreateBy(currentUser.getUser().getUserId().toString());
+        customerGradeSetting.setCreateTime(DateUtils.getNowDate());
+        customerGradeSetting.setDelFlag("0");
         return toAjax(customerGradeSettingService.insertCustomerGradeSetting(customerGradeSetting));
     }
 
@@ -114,7 +119,6 @@ public class CustomerGradeSettingController extends BaseController
     {
         LoginUser currentUser = SecurityUtils.getLoginUser();
         customerGradeSetting.setStationId(currentUser.getUser().getDeptId());
-        customerGradeSetting.setStationName(currentUser.getUser().getDept().getDeptName());
         return toAjax(customerGradeSettingService.updateCustomerGradeSetting(customerGradeSetting));
     }
 
@@ -124,9 +128,19 @@ public class CustomerGradeSettingController extends BaseController
     @PreAuthorize("@ss.hasPermi('customer:setting:remove')")
     @Log(title = "客户优惠等级设置", businessType = BusinessType.DELETE)
 	@DeleteMapping("/{ids}")
-    public AjaxResult remove(@PathVariable Long[] ids)
+    public AjaxResult remove(@PathVariable Long ids)
     {
-        return toAjax(customerGradeSettingService.deleteCustomerGradeSettingByIds(ids));
+        int i=0;
+        if(ids!=null){
+            LoginUser currentUser = SecurityUtils.getLoginUser();
+            CustomerGradeSetting customerGradeSetting =new CustomerGradeSetting();
+            customerGradeSetting.setUpdateBy(currentUser.getUser().getUserId()+"");
+            customerGradeSetting.setUpdateTime(DateUtils.getNowDate());
+            customerGradeSetting.setDelFlag("1");
+            customerGradeSetting.setId(ids);
+            i=customerGradeSettingService.updateCustomerGradeSetting(customerGradeSetting);
+        }
+        return toAjax(i);
     }
 
     /**
@@ -136,7 +150,16 @@ public class CustomerGradeSettingController extends BaseController
     @GetMapping("/gradeList")
     public TableDataInfo gradeList(CustomerGradeSetting customerGradeSetting)
     {
-        List<CustomerGradeSetting> list = customerGradeSettingService.selectCustomerGradeSettingList(customerGradeSetting);
-        return getTable(list);
+        LoginUser currentUser = SecurityUtils.getLoginUser();
+        SysDept dept =new SysDept();
+        dept.setDeptId(currentUser.getUser().getDeptId());
+        List<String> list = deptService.selectDeptId(dept);
+        if(list!=null && list.size()>0){
+            customerGradeSetting.setStationIdList(list);
+            customerGradeSetting.setStationId(null);
+        }
+        customerGradeSetting.setDelFlag("0");
+        List<CustomerGradeSetting> gradeList = customerGradeSettingService.selectCustomerGradeSettingList(customerGradeSetting);
+        return getTable(gradeList);
     }
 }

+ 13 - 1
yijia-customer/src/main/java/com/yijia/customer/domain/CustomerGradeSetting.java

@@ -42,6 +42,17 @@ public class CustomerGradeSetting extends BaseEntity
     /** 油站id */
     @Excel(name = "油站id")
     private Long stationId;
+
+    private String delFlag;
+
+    public String getDelFlag() {
+        return delFlag;
+    }
+
+    public void setDelFlag(String delFlag) {
+        this.delFlag = delFlag;
+    }
+
     /**
      * 根据用户所属组织,平台,集团,油站查询条件
      */
@@ -117,9 +128,10 @@ public class CustomerGradeSetting extends BaseEntity
             .append("id", getId())
             .append("grade", getGrade())
             .append("oilName", getOilName())
-            .append("stationId", getStationId())
+            .append("stationId", getStationId()).append("discountAmt", getDiscountAmt())
             .append("memberConditStart", getMemberConditStart())
             .append("memberConditEnd", getMemberConditEnd())
+            .append("delFlag", getDelFlag())
             .toString();
     }
 }

+ 45 - 18
yijia-customer/src/main/resources/mapper/customer/CustomerGradeSettingMapper.xml

@@ -5,30 +5,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 <mapper namespace="com.yijia.customer.mapper.CustomerGradeSettingMapper">
 
     <resultMap type="CustomerGradeSetting" id="CustomerGradeSettingResult">
-        <result property="id"    column="id"    />
-        <result property="grade"    column="grade"    />
-        <result property="oilName"    column="oil_name"    />
-        <result property="memberConditStart"    column="member_condit_start"    />
-        <result property="memberConditEnd"    column="member_condit_end"    />
-        <result property="discountAmt"    column="discount_amt"    />
-        <result property="stationId"    column="station_id"    />
+        <result property="id"    column="id" />
+        <result property="grade"    column="grade" />
+        <result property="oilName"    column="oil_name" />
+        <result property="memberConditStart"    column="member_condit_start" />
+        <result property="memberConditEnd"    column="member_condit_end" />
+        <result property="discountAmt"    column="discount_amt"/>
+        <result property="stationId"    column="station_id"/>
+        <result property="delFlag"    column="del_flag"/>
+        <result property="createBy"    column="create_by"    />
+        <result property="createTime"    column="create_time"  />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateTime"    column="update_time"    />
     </resultMap>
 
     <sql id="selectCustomerGradeSettingVo">
-        select id, grade, discount_amt, station_id, oil_name, member_condit_start, member_condit_end from customer_grade_setting
+        select s.id, s.grade, s.discount_amt, s.station_id, s.oil_name, s.member_condit_start, s.member_condit_end,s.create_by,
+        s.create_time,s.update_by,s.update_time,s.del_flag,d.dept_name as station_name
+        from customer_grade_setting s join sys_dept d on  d.dept_id =s.station_id
     </sql>
 
     <select id="selectCustomerGradeSettingList" parameterType="CustomerGradeSetting" resultMap="CustomerGradeSettingResult">
-        <include refid="selectCustomerGradeSettingVo"/>
+        select s.id, s.grade, s.discount_amt, s.station_id, s.oil_name, s.member_condit_start, s.member_condit_end,s.create_by,
+        s.create_time,s.update_by,s.update_time,s.del_flag,d.dept_name as station_name
+        from customer_grade_setting s join sys_dept d on  d.dept_id =s.station_id
         <where>
-            <if test="grade != null  and grade != ''"> and grade = #{grade}</if>
-            <if test="discountAmt != null  and discountAmt != ''"> and discount_amt = #{discountAmt}</if>
-            <if test="stationId != null "> and station_id = #{stationId}</if>
-            <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="grade != null  and grade != ''"> and s.grade = #{grade}</if>
+            <if test="discountAmt != null  and discountAmt != ''"> and s.discount_amt = #{discountAmt}</if>
+            <if test="stationId != null "> and s.station_id = #{stationId}</if>
+            <if test="oilName != null  and oilName != ''"> and s.oil_name like concat('%', #{oilName}, '%')</if>
+            <if test="memberConditStart != null "> and s.member_condit_start = #{memberConditStart}</if>
+            <if test="memberConditEnd != null "> and s.member_condit_end = #{memberConditEnd}</if>
+            <if test="delFlag != null "> and s.del_flag = #{delFlag}</if>
             <if test="stationIdList != null ">
-                and station_id in
+                and s.station_id in
                 <foreach item="item" index="index" collection="stationIdList"
                          open="(" separator="," close=")">
                     #{item}
@@ -39,7 +49,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
 
     <select id="selectCustomerGradeSettingById" parameterType="Long" resultMap="CustomerGradeSettingResult">
-        <include refid="selectCustomerGradeSettingVo"/>
+       select s.id, s.grade, s.discount_amt, s.station_id, s.oil_name, s.member_condit_start, s.member_condit_end,s.create_by,
+        s.create_time,s.update_by,s.update_time,s.delFlag,d.dept_name as station_name
+        from customer_grade_setting s join sys_dept d on  d.dept_id =s.station_id
         where id = #{id}
     </select>
 
@@ -52,14 +64,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="oilName != null">oil_name,</if>
             <if test="memberConditStart != null">member_condit_start,</if>
             <if test="memberConditEnd != null">member_condit_end,</if>
+            <if test="delFlag != null">delFlag,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateBy != null">update_by,</if>
+            <if test="updateTime != null">update_time,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="grade != null">#{grade},</if>
-            <if test="discountAmt != null">discount_amt,</if>
+            <if test="discountAmt != null">#{discountAmt},</if>
             <if test="stationId != null">#{stationId},</if>
             <if test="oilName != null">#{oilName},</if>
             <if test="memberConditStart != null">#{memberConditStart},</if>
             <if test="memberConditEnd != null">#{memberConditEnd},</if>
+            <if test="delFlag != null">#{delFlag},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+            <if test="updateTime != null">#{updateTime},</if>
          </trim>
     </insert>
 
@@ -72,6 +94,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="memberConditEnd != null">member_condit_end = #{memberConditEnd},</if>
             <if test="discountAmt != null">discount_amt = #{discountAmt},</if>
             <if test="stationId != null">station_id = #{stationId},</if>
+            <if test="delFlag != null">del_flag=#{delFlag},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
         </trim>
         where id = #{id}
     </update>

+ 1 - 0
yijia-integral/src/main/java/com/yijia/integral/controller/IntegralRuleController.java

@@ -91,6 +91,7 @@ public class IntegralRuleController extends BaseController
             integralRule.setStationId(null);
         }
         IntegralRule rule = integralRuleService.selectIntegralRule(integralRule);
+
         return AjaxResult.success(rule);
     }
     /**

+ 3 - 4
yijia-integral/src/main/java/com/yijia/integral/controller/IntegralWaresController.java

@@ -4,6 +4,7 @@ import java.util.List;
 
 import com.yijia.common.core.domain.entity.SysDept;
 import com.yijia.common.core.domain.model.LoginUser;
+import com.yijia.common.utils.DateUtils;
 import com.yijia.common.utils.SecurityUtils;
 import com.yijia.system.service.ISysDeptService;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -95,10 +96,9 @@ public class IntegralWaresController extends BaseController
     public AjaxResult add(@RequestBody IntegralWares integralWares)
     {
         LoginUser currentUser = SecurityUtils.getLoginUser();
-        integralWares.setCreateName(currentUser.getUsername());
         integralWares.setCreateBy(currentUser.getUser().getUserId().toString());
+        integralWares.setCreateTime(DateUtils.getNowDate());
         integralWares.setStationId(currentUser.getUser().getDeptId());
-        integralWares.setStationName(currentUser.getUser().getDept().getDeptName());
         integralWares.setWaresStatus("1");
         return toAjax(integralWaresService.insertIntegralWares(integralWares));
     }
@@ -111,10 +111,9 @@ public class IntegralWaresController extends BaseController
     public AjaxResult edit(@RequestBody IntegralWares integralWares)
     {
         LoginUser currentUser = SecurityUtils.getLoginUser();
-        integralWares.setUpdateName(currentUser.getUsername());
         integralWares.setStationId(currentUser.getUser().getDeptId());
-        integralWares.setStationName(currentUser.getUser().getDept().getDeptName());
         integralWares.setUpdateBy(currentUser.getUser().getUserId().toString());
+        integralWares.setUpdateTime(DateUtils.getNowDate());
         return toAjax(integralWaresService.updateIntegralWares(integralWares));
     }
 

+ 18 - 28
yijia-integral/src/main/java/com/yijia/integral/domain/IntegralRuleDetail.java

@@ -8,7 +8,7 @@ import com.yijia.common.core.domain.BaseEntity;
 
 /**
  * 【请填写功能名称】对象 integral_rule_detail
- * 
+ *
  * @author yijia
  * @date 2021-03-09
  */
@@ -50,95 +50,85 @@ public class IntegralRuleDetail extends BaseEntity
     /** 规则类型 */
     @Excel(name = "规则类型")
     private String ruleType;
-    /** 油品类型 1.油品。2.非油品*/
-    private String oilType;
-
-    public String getOilType() {
-        return oilType;
-    }
-
-    public void setOilType(String oilType) {
-        this.oilType = oilType;
-    }
 
     public void setId(Long id)
     {
         this.id = id;
     }
 
-    public Long getId() 
+    public Long getId()
     {
         return id;
     }
-    public void setParentId(Long parentId) 
+    public void setParentId(Long parentId)
     {
         this.parentId = parentId;
     }
 
-    public Long getParentId() 
+    public Long getParentId()
     {
         return parentId;
     }
-    public void setRuleTerms(BigDecimal ruleTerms) 
+    public void setRuleTerms(BigDecimal ruleTerms)
     {
         this.ruleTerms = ruleTerms;
     }
 
-    public BigDecimal getRuleTerms() 
+    public BigDecimal getRuleTerms()
     {
         return ruleTerms;
     }
-    public void setGreadId(Long greadId) 
+    public void setGreadId(Long greadId)
     {
         this.greadId = greadId;
     }
 
-    public Long getGreadId() 
+    public Long getGreadId()
     {
         return greadId;
     }
-    public void setGread(String gread) 
+    public void setGread(String gread)
     {
         this.gread = gread;
     }
 
-    public String getGread() 
+    public String getGread()
     {
         return gread;
     }
-    public void setOilName(String oilName) 
+    public void setOilName(String oilName)
     {
         this.oilName = oilName;
     }
 
-    public String getOilName() 
+    public String getOilName()
     {
         return oilName;
     }
-    public void setSaleAmt(BigDecimal saleAmt) 
+    public void setSaleAmt(BigDecimal saleAmt)
     {
         this.saleAmt = saleAmt;
     }
 
-    public BigDecimal getSaleAmt() 
+    public BigDecimal getSaleAmt()
     {
         return saleAmt;
     }
-    public void setIntegral(BigDecimal integral) 
+    public void setIntegral(BigDecimal integral)
     {
         this.integral = integral;
     }
 
-    public BigDecimal getIntegral() 
+    public BigDecimal getIntegral()
     {
         return integral;
     }
-    public void setRuleType(String ruleType) 
+    public void setRuleType(String ruleType)
     {
         this.ruleType = ruleType;
     }
 
-    public String getRuleType() 
+    public String getRuleType()
     {
         return ruleType;
     }

+ 5 - 47
yijia-integral/src/main/java/com/yijia/integral/service/impl/IntegralRuleServiceImpl.java

@@ -44,20 +44,8 @@ public class IntegralRuleServiceImpl implements IIntegralRuleService
         IntegralRule integralRule =integralRuleMapper.selectIntegralRuleById(id);
         IntegralRuleDetail  detail  = new  IntegralRuleDetail();
         detail.setParentId(id);
-        detail.setOilType("1");
         List<IntegralRuleDetail> list =  integralRuleDetailMapper.selectIntegralRuleDetailList(detail);
         integralRule.setItemsDetail(list);
-        //查询非油品数据
-        IntegralRuleDetail  itemdetail  = new  IntegralRuleDetail();
-        itemdetail.setParentId(id);
-        itemdetail.setOilType("2");
-        List<IntegralRuleDetail>  notOillist =  integralRuleDetailMapper.selectIntegralRuleDetailList(itemdetail);
-        if(notOillist!=null && notOillist.size()>0){
-            integralRule.setNotOilList(notOillist);
-        }else{
-            notOillist =new ArrayList<>();
-            integralRule.setNotOilList(notOillist);
-        }
         //查询图片信息
         IntegralShopPic shopPic =new IntegralShopPic();
         shopPic.setParentId(id);
@@ -109,24 +97,10 @@ public class IntegralRuleServiceImpl implements IIntegralRuleService
             for (IntegralRuleDetail detail : list){
                 if(detail.getSaleAmt()!=null  && detail.getIntegral()!=null && detail.getSaleAmt().compareTo(new BigDecimal("0"))==1){
                     detail.setParentId(integralRule.getId().longValue());
-                    detail.setOilType("1");
-                    if(detail.getGread()!="" && detail.getGread()!=null && detail.getGread().equals("所有人")){
-                        detail.setGread("");
-                    }
                     integralRuleDetailMapper.insertIntegralRuleDetail(detail);
                 }
             }
         }
-        if(integralRule.getNotOilList()!=null &&  integralRule.getNotOilList().size()>0){
-            List<IntegralRuleDetail> notOilList =integralRule.getNotOilList();
-            for (IntegralRuleDetail itemdetail : notOilList){
-                if(itemdetail.getSaleAmt()!=null && itemdetail.getIntegral()!=null&&itemdetail.getSaleAmt().compareTo(new BigDecimal("0"))==1){
-                    itemdetail.setParentId(integralRule.getId().longValue());
-                    itemdetail.setOilType("2");
-                    integralRuleDetailMapper.insertIntegralRuleDetail(itemdetail);
-                }
-            }
-        }
         if(integralRule.getImgFileList()!=null &&  integralRule.getImgFileList().size()>0){
             List<IntegralShopPic> imgFileList =integralRule.getImgFileList();
             for (IntegralShopPic img : imgFileList){
@@ -158,24 +132,10 @@ public class IntegralRuleServiceImpl implements IIntegralRuleService
             for (IntegralRuleDetail detail : list){
                 if(detail.getSaleAmt()!=null  && detail.getIntegral()!=null && detail.getSaleAmt().compareTo(new BigDecimal("0"))==1){
                     detail.setParentId(integralRule.getId().longValue());
-                    detail.setOilType("1");
-                    if(detail.getGread()!="" && detail.getGread()!=null && detail.getGread().equals("所有人")){
-                        detail.setGread("");
-                    }
                     integralRuleDetailMapper.insertIntegralRuleDetail(detail);
                 }
             }
         }
-        if(integralRule.getNotOilList()!=null &&  integralRule.getNotOilList().size()>0){
-            List<IntegralRuleDetail> notOilList =integralRule.getNotOilList();
-            for (IntegralRuleDetail itemdetail : notOilList){
-               if(itemdetail.getSaleAmt()!=null && itemdetail.getIntegral()!=null&&itemdetail.getSaleAmt().compareTo(new BigDecimal("0"))==1){
-                   itemdetail.setParentId(integralRule.getId().longValue());
-                   itemdetail.setOilType("2");
-                   integralRuleDetailMapper.insertIntegralRuleDetail(itemdetail);
-               }
-            }
-        }
         IntegralShopPic integralShopPic =new IntegralShopPic();
         integralShopPic.setParentId(integralRule.getId().longValue());
         integralShopPicMapper.deleteIntegralShopPic(integralShopPic);
@@ -234,20 +194,18 @@ public class IntegralRuleServiceImpl implements IIntegralRuleService
         if(rule!=null){
             IntegralRuleDetail  detail  = new  IntegralRuleDetail();
             detail.setParentId(rule.getId());
-            detail.setOilType("1");
             List<IntegralRuleDetail> list =  integralRuleDetailMapper.selectIntegralRuleDetailList(detail);
             rule.setItemsDetail(list);
-            //查询非油品数据
-            IntegralRuleDetail  itemdetail  = new  IntegralRuleDetail();
-            itemdetail.setParentId(rule.getId());
-            itemdetail.setOilType("2");
-            List<IntegralRuleDetail> notOillist =  integralRuleDetailMapper.selectIntegralRuleDetailList(itemdetail);
-            rule.setNotOilList(notOillist);
             //查询图片信息
             IntegralShopPic shopPic =new IntegralShopPic();
             shopPic.setParentId(rule.getId());
             List<IntegralShopPic> shopPicList = integralShopPicMapper.selectIntegralShopPicList(shopPic);
             rule.setImgFileList(shopPicList);
+        }else{
+            List<IntegralRuleDetail> list =new ArrayList<>();
+            rule.setItemsDetail(list);
+            List<IntegralShopPic> shopPicList =new ArrayList<>();
+            rule.setImgFileList(shopPicList);
         }
         return rule;
     }

+ 7 - 12
yijia-integral/src/main/resources/mapper/integral/IntegralRuleDetailMapper.xml

@@ -3,7 +3,7 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.yijia.integral.mapper.IntegralRuleDetailMapper">
-    
+
     <resultMap type="IntegralRuleDetail" id="IntegralRuleDetailResult">
         <result property="id"    column="id"    />
         <result property="parentId"    column="parent_id"    />
@@ -18,12 +18,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectIntegralRuleDetailVo">
-        select id, parent_id, rule_terms, gread_id, gread, oil_name, sale_amt, integral, rule_type,oil_type from integral_rule_detail
+        select id, parent_id, rule_terms, gread_id, gread, oil_name, sale_amt, integral, rule_type from integral_rule_detail
     </sql>
 
     <select id="selectIntegralRuleDetailList" parameterType="IntegralRuleDetail" resultMap="IntegralRuleDetailResult">
         <include refid="selectIntegralRuleDetailVo"/>
-        <where>  
+        <where>
             <if test="parentId != null "> and parent_id = #{parentId}</if>
             <if test="ruleTerms != null "> and rule_terms = #{ruleTerms}</if>
             <if test="greadId != null "> and gread_id = #{greadId}</if>
@@ -32,15 +32,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="saleAmt != null "> and sale_amt = #{saleAmt}</if>
             <if test="integral != null "> and integral = #{integral}</if>
             <if test="ruleType != null  and ruleType != ''"> and rule_type = #{ruleType}</if>
-            <if test="oilType != null  and oilType != ''"> and oil_type = #{oilType}</if>
         </where>
     </select>
-    
+
     <select id="selectIntegralRuleDetailById" parameterType="Long" resultMap="IntegralRuleDetailResult">
         <include refid="selectIntegralRuleDetailVo"/>
         where id = #{id}
     </select>
-        
+
     <insert id="insertIntegralRuleDetail" parameterType="IntegralRuleDetail" useGeneratedKeys="true" keyProperty="id">
         insert into integral_rule_detail
         <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -52,7 +51,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="saleAmt != null">sale_amt,</if>
             <if test="integral != null">integral,</if>
             <if test="ruleType != null">rule_type,</if>
-            <if test="oilType != null">oil_type,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="parentId != null">#{parentId},</if>
@@ -63,7 +61,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="saleAmt != null">#{saleAmt},</if>
             <if test="integral != null">#{integral},</if>
             <if test="ruleType != null">#{ruleType},</if>
-            <if test="oilType != null">#{oilType},</if>
          </trim>
     </insert>
 
@@ -78,7 +75,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="saleAmt != null">sale_amt = #{saleAmt},</if>
             <if test="integral != null">integral = #{integral},</if>
             <if test="ruleType != null">rule_type = #{ruleType},</if>
-            <if test="oilType != null">oil_type = #{oilType},</if>
         </trim>
         where id = #{id}
     </update>
@@ -88,7 +84,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deleteIntegralRuleDetailByIds" parameterType="String">
-        delete from integral_rule_detail where id in 
+        delete from integral_rule_detail where id in
         <foreach item="id" collection="array" open="(" separator="," close=")">
             #{id}
         </foreach>
@@ -104,7 +100,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="saleAmt != null "> and sale_amt = #{saleAmt}</if>
             <if test="integral != null "> and integral = #{integral}</if>
             <if test="ruleType != null  and ruleType != ''"> and rule_type = #{ruleType}</if>
-            <if test="oilType != null  and oilType != ''"> and oil_type = #{oilType}</if>
         </where>
     </delete>
-</mapper>
+</mapper>

+ 24 - 2
yijia-integral/src/main/resources/mapper/integral/IntegralRuleMapper.xml

@@ -23,10 +23,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="integral"    column="integral"    />
         <result property="oilType"    column="oil_type"    />
         <result property="integralFlag"    column="integral_flag"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateTime"    column="update_time"    />
     </resultMap>
 
     <sql id="selectIntegralRuleVo">
-        select id, station_id, station_name, rule_type, term_date_manage, empty_date, integral_activity, date_picker, integral_proportion,date_picker_time,integral_term_setting from integral_rule
+       select id, station_id,d.dept_name as station_name, rule_type, term_date_manage, empty_date, integral_activity,
+        date_picker, integral_proportion,date_picker_time,integral_term_setting,r.create_by,r.create_time,
+        r.update_by,r.update_time
+        from integral_rule r join sys_dept d on r.station_id =d.dept_id
     </sql>
 
     <select id="selectIntegralRuleList" parameterType="IntegralRule" resultMap="IntegralRuleResult">
@@ -71,6 +78,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="integralProportion != null">integral_proportion,</if>
             <if test="datePickerTime != null">date_picker_time,</if>
             <if test="integralTermSetting != null">integral_term_setting,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateBy != null">update_by,</if>
+            <if test="updateTime != null">update_time,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="stationId != null">#{stationId},</if>
@@ -87,6 +98,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="datePickerTime != null">#{datePickerTime},</if>
             <if test="integralEmptyTime != null">#{integralEmptyTime},</if>
             <if test="integralTermSetting != null">#{integralTermSetting},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+            <if test="updateTime != null">#{updateTime},</if>
          </trim>
     </insert>
 
@@ -103,6 +118,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="integralProportion != null">integral_proportion = #{integralProportion},</if>
             <if test="datePickerTime != null ">  date_picker_time = #{datePickerTime},</if>
             <if test="integralTermSetting != null  ">  integral_term_setting = #{integralTermSetting},</if>
+            <if test="createBy != null  ">  create_by = #{createBy},</if>
+            <if test="createTime != null  ">  create_time = #{createTime},</if>
+            <if test="updateBy != null  ">  update_by = #{updateBy},</if>
+            <if test="updateTime != null  ">  update_time = #{updateTime},</if>
         </trim>
         where id = #{id}
     </update>
@@ -142,10 +161,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
 
     <select id="listRuleInfo" parameterType="IntegralRule" resultMap="IntegralRuleResult">
-        SELECT a.station_id,a.station_name,a.term_date_manage,a.integral_activity,empty_date,date_picker,integral_proportion,b.rule_type,rule_terms,gread,oil_name,sale_amt,integral,oil_type,c.integral_flag
+        SELECT a.station_id,d.dept_name as station_name,a.term_date_manage,a.integral_activity,empty_date,date_picker,integral_proportion,
+        b.rule_type,rule_terms,gread,
+        oil_name,sale_amt,integral,oil_type,c.integral_flag
         from integral_rule a
         join integral_rule_detail b on a.id =b.parent_id
         join station_pay c on a.station_id =c.station_id
+        join sys_dept d on a.station_id =d.dept_id
         <where>
             <if test="stationId != null "> and a.station_id = #{stationId}</if>
             <if test="stationName != null  and stationName != ''"> and a.station_name like concat('%', #{stationName}, '%')</if>

+ 15 - 19
yijia-integral/src/main/resources/mapper/integral/IntegralWaresMapper.xml

@@ -3,7 +3,7 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.yijia.integral.mapper.IntegralWaresMapper">
-    
+
     <resultMap type="IntegralWares" id="IntegralWaresResult">
         <result property="id"    column="id"    />
         <result property="waresType"    column="wares_type"    />
@@ -16,7 +16,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="waresStatus"    column="wares_status"    />
         <result property="createTime"    column="create_time"    />
         <result property="createBy"    column="create_by"    />
-        <result property="createName"    column="create_name"    />
         <result property="updateTime"    column="update_time"    />
         <result property="updateBy"    column="update_by"    />
         <result property="updateName"    column="update_name"    />
@@ -25,24 +24,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectIntegralWaresVo">
-        select id, wares_type, wares_name, sale_integral, wares_pic, wares_detail, wares_count, wares_out_count, wares_status, create_time, create_by, create_name, update_time, update_by, update_name, station_id, station_name from integral_wares
+        select w.id, wares_type, wares_name, w.sale_integral, wares_pic, wares_detail,
+        wares_count, wares_out_count, wares_status, w.create_time, w.create_by,
+        w.update_time, w.update_by, w.station_id,d.dept_name as station_name
+        from integral_wares w join sys_dept d on w.station_id = d.dept_id
     </sql>
 
     <select id="selectIntegralWaresList" parameterType="IntegralWares" resultMap="IntegralWaresResult">
         <include refid="selectIntegralWaresVo"/>
-        <where>  
+        <where>
             <if test="waresType != null  and waresType != ''"> and wares_type = #{waresType}</if>
             <if test="waresName != null  and waresName != ''"> and wares_name like concat('%', #{waresName}, '%')</if>
-            <if test="saleIntegral != null "> and sale_integral = #{saleIntegral}</if>
-            <if test="waresPic != null  and waresPic != ''"> and wares_pic = #{waresPic}</if>
+            <if test="saleIntegral != null "> and w.sale_integral = #{saleIntegral}</if>
+            <if test="waresPic != null  and waresPic != ''"> and w.wares_pic = #{waresPic}</if>
             <if test="waresDetail != null  and waresDetail != ''"> and wares_detail = #{waresDetail}</if>
             <if test="waresCount != null "> and wares_count = #{waresCount}</if>
             <if test="waresOutCount != null "> and wares_out_count = #{waresOutCount}</if>
-            <if test="waresStatus != null  and waresStatus != ''"> and wares_status = #{waresStatus}</if>
-            <if test="createName != null  and createName != ''"> and create_name like concat('%', #{createName}, '%')</if>
-            <if test="updateName != null  and updateName != ''"> and update_name like concat('%', #{updateName}, '%')</if>
-            <if test="stationId != null "> and station_id = #{stationId}</if>
-            <if test="stationName != null  and stationName != ''"> and station_name like concat('%', #{stationName}, '%')</if>
+            <if test="waresStatus != null  and waresStatus != ''"> and w.wares_status = #{waresStatus}</if>
+            <if test="stationId != null "> and w.station_id = #{stationId}</if>
             <if test="stationIdList != null ">
                 and station_id in
                 <foreach item="item" index="index" collection="stationIdList"
@@ -53,12 +52,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
         order by  id desc
     </select>
-    
+
     <select id="selectIntegralWaresById" parameterType="Long" resultMap="IntegralWaresResult">
         <include refid="selectIntegralWaresVo"/>
         where id = #{id}
     </select>
-        
+
     <insert id="insertIntegralWares" parameterType="IntegralWares" useGeneratedKeys="true" keyProperty="id">
         insert into integral_wares
         <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -112,12 +111,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="waresStatus != null">wares_status = #{waresStatus},</if>
             <if test="createTime != null">create_time = #{createTime},</if>
             <if test="createBy != null">create_by = #{createBy},</if>
-            <if test="createName != null">create_name = #{createName},</if>
             <if test="updateTime != null">update_time = #{updateTime},</if>
             <if test="updateBy != null">update_by = #{updateBy},</if>
-            <if test="updateName != null">update_name = #{updateName},</if>
             <if test="stationId != null">station_id = #{stationId},</if>
-            <if test="stationName != null">station_name = #{stationName},</if>
         </trim>
         where id = #{id}
     </update>
@@ -127,10 +123,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deleteIntegralWaresByIds" parameterType="String">
-        delete from integral_wares where id in 
+        delete from integral_wares where id in
         <foreach item="id" collection="array" open="(" separator="," close=")">
             #{id}
         </foreach>
     </delete>
-    
-</mapper>
+
+</mapper>

+ 10 - 4
yijia-station/src/main/java/com/yijia/station/controller/StationOilPriceController.java

@@ -44,8 +44,6 @@ public class StationOilPriceController extends BaseController
     @Autowired
     private IStationOilPriceService stationOilPriceService;
     @Autowired
-    private ISysUserService sysUserService;
-    @Autowired
     private ISysDeptService sysDeptService;
     /**
      * 查询油品价格列表
@@ -141,8 +139,16 @@ public class StationOilPriceController extends BaseController
     @GetMapping("/oilNameList")
     public TableDataInfo oilNameList(StationOilPrice stationOilPrice)
     {
-        List<StationOilPrice> list = stationOilPriceService.selectStationOilPriceList(stationOilPrice);
-        return getTable(list);
+        LoginUser currentUser = SecurityUtils.getLoginUser();
+        SysDept dept =new SysDept();
+        dept.setDeptId(currentUser.getUser().getDeptId());
+        List<String> list = sysDeptService.selectDeptId(dept);
+        if(list!=null && list.size()>0){
+            stationOilPrice.setStationIdList(list);
+            stationOilPrice.setStationId(null);
+        }
+        List<StationOilPrice> priceList = stationOilPriceService.selectOilPriceList(stationOilPrice);
+        return getTable(priceList);
     }
     /**
      * 查询当前油站对应的油品名称(不包括非油品)

+ 13 - 1
yijia-station/src/main/java/com/yijia/station/domain/StationOilPrice.java

@@ -38,17 +38,29 @@ public class StationOilPrice extends BaseEntity
     /** 油站名称 */
     private String stationName;
 
+
     /** 操作时间 */
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date date;
 
-
+    /**
+     * 油品类型
+     */
+    private String oilType;
     /**
      * 根据用户所属组织,平台,集团,油站查询条件
      */
     private List<String> stationIdList;
 
+    public String getOilType() {
+        return oilType;
+    }
+
+    public void setOilType(String oilType) {
+        this.oilType = oilType;
+    }
+
     public List<String> getStationIdList() {
         return stationIdList;
     }

+ 13 - 8
yijia-station/src/main/java/com/yijia/station/mapper/StationOilPriceMapper.java

@@ -5,15 +5,15 @@ import com.yijia.station.domain.StationOilPrice;
 
 /**
  * 油品价格Mapper接口
- * 
+ *
  * @author yijia
  * @date 2020-12-08
  */
-public interface StationOilPriceMapper 
+public interface StationOilPriceMapper
 {
     /**
      * 查询油品价格
-     * 
+     *
      * @param oilPriceId 油品价格ID
      * @return 油品价格
      */
@@ -21,7 +21,7 @@ public interface StationOilPriceMapper
 
     /**
      * 查询油品价格列表
-     * 
+     *
      * @param stationOilPrice 油品价格
      * @return 油品价格集合
      */
@@ -29,7 +29,7 @@ public interface StationOilPriceMapper
 
     /**
      * 新增油品价格
-     * 
+     *
      * @param stationOilPrice 油品价格
      * @return 结果
      */
@@ -37,7 +37,7 @@ public interface StationOilPriceMapper
 
     /**
      * 修改油品价格
-     * 
+     *
      * @param stationOilPrice 油品价格
      * @return 结果
      */
@@ -45,7 +45,7 @@ public interface StationOilPriceMapper
 
     /**
      * 删除油品价格
-     * 
+     *
      * @param oilPriceId 油品价格ID
      * @return 结果
      */
@@ -53,7 +53,7 @@ public interface StationOilPriceMapper
 
     /**
      * 批量删除油品价格
-     * 
+     *
      * @param oilPriceIds 需要删除的数据ID
      * @return 结果
      */
@@ -63,4 +63,9 @@ public interface StationOilPriceMapper
      */
 
     public List<StationOilPrice> oilNameInfo(StationOilPrice stationOilPrice);
+
+    /**
+     * 查询站中的油品价格和油品类型
+     */
+    public List<StationOilPrice> selectOilPriceList(StationOilPrice stationOilPrice);
 }

+ 13 - 8
yijia-station/src/main/java/com/yijia/station/service/IStationOilPriceService.java

@@ -5,15 +5,15 @@ import com.yijia.station.domain.StationOilPrice;
 
 /**
  * 油品价格Service接口
- * 
+ *
  * @author yijia
  * @date 2020-12-08
  */
-public interface IStationOilPriceService 
+public interface IStationOilPriceService
 {
     /**
      * 查询油品价格
-     * 
+     *
      * @param oilPriceId 油品价格ID
      * @return 油品价格
      */
@@ -21,7 +21,7 @@ public interface IStationOilPriceService
 
     /**
      * 查询油品价格列表
-     * 
+     *
      * @param stationOilPrice 油品价格
      * @return 油品价格集合
      */
@@ -29,7 +29,7 @@ public interface IStationOilPriceService
 
     /**
      * 新增油品价格
-     * 
+     *
      * @param stationOilPrice 油品价格
      * @return 结果
      */
@@ -37,7 +37,7 @@ public interface IStationOilPriceService
 
     /**
      * 修改油品价格
-     * 
+     *
      * @param stationOilPrice 油品价格
      * @return 结果
      */
@@ -45,7 +45,7 @@ public interface IStationOilPriceService
 
     /**
      * 批量删除油品价格
-     * 
+     *
      * @param oilPriceIds 需要删除的油品价格ID
      * @return 结果
      */
@@ -53,11 +53,16 @@ public interface IStationOilPriceService
 
     /**
      * 删除油品价格信息
-     * 
+     *
      * @param oilPriceId 油品价格ID
      * @return 结果
      */
     public int deleteStationOilPriceById(Long oilPriceId);
 
     public List<StationOilPrice> oilNameInfo(StationOilPrice stationOilPrice);
+
+    /**
+     * 查询站中的油品价格和油品类型
+     */
+    List<StationOilPrice> selectOilPriceList(StationOilPrice stationOilPrice);
 }

+ 16 - 8
yijia-station/src/main/java/com/yijia/station/service/impl/StationOilPriceServiceImpl.java

@@ -9,19 +9,19 @@ import com.yijia.station.service.IStationOilPriceService;
 
 /**
  * 油品价格Service业务层处理
- * 
+ *
  * @author yijia
  * @date 2020-12-08
  */
 @Service
-public class StationOilPriceServiceImpl implements IStationOilPriceService 
+public class StationOilPriceServiceImpl implements IStationOilPriceService
 {
     @Autowired
     private StationOilPriceMapper stationOilPriceMapper;
 
     /**
      * 查询油品价格
-     * 
+     *
      * @param oilPriceId 油品价格ID
      * @return 油品价格
      */
@@ -33,7 +33,7 @@ public class StationOilPriceServiceImpl implements IStationOilPriceService
 
     /**
      * 查询油品价格列表
-     * 
+     *
      * @param stationOilPrice 油品价格
      * @return 油品价格
      */
@@ -45,7 +45,7 @@ public class StationOilPriceServiceImpl implements IStationOilPriceService
 
     /**
      * 新增油品价格
-     * 
+     *
      * @param stationOilPrice 油品价格
      * @return 结果
      */
@@ -57,7 +57,7 @@ public class StationOilPriceServiceImpl implements IStationOilPriceService
 
     /**
      * 修改油品价格
-     * 
+     *
      * @param stationOilPrice 油品价格
      * @return 结果
      */
@@ -69,7 +69,7 @@ public class StationOilPriceServiceImpl implements IStationOilPriceService
 
     /**
      * 批量删除油品价格
-     * 
+     *
      * @param oilPriceIds 需要删除的油品价格ID
      * @return 结果
      */
@@ -81,7 +81,7 @@ public class StationOilPriceServiceImpl implements IStationOilPriceService
 
     /**
      * 删除油品价格信息
-     * 
+     *
      * @param oilPriceId 油品价格ID
      * @return 结果
      */
@@ -98,4 +98,12 @@ public class StationOilPriceServiceImpl implements IStationOilPriceService
     public List<StationOilPrice> oilNameInfo(StationOilPrice stationOilPrice) {
         return stationOilPriceMapper.oilNameInfo(stationOilPrice);
     }
+
+    /**
+     * 查询站中的油品价格和油品类型
+     */
+    @Override
+    public List<StationOilPrice> selectOilPriceList(StationOilPrice stationOilPrice) {
+        return stationOilPriceMapper.selectOilPriceList(stationOilPrice) ;
+    }
 }

+ 21 - 0
yijia-station/src/main/resources/mapper/station/StationOilPriceMapper.xml

@@ -10,6 +10,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="oilPrice"    column="oil_price"    />
         <result property="stationId"    column="station_id"    />
         <result property="stationName"    column="station_name"    />
+        <result property="oilType"    column="oil_type"    />
         <result property="date"    column="date"    />
     </resultMap>
     <select id="selectStationOilPriceList" parameterType="StationOilPrice" resultMap="StationOilPriceResult">
@@ -48,6 +49,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
     </select>
 
+
+    <select id="selectOilPriceList" parameterType="StationOilPrice" resultMap="StationOilPriceResult">
+        select oil_price_id, oil_name, oil_price, station_id, d.dept_name as station_name, s.dict_value as oil_type
+            from station_oil_price p
+            join sys_dept d  on  p.station_id = d.dept_id
+            join sys_dict_data s  on s.dict_label = p.oil_name and s.dict_type = "oil_name"
+        <where>
+            <if test="oilName != null  and oilName != ''"> and p.oil_name like concat('%', #{oilName}, '%')</if>
+            <if test="oilPrice != null  and oilPrice != ''"> and p.oil_price = #{oilPrice}</if>
+            <if test="stationId != null "> and p.station_id = #{stationId}</if>
+            <if test="stationIdList != null ">
+                and p.station_id in
+                <foreach item="item" index="index" collection="stationIdList"
+                         open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+        </where>
+    </select>
+
     <select id="selectStationOilPriceById" parameterType="Long" resultMap="StationOilPriceResult">
         select oil_price_id, oil_name, oil_price, station_id, d.dept_name as station_name, date
         from station_oil_price p join sys_dept d

+ 17 - 20
yijia-system/src/main/java/com/yijia/system/service/impl/SysDeptServiceImpl.java

@@ -19,7 +19,7 @@ import com.yijia.system.service.ISysDeptService;
 
 /**
  * 部门管理 服务实现
- * 
+ *
  * @author yijia
  */
 @Service
@@ -33,7 +33,7 @@ public class SysDeptServiceImpl implements ISysDeptService
 
     /**
      * 查询部门管理数据
-     * 
+     *
      * @param dept 部门信息
      * @return 部门信息集合
      */
@@ -46,7 +46,7 @@ public class SysDeptServiceImpl implements ISysDeptService
 
     /**
      * 构建前端所需要树结构
-     * 
+     *
      * @param depts 部门列表
      * @return 树结构列表
      */
@@ -78,7 +78,7 @@ public class SysDeptServiceImpl implements ISysDeptService
 
     /**
      * 构建前端所需要下拉树结构
-     * 
+     *
      * @param depts 部门列表
      * @return 下拉树结构列表
      */
@@ -91,7 +91,7 @@ public class SysDeptServiceImpl implements ISysDeptService
 
     /**
      * 根据角色ID查询部门树信息
-     * 
+     *
      * @param roleId 角色ID
      * @return 选中部门列表
      */
@@ -104,7 +104,7 @@ public class SysDeptServiceImpl implements ISysDeptService
 
     /**
      * 根据部门ID查询信息
-     * 
+     *
      * @param deptId 部门ID
      * @return 部门信息
      */
@@ -116,7 +116,7 @@ public class SysDeptServiceImpl implements ISysDeptService
 
     /**
      * 根据ID查询所有子部门(正常状态)
-     * 
+     *
      * @param deptId 部门ID
      * @return 子部门数
      */
@@ -128,7 +128,7 @@ public class SysDeptServiceImpl implements ISysDeptService
 
     /**
      * 是否存在子节点
-     * 
+     *
      * @param deptId 部门ID
      * @return 结果
      */
@@ -141,7 +141,7 @@ public class SysDeptServiceImpl implements ISysDeptService
 
     /**
      * 查询部门是否存在用户
-     * 
+     *
      * @param deptId 部门ID
      * @return 结果 true 存在 false 不存在
      */
@@ -154,7 +154,7 @@ public class SysDeptServiceImpl implements ISysDeptService
 
     /**
      * 校验部门名称是否唯一
-     * 
+     *
      * @param dept 部门信息
      * @return 结果
      */
@@ -172,7 +172,7 @@ public class SysDeptServiceImpl implements ISysDeptService
 
     /**
      * 新增保存部门信息
-     * 
+     *
      * @param dept 部门信息
      * @return 结果
      */
@@ -191,7 +191,7 @@ public class SysDeptServiceImpl implements ISysDeptService
 
     /**
      * 修改保存部门信息
-     * 
+     *
      * @param dept 部门信息
      * @return 结果
      */
@@ -218,7 +218,7 @@ public class SysDeptServiceImpl implements ISysDeptService
 
     /**
      * 修改该部门的父级部门状态
-     * 
+     *
      * @param dept 当前部门
      */
     private void updateParentDeptStatus(SysDept dept)
@@ -231,7 +231,7 @@ public class SysDeptServiceImpl implements ISysDeptService
 
     /**
      * 修改子元素关系
-     * 
+     *
      * @param deptId 被修改的部门ID
      * @param newAncestors 新的父ID集合
      * @param oldAncestors 旧的父ID集合
@@ -251,7 +251,7 @@ public class SysDeptServiceImpl implements ISysDeptService
 
     /**
      * 删除部门管理信息
-     * 
+     *
      * @param deptId 部门ID
      * @return 结果
      */
@@ -280,20 +280,17 @@ public class SysDeptServiceImpl implements ISysDeptService
         if(sysDept !=null &&  sysDept.getJiBie()!=null ){
             if(sysDept.getJiBie()==0){
                 SysDept sysDept1 =new SysDept();
-                sysDept1.setJiBie(2);
                 List<SysDept> list1 = deptMapper.selectDeptList(sysDept1);
                 for(SysDept dpt1:list1){
                     stringlist.add(dpt1.getDeptId().toString());
                 }
-            }else if(sysDept.getJiBie()==1){
+            }else {
                 SysDept sysDept2 =new SysDept();
-                sysDept2.setParentId(sysDept.getDeptId());
+                sysDept2.setOrDeptId(sysDept.getDeptId());
                 List<SysDept> list2 = deptMapper.selectDeptList(sysDept2);
                 for(SysDept dpt2:list2){
                     stringlist.add(dpt2.getDeptId().toString());
                 }
-            }else if(sysDept.getJiBie()==2){
-                stringlist.add(sysDept.getDeptId().toString());
             }
         }
         return stringlist;

+ 17 - 14
yijia-system/src/main/resources/mapper/system/SysDeptMapper.xml

@@ -28,12 +28,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		<result property="stationLatitude"    column="station_latitude"    />
 		<result property="mno"    column="mno"    />
 	</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 ,d.ji_bie, d.dept_address, d.oil_gun_num, d.station_pic, d.station_longitude, d.station_latitude, d.mno, d.app_id, d.app_secret
         from sys_dept d
     </sql>
-    
+
 	<select id="selectDeptList" parameterType="SysDept" resultMap="SysDeptResult">
         <include refid="selectDeptVo"/>
         where d.del_flag = '0'
@@ -46,6 +46,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="parentId != null and parentId != 0">
 			AND parent_id = #{parentId}
 		</if>
+		<if test="orDeptId != null">
+			AND ( dept_id = #{orDeptId} or  parent_id = #{orDeptId} )
+		</if>
 		<if test="deptName != null and deptName != ''">
 			AND dept_name like concat('%', #{deptName}, '%')
 		</if>
@@ -80,7 +83,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		${params.dataScope}
 		order by d.parent_id, d.order_num
     </select>
-    
+
     <select id="selectDeptListByRoleId" resultType="Integer">
 		select d.dept_id
 		from sys_dept d
@@ -91,29 +94,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             </if>
 		order by d.parent_id, d.order_num
 	</select>
-    
+
     <select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult">
 		<include refid="selectDeptVo"/>
 		where dept_id = #{deptId}
 	</select>
-    
+
     <select id="checkDeptExistUser" parameterType="Long" resultType="int">
 		select count(1) from sys_user where dept_id = #{deptId} and del_flag = '0'
 	</select>
-	
+
 	<select id="hasChildByDeptId" parameterType="Long" resultType="int">
 		select count(1) from sys_dept
 		where del_flag = '0' and parent_id = #{deptId} limit 1
 	</select>
-	
+
 	<select id="selectChildrenDeptById" parameterType="Long" resultMap="SysDeptResult">
 		select * from sys_dept where find_in_set(#{deptId}, ancestors)
 	</select>
-	
+
 	<select id="selectNormalChildrenDeptById" parameterType="Long" resultType="int">
 		select count(*) from sys_dept where status = 0 and del_flag = '0' and find_in_set(#{deptId}, ancestors)
 	</select>
-	
+
 	<select id="checkDeptNameUnique" resultMap="SysDeptResult">
 	    <include refid="selectDeptVo"/>
 		where dept_name=#{deptName} and parent_id = #{parentId} limit 1
@@ -167,7 +170,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			sysdate()
  		)
 	</insert>
-	
+
 	<update id="updateDept" parameterType="SysDept">
  		update sys_dept
  		<set>
@@ -193,7 +196,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  		</set>
  		where dept_id = #{deptId}
 	</update>
-	
+
 	<update id="updateDeptChildren" parameterType="java.util.List">
 	    update sys_dept set ancestors =
 	    <foreach collection="depts" item="item" index="index"
@@ -206,7 +209,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	        #{item.deptId}
 	    </foreach>
 	</update>
-	 
+
 	 <update id="updateDeptStatus" parameterType="SysDept">
  	    update sys_dept
  	    <set>
@@ -216,9 +219,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </set>
  	    where dept_id in (${ancestors})
 	</update>
-	
+
 	<delete id="deleteDeptById" parameterType="Long">
 		update sys_dept set del_flag = '2' where dept_id = #{deptId}
 	</delete>
 
-</mapper> 
+</mapper>