Browse Source

增加标签管理

zangguocen 4 năm trước cách đây
mục cha
commit
1bd2dcf5a2
18 tập tin đã thay đổi với 1636 bổ sung0 xóa
  1. 108 0
      yijia-label/src/main/java/com/yijia/label/controller/CustomerLabelController.java
  2. 146 0
      yijia-label/src/main/java/com/yijia/label/controller/LabelRuleController.java
  3. 105 0
      yijia-label/src/main/java/com/yijia/label/controller/LabelRuleDetailController.java
  4. 96 0
      yijia-label/src/main/java/com/yijia/label/domain/CustomerLabel.java
  5. 93 0
      yijia-label/src/main/java/com/yijia/label/domain/LabelRule.java
  6. 124 0
      yijia-label/src/main/java/com/yijia/label/domain/LabelRuleDetail.java
  7. 61 0
      yijia-label/src/main/java/com/yijia/label/mapper/CustomerLabelMapper.java
  8. 61 0
      yijia-label/src/main/java/com/yijia/label/mapper/LabelRuleDetailMapper.java
  9. 75 0
      yijia-label/src/main/java/com/yijia/label/mapper/LabelRuleMapper.java
  10. 61 0
      yijia-label/src/main/java/com/yijia/label/service/ICustomerLabelService.java
  11. 61 0
      yijia-label/src/main/java/com/yijia/label/service/ILabelRuleDetailService.java
  12. 76 0
      yijia-label/src/main/java/com/yijia/label/service/ILabelRuleService.java
  13. 96 0
      yijia-label/src/main/java/com/yijia/label/service/impl/CustomerLabelServiceImpl.java
  14. 96 0
      yijia-label/src/main/java/com/yijia/label/service/impl/LabelRuleDetailServiceImpl.java
  15. 111 0
      yijia-label/src/main/java/com/yijia/label/service/impl/LabelRuleServiceImpl.java
  16. 87 0
      yijia-label/src/main/resources/mapper/label/CustomerLabelMapper.xml
  17. 97 0
      yijia-label/src/main/resources/mapper/label/LabelRuleDetailMapper.xml
  18. 82 0
      yijia-label/src/main/resources/mapper/label/LabelRuleMapper.xml

+ 108 - 0
yijia-label/src/main/java/com/yijia/label/controller/CustomerLabelController.java

@@ -0,0 +1,108 @@
+package com.yijia.label.controller;
+
+import java.util.List;
+
+import com.yijia.common.core.domain.model.LoginUser;
+import com.yijia.common.utils.SecurityUtils;
+import com.yijia.system.service.ISysDeptService;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.yijia.common.annotation.Log;
+import com.yijia.common.core.controller.BaseController;
+import com.yijia.common.core.domain.AjaxResult;
+import com.yijia.common.enums.BusinessType;
+import com.yijia.label.domain.CustomerLabel;
+import com.yijia.label.service.ICustomerLabelService;
+import com.yijia.common.utils.poi.ExcelUtil;
+import com.yijia.common.core.page.TableDataInfo;
+
+/**
+ * 用户标签Controller
+ * 
+ * @author yijia
+ * @date 2021-06-15
+ */
+@RestController
+@RequestMapping("/label/label")
+public class CustomerLabelController extends BaseController
+{
+    @Autowired
+    private ICustomerLabelService customerLabelService;
+
+    @Autowired
+    private ISysDeptService deptService;
+    /**
+     * 查询用户标签列表
+     */
+    @GetMapping("/list")
+    public TableDataInfo list(CustomerLabel customerLabel)
+    {
+        startPage();
+        List<CustomerLabel> list = customerLabelService.selectCustomerLabelList(customerLabel);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出用户标签列表
+     */
+    @Log(title = "用户标签", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(CustomerLabel customerLabel)
+    {
+        List<CustomerLabel> list = customerLabelService.selectCustomerLabelList(customerLabel);
+        ExcelUtil<CustomerLabel> util = new ExcelUtil<CustomerLabel>(CustomerLabel.class);
+        return util.exportExcel(list, "label");
+    }
+
+    /**
+     * 获取用户标签详细信息
+     */
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Integer id)
+    {
+        return AjaxResult.success(customerLabelService.selectCustomerLabelById(id));
+    }
+
+    /**
+     * 新增用户标签
+     */
+    @Log(title = "用户标签", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody CustomerLabel customerLabel)
+    {
+        LoginUser currentUser = SecurityUtils.getLoginUser();
+        customerLabel.setCreateBy(currentUser.getUser().getUserId()+"");
+        customerLabel.setDelFlag("0");
+        return toAjax(customerLabelService.insertCustomerLabel(customerLabel));
+    }
+
+    /**
+     * 修改用户标签
+     */
+    @Log(title = "用户标签", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody CustomerLabel customerLabel)
+    {
+        LoginUser currentUser = SecurityUtils.getLoginUser();
+        customerLabel.setUpdateBy(currentUser.getUser().getUserId()+"");
+        return toAjax(customerLabelService.updateCustomerLabel(customerLabel));
+    }
+
+    /**
+     * 删除用户标签
+     */
+    @Log(title = "用户标签", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Integer[] ids)
+    {
+        return toAjax(customerLabelService.deleteCustomerLabelByIds(ids));
+    }
+}

+ 146 - 0
yijia-label/src/main/java/com/yijia/label/controller/LabelRuleController.java

@@ -0,0 +1,146 @@
+package com.yijia.label.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.common.utils.bean.BeanUtils;
+import com.yijia.station.domain.SysDeptDemo;
+import com.yijia.system.service.ISysDeptService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.yijia.common.annotation.Log;
+import com.yijia.common.core.controller.BaseController;
+import com.yijia.common.core.domain.AjaxResult;
+import com.yijia.common.enums.BusinessType;
+import com.yijia.label.domain.LabelRule;
+import com.yijia.label.service.ILabelRuleService;
+import com.yijia.common.utils.poi.ExcelUtil;
+import com.yijia.common.core.page.TableDataInfo;
+
+/**
+ * 标签规则
+Controller
+ * 
+ * @author yijia
+ * @date 2021-06-15
+ */
+@RestController
+@RequestMapping("/label/rule")
+public class LabelRuleController extends BaseController
+{
+    @Autowired
+    private ILabelRuleService labelRuleService;
+
+    @Autowired
+    private ISysDeptService deptService;
+    /**
+     * 查询标签规则列表
+     */
+    @GetMapping("/list")
+    public TableDataInfo list(LabelRule labelRule)
+    {
+        startPage();
+        List<LabelRule> list = labelRuleService.selectLabelRuleList(labelRule);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出标签规则列表
+     */
+    @Log(title = "标签规则", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(LabelRule labelRule)
+    {
+        List<LabelRule> list = labelRuleService.selectLabelRuleList(labelRule);
+        ExcelUtil<LabelRule> util = new ExcelUtil<LabelRule>(LabelRule.class);
+        return util.exportExcel(list, "rule");
+    }
+
+    /**
+     * 获取标签规则详细信息
+     */
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Integer id)
+    {
+        return AjaxResult.success(labelRuleService.selectLabelRuleById(id));
+    }
+
+//    @GetMapping("/sysDeptDemoList")
+//    public AjaxResult sysDeptDemoList()
+//    {
+//        LoginUser currentUser = SecurityUtils.getLoginUser();
+//        SysDeptDemo sysDeptDemo = new SysDeptDemo();
+//        SysDept dept = deptService.selectDeptById(currentUser.getUser().getDeptId());
+//        BeanUtils.copyProperties(sysDeptDemo, dept);
+//        LabelRule labelRule =new LabelRule();
+//        labelRule.setStationId(currentUser.getUser().getDeptId());
+//        List<LabelRule> list = labelRuleService.selectLabelRuleList(labelRule);
+//        sysDeptDemo.setLabelArr(list);
+//        return AjaxResult.success(sysDeptDemo);
+//    }
+    /**
+     * 新增标签规则
+     */
+//    @Log(title = "标签规则", businessType = BusinessType.INSERT)
+//    @PostMapping
+//    @Transactional
+//    public AjaxResult add(@RequestBody SysDeptDemo sysDeptDemo)
+//    {
+//        int i =0;
+//        LoginUser currentUser = SecurityUtils.getLoginUser();
+//        //根据demo获取添加数据
+//        if(sysDeptDemo!=null){
+//            SysDept dept =new SysDept();
+//            dept.setDeptId(sysDeptDemo.getDeptId());
+//            dept.setLabelFlag(sysDeptDemo.getLabelFlag());
+//            dept.setUpdateBy(currentUser.getUser().getUserId()+"");
+//            dept.setUpdateTime(DateUtils.getNowDate());
+//            i =  deptService.updateDeptInfo(dept);
+//            if(sysDeptDemo.getLabelArr()!=null && sysDeptDemo.getLabelArr().size()>0){
+//                for(LabelRule labelRule : sysDeptDemo.getLabelArr()) {
+//                    if(labelRule.getId()!=null){
+//                        labelRule.setUpdateBy(currentUser.getUser().getUserId()+"");
+//                        i=labelRuleService.updateLabelRule(labelRule);
+//                    }else{
+//                        labelRule.setCreateBy(currentUser.getUser().getUserId()+"");
+//                        i=labelRuleService.insertLabelRule(labelRule);
+//                    }
+//                }
+//            }
+//        }
+//        return toAjax(i);
+//    }
+
+    /**
+     * 修改标签规则
+     */
+    @Log(title = "标签规则", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody LabelRule labelRule)
+    {
+        LoginUser currentUser = SecurityUtils.getLoginUser();
+        labelRule.setUpdateBy(currentUser.getUser().getUserId()+"");
+        return toAjax(labelRuleService.updateLabelRule(labelRule));
+    }
+
+    /**
+     * 删除标签规则
+     */
+    @Log(title = "标签规则", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Integer[] ids)
+    {
+        return toAjax(labelRuleService.deleteLabelRuleByIds(ids));
+    }
+}

+ 105 - 0
yijia-label/src/main/java/com/yijia/label/controller/LabelRuleDetailController.java

@@ -0,0 +1,105 @@
+package com.yijia.label.controller;
+
+import java.util.List;
+
+import com.yijia.common.core.domain.model.LoginUser;
+import com.yijia.common.utils.SecurityUtils;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.yijia.common.annotation.Log;
+import com.yijia.common.core.controller.BaseController;
+import com.yijia.common.core.domain.AjaxResult;
+import com.yijia.common.enums.BusinessType;
+import com.yijia.label.domain.LabelRuleDetail;
+import com.yijia.label.service.ILabelRuleDetailService;
+import com.yijia.common.utils.poi.ExcelUtil;
+import com.yijia.common.core.page.TableDataInfo;
+
+/**
+ * 标签规则明细Controller
+ * 
+ * @author yijia
+ * @date 2021-06-15
+ */
+@RestController
+@RequestMapping("/label/detail")
+public class LabelRuleDetailController extends BaseController
+{
+    @Autowired
+    private ILabelRuleDetailService labelRuleDetailService;
+
+    /**
+     * 查询标签规则明细列表
+     */
+    @GetMapping("/list")
+    public TableDataInfo list(LabelRuleDetail labelRuleDetail)
+    {
+        startPage();
+        List<LabelRuleDetail> list = labelRuleDetailService.selectLabelRuleDetailList(labelRuleDetail);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出标签规则明细列表
+     */
+    @Log(title = "标签规则明细", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(LabelRuleDetail labelRuleDetail)
+    {
+        List<LabelRuleDetail> list = labelRuleDetailService.selectLabelRuleDetailList(labelRuleDetail);
+        ExcelUtil<LabelRuleDetail> util = new ExcelUtil<LabelRuleDetail>(LabelRuleDetail.class);
+        return util.exportExcel(list, "detail");
+    }
+
+    /**
+     * 获取标签规则明细详细信息
+     */
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Integer id)
+    {
+        return AjaxResult.success(labelRuleDetailService.selectLabelRuleDetailById(id));
+    }
+
+    /**
+     * 新增标签规则明细
+     */
+    @Log(title = "标签规则明细", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody LabelRuleDetail labelRuleDetail)
+    {
+        LoginUser currentUser = SecurityUtils.getLoginUser();
+        labelRuleDetail.setCreateBy(currentUser.getUser().getUserId()+"");
+        return toAjax(labelRuleDetailService.insertLabelRuleDetail(labelRuleDetail));
+    }
+
+    /**
+     * 修改标签规则明细
+     */
+    @Log(title = "标签规则明细", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody LabelRuleDetail labelRuleDetail)
+    {
+        LoginUser currentUser = SecurityUtils.getLoginUser();
+        labelRuleDetail.setUpdateBy(currentUser.getUser().getUserId()+"");
+        return toAjax(labelRuleDetailService.updateLabelRuleDetail(labelRuleDetail));
+    }
+
+    /**
+     * 删除标签规则明细
+     */
+    @Log(title = "标签规则明细", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Integer[] ids)
+    {
+        return toAjax(labelRuleDetailService.deleteLabelRuleDetailByIds(ids));
+    }
+
+}

+ 96 - 0
yijia-label/src/main/java/com/yijia/label/domain/CustomerLabel.java

@@ -0,0 +1,96 @@
+package com.yijia.label.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.yijia.common.annotation.Excel;
+import com.yijia.common.core.domain.BaseEntity;
+
+/**
+ * 用户标签对象 customer_label
+ * 
+ * @author yijia
+ * @date 2021-06-15
+ */
+public class CustomerLabel extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** $column.columnComment */
+    private Integer id;
+
+    /** 手机号 */
+    @Excel(name = "手机号")
+    private String phone;
+
+    /** 标签规则主表 */
+    @Excel(name = "标签规则主表")
+    private Integer labelId;
+
+    /** 油站id */
+    @Excel(name = "油站id")
+    private Integer stationId;
+
+    /** 删除 1是 0否 */
+    private String delFlag;
+
+    public void setId(Integer id) 
+    {
+        this.id = id;
+    }
+
+    public Integer getId() 
+    {
+        return id;
+    }
+    public void setPhone(String phone) 
+    {
+        this.phone = phone;
+    }
+
+    public String getPhone() 
+    {
+        return phone;
+    }
+    public void setLabelId(Integer labelId) 
+    {
+        this.labelId = labelId;
+    }
+
+    public Integer getLabelId() 
+    {
+        return labelId;
+    }
+    public void setStationId(Integer stationId) 
+    {
+        this.stationId = stationId;
+    }
+
+    public Integer getStationId() 
+    {
+        return stationId;
+    }
+    public void setDelFlag(String delFlag) 
+    {
+        this.delFlag = delFlag;
+    }
+
+    public String getDelFlag() 
+    {
+        return delFlag;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("phone", getPhone())
+            .append("labelId", getLabelId())
+            .append("stationId", getStationId())
+            .append("createBy", getCreateBy())
+            .append("createTime", getCreateTime())
+            .append("updateBy", getUpdateBy())
+            .append("updateTime", getUpdateTime())
+            .append("delFlag", getDelFlag())
+            .toString();
+    }
+}

+ 93 - 0
yijia-label/src/main/java/com/yijia/label/domain/LabelRule.java

@@ -0,0 +1,93 @@
+package com.yijia.label.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.yijia.common.annotation.Excel;
+import com.yijia.common.core.domain.BaseEntity;
+
+import java.util.List;
+
+/**
+ * 标签规则
+对象 label_rule
+ * 
+ * @author yijia
+ * @date 2021-06-15
+ */
+public class LabelRule extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 标签主表id */
+    private Integer id;
+
+    /** 标签名 */
+    private String labelName;
+
+    /** 油站id */
+    private Long stationId;
+
+    /** 删除标识1 是 0 否 */
+    private String delFlag;
+
+    private List<LabelRuleDetail> labelRuleDetailList;
+
+    public List<LabelRuleDetail> getLabelRuleDetailList() {
+        return labelRuleDetailList;
+    }
+
+    public void setLabelRuleDetailList(List<LabelRuleDetail> labelRuleDetailList) {
+        this.labelRuleDetailList = labelRuleDetailList;
+    }
+
+    public void setId(Integer id)
+    {
+        this.id = id;
+    }
+
+    public Integer getId() 
+    {
+        return id;
+    }
+    public void setLabelName(String labelName) 
+    {
+        this.labelName = labelName;
+    }
+
+    public String getLabelName() 
+    {
+        return labelName;
+    }
+
+    public Long getStationId() {
+        return stationId;
+    }
+
+    public void setStationId(Long stationId) {
+        this.stationId = stationId;
+    }
+
+    public void setDelFlag(String delFlag)
+    {
+        this.delFlag = delFlag;
+    }
+
+    public String getDelFlag() 
+    {
+        return delFlag;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("labelName", getLabelName())
+            .append("stationId", getStationId())
+            .append("delFlag", getDelFlag())
+            .append("createBy", getCreateBy())
+            .append("createTime", getCreateTime())
+            .append("updateBy", getUpdateBy())
+            .append("updateTime", getUpdateTime())
+            .toString();
+    }
+}

+ 124 - 0
yijia-label/src/main/java/com/yijia/label/domain/LabelRuleDetail.java

@@ -0,0 +1,124 @@
+package com.yijia.label.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.yijia.common.annotation.Excel;
+import com.yijia.common.core.domain.BaseEntity;
+
+/**
+ * 标签规则明细对象 label_rule_detail
+ * 
+ * @author yijia
+ * @date 2021-06-15
+ */
+public class LabelRuleDetail extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 标签规则明细id */
+    private Integer id;
+
+    /** 标签主表id */
+    @Excel(name = "标签主表id")
+    private Integer parentId;
+
+    /** 油品名称 */
+    @Excel(name = "油品名称")
+    private String oilName;
+
+    /** 优惠条件当为1按金额优惠;2按升数优惠 */
+    @Excel(name = "优惠条件当为1按金额优惠;2按升数优惠")
+    private String discountTerm;
+
+    /** 优惠条件(满多少升、满多少元) */
+    @Excel(name = "优惠条件", readConverterExp = "满=多少升、满多少元")
+    private String discountLitersAmt;
+
+    /** 优惠金额 */
+    @Excel(name = "优惠金额")
+    private String discountAmt;
+
+    /** 删除标识 1是 0 否 */
+    private String delFlag;
+
+    public void setId(Integer id) 
+    {
+        this.id = id;
+    }
+
+    public Integer getId() 
+    {
+        return id;
+    }
+    public void setParentId(Integer parentId) 
+    {
+        this.parentId = parentId;
+    }
+
+    public Integer getParentId() 
+    {
+        return parentId;
+    }
+    public void setOilName(String oilName) 
+    {
+        this.oilName = oilName;
+    }
+
+    public String getOilName() 
+    {
+        return oilName;
+    }
+    public void setDiscountTerm(String discountTerm) 
+    {
+        this.discountTerm = discountTerm;
+    }
+
+    public String getDiscountTerm() 
+    {
+        return discountTerm;
+    }
+    public void setDiscountLitersAmt(String discountLitersAmt) 
+    {
+        this.discountLitersAmt = discountLitersAmt;
+    }
+
+    public String getDiscountLitersAmt() 
+    {
+        return discountLitersAmt;
+    }
+    public void setDiscountAmt(String discountAmt) 
+    {
+        this.discountAmt = discountAmt;
+    }
+
+    public String getDiscountAmt() 
+    {
+        return discountAmt;
+    }
+    public void setDelFlag(String delFlag) 
+    {
+        this.delFlag = delFlag;
+    }
+
+    public String getDelFlag() 
+    {
+        return delFlag;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("parentId", getParentId())
+            .append("oilName", getOilName())
+            .append("discountTerm", getDiscountTerm())
+            .append("discountLitersAmt", getDiscountLitersAmt())
+            .append("discountAmt", getDiscountAmt())
+            .append("createBy", getCreateBy())
+            .append("createTime", getCreateTime())
+            .append("updateBy", getUpdateBy())
+            .append("updateTime", getUpdateTime())
+            .append("delFlag", getDelFlag())
+            .toString();
+    }
+}

+ 61 - 0
yijia-label/src/main/java/com/yijia/label/mapper/CustomerLabelMapper.java

@@ -0,0 +1,61 @@
+package com.yijia.label.mapper;
+
+import java.util.List;
+import com.yijia.label.domain.CustomerLabel;
+
+/**
+ * 用户标签Mapper接口
+ * 
+ * @author yijia
+ * @date 2021-06-15
+ */
+public interface CustomerLabelMapper 
+{
+    /**
+     * 查询用户标签
+     * 
+     * @param id 用户标签ID
+     * @return 用户标签
+     */
+    public CustomerLabel selectCustomerLabelById(Integer id);
+
+    /**
+     * 查询用户标签列表
+     * 
+     * @param customerLabel 用户标签
+     * @return 用户标签集合
+     */
+    public List<CustomerLabel> selectCustomerLabelList(CustomerLabel customerLabel);
+
+    /**
+     * 新增用户标签
+     * 
+     * @param customerLabel 用户标签
+     * @return 结果
+     */
+    public int insertCustomerLabel(CustomerLabel customerLabel);
+
+    /**
+     * 修改用户标签
+     * 
+     * @param customerLabel 用户标签
+     * @return 结果
+     */
+    public int updateCustomerLabel(CustomerLabel customerLabel);
+
+    /**
+     * 删除用户标签
+     * 
+     * @param id 用户标签ID
+     * @return 结果
+     */
+    public int deleteCustomerLabelById(Integer id);
+
+    /**
+     * 批量删除用户标签
+     * 
+     * @param ids 需要删除的数据ID
+     * @return 结果
+     */
+    public int deleteCustomerLabelByIds(Integer[] ids);
+}

+ 61 - 0
yijia-label/src/main/java/com/yijia/label/mapper/LabelRuleDetailMapper.java

@@ -0,0 +1,61 @@
+package com.yijia.label.mapper;
+
+import java.util.List;
+import com.yijia.label.domain.LabelRuleDetail;
+
+/**
+ * 标签规则明细Mapper接口
+ * 
+ * @author yijia
+ * @date 2021-06-15
+ */
+public interface LabelRuleDetailMapper 
+{
+    /**
+     * 查询标签规则明细
+     * 
+     * @param id 标签规则明细ID
+     * @return 标签规则明细
+     */
+    public LabelRuleDetail selectLabelRuleDetailById(Integer id);
+
+    /**
+     * 查询标签规则明细列表
+     * 
+     * @param labelRuleDetail 标签规则明细
+     * @return 标签规则明细集合
+     */
+    public List<LabelRuleDetail> selectLabelRuleDetailList(LabelRuleDetail labelRuleDetail);
+
+    /**
+     * 新增标签规则明细
+     * 
+     * @param labelRuleDetail 标签规则明细
+     * @return 结果
+     */
+    public int insertLabelRuleDetail(LabelRuleDetail labelRuleDetail);
+
+    /**
+     * 修改标签规则明细
+     * 
+     * @param labelRuleDetail 标签规则明细
+     * @return 结果
+     */
+    public int updateLabelRuleDetail(LabelRuleDetail labelRuleDetail);
+
+    /**
+     * 删除标签规则明细
+     * 
+     * @param id 标签规则明细ID
+     * @return 结果
+     */
+    public int deleteLabelRuleDetailById(Integer id);
+
+    /**
+     * 批量删除标签规则明细
+     * 
+     * @param ids 需要删除的数据ID
+     * @return 结果
+     */
+    public int deleteLabelRuleDetailByIds(Integer[] ids);
+}

+ 75 - 0
yijia-label/src/main/java/com/yijia/label/mapper/LabelRuleMapper.java

@@ -0,0 +1,75 @@
+package com.yijia.label.mapper;
+
+import java.util.List;
+import com.yijia.label.domain.LabelRule;
+
+/**
+ * 标签规则
+Mapper接口
+ * 
+ * @author yijia
+ * @date 2021-06-15
+ */
+public interface LabelRuleMapper 
+{
+    /**
+     * 查询标签规则
+
+     * 
+     * @param id 标签规则
+ID
+     * @return 标签规则
+
+     */
+    public LabelRule selectLabelRuleById(Integer id);
+
+    /**
+     * 查询标签规则
+列表
+     * 
+     * @param labelRule 标签规则
+
+     * @return 标签规则
+集合
+     */
+    public List<LabelRule> selectLabelRuleList(LabelRule labelRule);
+
+    /**
+     * 新增标签规则
+
+     * 
+     * @param labelRule 标签规则
+
+     * @return 结果
+     */
+    public int insertLabelRule(LabelRule labelRule);
+
+    /**
+     * 修改标签规则
+
+     * 
+     * @param labelRule 标签规则
+
+     * @return 结果
+     */
+    public int updateLabelRule(LabelRule labelRule);
+
+    /**
+     * 删除标签规则
+
+     * 
+     * @param id 标签规则
+ID
+     * @return 结果
+     */
+    public int deleteLabelRuleById(Integer id);
+
+    /**
+     * 批量删除标签规则
+
+     * 
+     * @param ids 需要删除的数据ID
+     * @return 结果
+     */
+    public int deleteLabelRuleByIds(Integer[] ids);
+}

+ 61 - 0
yijia-label/src/main/java/com/yijia/label/service/ICustomerLabelService.java

@@ -0,0 +1,61 @@
+package com.yijia.label.service;
+
+import java.util.List;
+import com.yijia.label.domain.CustomerLabel;
+
+/**
+ * 用户标签Service接口
+ * 
+ * @author yijia
+ * @date 2021-06-15
+ */
+public interface ICustomerLabelService 
+{
+    /**
+     * 查询用户标签
+     * 
+     * @param id 用户标签ID
+     * @return 用户标签
+     */
+    public CustomerLabel selectCustomerLabelById(Integer id);
+
+    /**
+     * 查询用户标签列表
+     * 
+     * @param customerLabel 用户标签
+     * @return 用户标签集合
+     */
+    public List<CustomerLabel> selectCustomerLabelList(CustomerLabel customerLabel);
+
+    /**
+     * 新增用户标签
+     * 
+     * @param customerLabel 用户标签
+     * @return 结果
+     */
+    public int insertCustomerLabel(CustomerLabel customerLabel);
+
+    /**
+     * 修改用户标签
+     * 
+     * @param customerLabel 用户标签
+     * @return 结果
+     */
+    public int updateCustomerLabel(CustomerLabel customerLabel);
+
+    /**
+     * 批量删除用户标签
+     * 
+     * @param ids 需要删除的用户标签ID
+     * @return 结果
+     */
+    public int deleteCustomerLabelByIds(Integer[] ids);
+
+    /**
+     * 删除用户标签信息
+     * 
+     * @param id 用户标签ID
+     * @return 结果
+     */
+    public int deleteCustomerLabelById(Integer id);
+}

+ 61 - 0
yijia-label/src/main/java/com/yijia/label/service/ILabelRuleDetailService.java

@@ -0,0 +1,61 @@
+package com.yijia.label.service;
+
+import java.util.List;
+import com.yijia.label.domain.LabelRuleDetail;
+
+/**
+ * 标签规则明细Service接口
+ * 
+ * @author yijia
+ * @date 2021-06-15
+ */
+public interface ILabelRuleDetailService 
+{
+    /**
+     * 查询标签规则明细
+     * 
+     * @param id 标签规则明细ID
+     * @return 标签规则明细
+     */
+    public LabelRuleDetail selectLabelRuleDetailById(Integer id);
+
+    /**
+     * 查询标签规则明细列表
+     * 
+     * @param labelRuleDetail 标签规则明细
+     * @return 标签规则明细集合
+     */
+    public List<LabelRuleDetail> selectLabelRuleDetailList(LabelRuleDetail labelRuleDetail);
+
+    /**
+     * 新增标签规则明细
+     * 
+     * @param labelRuleDetail 标签规则明细
+     * @return 结果
+     */
+    public int insertLabelRuleDetail(LabelRuleDetail labelRuleDetail);
+
+    /**
+     * 修改标签规则明细
+     * 
+     * @param labelRuleDetail 标签规则明细
+     * @return 结果
+     */
+    public int updateLabelRuleDetail(LabelRuleDetail labelRuleDetail);
+
+    /**
+     * 批量删除标签规则明细
+     * 
+     * @param ids 需要删除的标签规则明细ID
+     * @return 结果
+     */
+    public int deleteLabelRuleDetailByIds(Integer[] ids);
+
+    /**
+     * 删除标签规则明细信息
+     * 
+     * @param id 标签规则明细ID
+     * @return 结果
+     */
+    public int deleteLabelRuleDetailById(Integer id);
+}

+ 76 - 0
yijia-label/src/main/java/com/yijia/label/service/ILabelRuleService.java

@@ -0,0 +1,76 @@
+package com.yijia.label.service;
+
+import java.util.List;
+import com.yijia.label.domain.LabelRule;
+
+/**
+ * 标签规则
+Service接口
+ * 
+ * @author yijia
+ * @date 2021-06-15
+ */
+public interface ILabelRuleService 
+{
+    /**
+     * 查询标签规则
+
+     * 
+     * @param id 标签规则
+ID
+     * @return 标签规则
+
+     */
+    public LabelRule selectLabelRuleById(Integer id);
+
+    /**
+     * 查询标签规则
+列表
+     * 
+     * @param labelRule 标签规则
+
+     * @return 标签规则
+集合
+     */
+    public List<LabelRule> selectLabelRuleList(LabelRule labelRule);
+
+    /**
+     * 新增标签规则
+
+     * 
+     * @param labelRule 标签规则
+
+     * @return 结果
+     */
+    public int insertLabelRule(LabelRule labelRule);
+
+    /**
+     * 修改标签规则
+
+     * 
+     * @param labelRule 标签规则
+
+     * @return 结果
+     */
+    public int updateLabelRule(LabelRule labelRule);
+
+    /**
+     * 批量删除标签规则
+
+     * 
+     * @param ids 需要删除的标签规则
+ID
+     * @return 结果
+     */
+    public int deleteLabelRuleByIds(Integer[] ids);
+
+    /**
+     * 删除标签规则
+信息
+     * 
+     * @param id 标签规则
+ID
+     * @return 结果
+     */
+    public int deleteLabelRuleById(Integer id);
+}

+ 96 - 0
yijia-label/src/main/java/com/yijia/label/service/impl/CustomerLabelServiceImpl.java

@@ -0,0 +1,96 @@
+package com.yijia.label.service.impl;
+
+import java.util.List;
+import com.yijia.common.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.yijia.label.mapper.CustomerLabelMapper;
+import com.yijia.label.domain.CustomerLabel;
+import com.yijia.label.service.ICustomerLabelService;
+
+/**
+ * 用户标签Service业务层处理
+ * 
+ * @author yijia
+ * @date 2021-06-15
+ */
+@Service
+public class CustomerLabelServiceImpl implements ICustomerLabelService 
+{
+    @Autowired
+    private CustomerLabelMapper customerLabelMapper;
+
+    /**
+     * 查询用户标签
+     * 
+     * @param id 用户标签ID
+     * @return 用户标签
+     */
+    @Override
+    public CustomerLabel selectCustomerLabelById(Integer id)
+    {
+        return customerLabelMapper.selectCustomerLabelById(id);
+    }
+
+    /**
+     * 查询用户标签列表
+     * 
+     * @param customerLabel 用户标签
+     * @return 用户标签
+     */
+    @Override
+    public List<CustomerLabel> selectCustomerLabelList(CustomerLabel customerLabel)
+    {
+        return customerLabelMapper.selectCustomerLabelList(customerLabel);
+    }
+
+    /**
+     * 新增用户标签
+     * 
+     * @param customerLabel 用户标签
+     * @return 结果
+     */
+    @Override
+    public int insertCustomerLabel(CustomerLabel customerLabel)
+    {
+        customerLabel.setCreateTime(DateUtils.getNowDate());
+        return customerLabelMapper.insertCustomerLabel(customerLabel);
+    }
+
+    /**
+     * 修改用户标签
+     * 
+     * @param customerLabel 用户标签
+     * @return 结果
+     */
+    @Override
+    public int updateCustomerLabel(CustomerLabel customerLabel)
+    {
+        customerLabel.setUpdateTime(DateUtils.getNowDate());
+        return customerLabelMapper.updateCustomerLabel(customerLabel);
+    }
+
+    /**
+     * 批量删除用户标签
+     * 
+     * @param ids 需要删除的用户标签ID
+     * @return 结果
+     */
+    @Override
+    public int deleteCustomerLabelByIds(Integer[] ids)
+    {
+        return customerLabelMapper.deleteCustomerLabelByIds(ids);
+    }
+
+    /**
+     * 删除用户标签信息
+     * 
+     * @param id 用户标签ID
+     * @return 结果
+     */
+    @Override
+    public int deleteCustomerLabelById(Integer id)
+    {
+        return customerLabelMapper.deleteCustomerLabelById(id);
+    }
+}

+ 96 - 0
yijia-label/src/main/java/com/yijia/label/service/impl/LabelRuleDetailServiceImpl.java

@@ -0,0 +1,96 @@
+package com.yijia.label.service.impl;
+
+import java.util.List;
+import com.yijia.common.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.yijia.label.mapper.LabelRuleDetailMapper;
+import com.yijia.label.domain.LabelRuleDetail;
+import com.yijia.label.service.ILabelRuleDetailService;
+
+/**
+ * 标签规则明细Service业务层处理
+ * 
+ * @author yijia
+ * @date 2021-06-15
+ */
+@Service
+public class LabelRuleDetailServiceImpl implements ILabelRuleDetailService 
+{
+    @Autowired
+    private LabelRuleDetailMapper labelRuleDetailMapper;
+
+    /**
+     * 查询标签规则明细
+     * 
+     * @param id 标签规则明细ID
+     * @return 标签规则明细
+     */
+    @Override
+    public LabelRuleDetail selectLabelRuleDetailById(Integer id)
+    {
+        return labelRuleDetailMapper.selectLabelRuleDetailById(id);
+    }
+
+    /**
+     * 查询标签规则明细列表
+     * 
+     * @param labelRuleDetail 标签规则明细
+     * @return 标签规则明细
+     */
+    @Override
+    public List<LabelRuleDetail> selectLabelRuleDetailList(LabelRuleDetail labelRuleDetail)
+    {
+        return labelRuleDetailMapper.selectLabelRuleDetailList(labelRuleDetail);
+    }
+
+    /**
+     * 新增标签规则明细
+     * 
+     * @param labelRuleDetail 标签规则明细
+     * @return 结果
+     */
+    @Override
+    public int insertLabelRuleDetail(LabelRuleDetail labelRuleDetail)
+    {
+        labelRuleDetail.setCreateTime(DateUtils.getNowDate());
+        return labelRuleDetailMapper.insertLabelRuleDetail(labelRuleDetail);
+    }
+
+    /**
+     * 修改标签规则明细
+     * 
+     * @param labelRuleDetail 标签规则明细
+     * @return 结果
+     */
+    @Override
+    public int updateLabelRuleDetail(LabelRuleDetail labelRuleDetail)
+    {
+        labelRuleDetail.setUpdateTime(DateUtils.getNowDate());
+        return labelRuleDetailMapper.updateLabelRuleDetail(labelRuleDetail);
+    }
+
+    /**
+     * 批量删除标签规则明细
+     * 
+     * @param ids 需要删除的标签规则明细ID
+     * @return 结果
+     */
+    @Override
+    public int deleteLabelRuleDetailByIds(Integer[] ids)
+    {
+        return labelRuleDetailMapper.deleteLabelRuleDetailByIds(ids);
+    }
+
+    /**
+     * 删除标签规则明细信息
+     * 
+     * @param id 标签规则明细ID
+     * @return 结果
+     */
+    @Override
+    public int deleteLabelRuleDetailById(Integer id)
+    {
+        return labelRuleDetailMapper.deleteLabelRuleDetailById(id);
+    }
+}

+ 111 - 0
yijia-label/src/main/java/com/yijia/label/service/impl/LabelRuleServiceImpl.java

@@ -0,0 +1,111 @@
+package com.yijia.label.service.impl;
+
+import java.util.List;
+import com.yijia.common.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.yijia.label.mapper.LabelRuleMapper;
+import com.yijia.label.domain.LabelRule;
+import com.yijia.label.service.ILabelRuleService;
+
+/**
+ * 标签规则
+Service业务层处理
+ * 
+ * @author yijia
+ * @date 2021-06-15
+ */
+@Service
+public class LabelRuleServiceImpl implements ILabelRuleService 
+{
+    @Autowired
+    private LabelRuleMapper labelRuleMapper;
+
+    /**
+     * 查询标签规则
+
+     * 
+     * @param id 标签规则
+ID
+     * @return 标签规则
+
+     */
+    @Override
+    public LabelRule selectLabelRuleById(Integer id)
+    {
+        return labelRuleMapper.selectLabelRuleById(id);
+    }
+
+    /**
+     * 查询标签规则
+列表
+     * 
+     * @param labelRule 标签规则
+
+     * @return 标签规则
+
+     */
+    @Override
+    public List<LabelRule> selectLabelRuleList(LabelRule labelRule)
+    {
+        return labelRuleMapper.selectLabelRuleList(labelRule);
+    }
+
+    /**
+     * 新增标签规则
+
+     * 
+     * @param labelRule 标签规则
+
+     * @return 结果
+     */
+    @Override
+    public int insertLabelRule(LabelRule labelRule)
+    {
+        labelRule.setCreateTime(DateUtils.getNowDate());
+        return labelRuleMapper.insertLabelRule(labelRule);
+    }
+
+    /**
+     * 修改标签规则
+
+     * 
+     * @param labelRule 标签规则
+
+     * @return 结果
+     */
+    @Override
+    public int updateLabelRule(LabelRule labelRule)
+    {
+        labelRule.setUpdateTime(DateUtils.getNowDate());
+        return labelRuleMapper.updateLabelRule(labelRule);
+    }
+
+    /**
+     * 批量删除标签规则
+
+     * 
+     * @param ids 需要删除的标签规则
+ID
+     * @return 结果
+     */
+    @Override
+    public int deleteLabelRuleByIds(Integer[] ids)
+    {
+        return labelRuleMapper.deleteLabelRuleByIds(ids);
+    }
+
+    /**
+     * 删除标签规则
+信息
+     * 
+     * @param id 标签规则
+ID
+     * @return 结果
+     */
+    @Override
+    public int deleteLabelRuleById(Integer id)
+    {
+        return labelRuleMapper.deleteLabelRuleById(id);
+    }
+}

+ 87 - 0
yijia-label/src/main/resources/mapper/label/CustomerLabelMapper.xml

@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.yijia.label.mapper.CustomerLabelMapper">
+    
+    <resultMap type="CustomerLabel" id="CustomerLabelResult">
+        <result property="id"    column="id"    />
+        <result property="phone"    column="phone"    />
+        <result property="labelId"    column="label_id"    />
+        <result property="stationId"    column="station_id"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="delFlag"    column="del_flag"    />
+    </resultMap>
+
+    <sql id="selectCustomerLabelVo">
+        select id, phone, label_id, station_id, create_by, create_time, update_by, update_time, del_flag from customer_label
+    </sql>
+
+    <select id="selectCustomerLabelList" parameterType="CustomerLabel" resultMap="CustomerLabelResult">
+        <include refid="selectCustomerLabelVo"/>
+        <where>  
+            <if test="phone != null  and phone != ''"> and phone = #{phone}</if>
+            <if test="labelId != null "> and label_id = #{labelId}</if>
+            <if test="stationId != null "> and station_id = #{stationId}</if>
+        </where>
+    </select>
+    
+    <select id="selectCustomerLabelById" parameterType="Integer" resultMap="CustomerLabelResult">
+        <include refid="selectCustomerLabelVo"/>
+        where id = #{id}
+    </select>
+        
+    <insert id="insertCustomerLabel" parameterType="CustomerLabel" useGeneratedKeys="true" keyProperty="id">
+        insert into customer_label
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="phone != null">phone,</if>
+            <if test="labelId != null">label_id,</if>
+            <if test="stationId != null">station_id,</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>
+            <if test="delFlag != null">del_flag,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="phone != null">#{phone},</if>
+            <if test="labelId != null">#{labelId},</if>
+            <if test="stationId != null">#{stationId},</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>
+            <if test="delFlag != null">#{delFlag},</if>
+         </trim>
+    </insert>
+
+    <update id="updateCustomerLabel" parameterType="CustomerLabel">
+        update customer_label
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="phone != null">phone = #{phone},</if>
+            <if test="labelId != null">label_id = #{labelId},</if>
+            <if test="stationId != null">station_id = #{stationId},</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>
+            <if test="delFlag != null">del_flag = #{delFlag},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteCustomerLabelById" parameterType="Integer">
+        delete from customer_label where id = #{id}
+    </delete>
+
+    <delete id="deleteCustomerLabelByIds" parameterType="String">
+        delete from customer_label where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+    
+</mapper>

+ 97 - 0
yijia-label/src/main/resources/mapper/label/LabelRuleDetailMapper.xml

@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.yijia.label.mapper.LabelRuleDetailMapper">
+    
+    <resultMap type="LabelRuleDetail" id="LabelRuleDetailResult">
+        <result property="id"    column="id"    />
+        <result property="parentId"    column="parent_id"    />
+        <result property="oilName"    column="oil_name"    />
+        <result property="discountTerm"    column="discount_term"    />
+        <result property="discountLitersAmt"    column="discount_liters_amt"    />
+        <result property="discountAmt"    column="discount_amt"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="delFlag"    column="del_flag"    />
+    </resultMap>
+
+    <sql id="selectLabelRuleDetailVo">
+        select id, parent_id, oil_name, discount_term, discount_liters_amt, discount_amt, create_by, create_time, update_by, update_time, del_flag from label_rule_detail
+    </sql>
+
+    <select id="selectLabelRuleDetailList" parameterType="LabelRuleDetail" resultMap="LabelRuleDetailResult">
+        <include refid="selectLabelRuleDetailVo"/>
+        <where>  
+            <if test="parentId != null "> and parent_id = #{parentId}</if>
+            <if test="oilName != null  and oilName != ''"> and oil_name like concat('%', #{oilName}, '%')</if>
+            <if test="discountTerm != null  and discountTerm != ''"> and discount_term = #{discountTerm}</if>
+            <if test="discountLitersAmt != null  and discountLitersAmt != ''"> and discount_liters_amt = #{discountLitersAmt}</if>
+            <if test="discountAmt != null  and discountAmt != ''"> and discount_amt = #{discountAmt}</if>
+        </where>
+    </select>
+    
+    <select id="selectLabelRuleDetailById" parameterType="Integer" resultMap="LabelRuleDetailResult">
+        <include refid="selectLabelRuleDetailVo"/>
+        where id = #{id}
+    </select>
+        
+    <insert id="insertLabelRuleDetail" parameterType="LabelRuleDetail" useGeneratedKeys="true" keyProperty="id">
+        insert into label_rule_detail
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="parentId != null">parent_id,</if>
+            <if test="oilName != null">oil_name,</if>
+            <if test="discountTerm != null">discount_term,</if>
+            <if test="discountLitersAmt != null">discount_liters_amt,</if>
+            <if test="discountAmt != null">discount_amt,</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>
+            <if test="delFlag != null">del_flag,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="parentId != null">#{parentId},</if>
+            <if test="oilName != null">#{oilName},</if>
+            <if test="discountTerm != null">#{discountTerm},</if>
+            <if test="discountLitersAmt != null">#{discountLitersAmt},</if>
+            <if test="discountAmt != null">#{discountAmt},</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>
+            <if test="delFlag != null">#{delFlag},</if>
+         </trim>
+    </insert>
+
+    <update id="updateLabelRuleDetail" parameterType="LabelRuleDetail">
+        update label_rule_detail
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="parentId != null">parent_id = #{parentId},</if>
+            <if test="oilName != null">oil_name = #{oilName},</if>
+            <if test="discountTerm != null">discount_term = #{discountTerm},</if>
+            <if test="discountLitersAmt != null">discount_liters_amt = #{discountLitersAmt},</if>
+            <if test="discountAmt != null">discount_amt = #{discountAmt},</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>
+            <if test="delFlag != null">del_flag = #{delFlag},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteLabelRuleDetailById" parameterType="Integer">
+        delete from label_rule_detail where id = #{id}
+    </delete>
+
+    <delete id="deleteLabelRuleDetailByIds" parameterType="String">
+        delete from label_rule_detail where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+    
+</mapper>

+ 82 - 0
yijia-label/src/main/resources/mapper/label/LabelRuleMapper.xml

@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.yijia.label.mapper.LabelRuleMapper">
+    
+    <resultMap type="LabelRule" id="LabelRuleResult">
+        <result property="id"    column="id"    />
+        <result property="labelName"    column="label_name"    />
+        <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="selectLabelRuleVo">
+        select id, label_name, station_id, del_flag, create_by, create_time, update_by, update_time from label_rule
+    </sql>
+
+    <select id="selectLabelRuleList" parameterType="LabelRule" resultMap="LabelRuleResult">
+        <include refid="selectLabelRuleVo"/>
+        <where>  
+            <if test="labelName != null  and labelName != ''"> and label_name like concat('%', #{labelName}, '%')</if>
+            <if test="stationId != null "> and station_id = #{stationId}</if>
+        </where>
+    </select>
+    
+    <select id="selectLabelRuleById" parameterType="Integer" resultMap="LabelRuleResult">
+        <include refid="selectLabelRuleVo"/>
+        where id = #{id}
+    </select>
+        
+    <insert id="insertLabelRule" parameterType="LabelRule" useGeneratedKeys="true" keyProperty="id">
+        insert into label_rule
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="labelName != null">label_name,</if>
+            <if test="stationId != null">station_id,</if>
+            <if test="delFlag != null">del_flag,</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="labelName != null">#{labelName},</if>
+            <if test="stationId != null">#{stationId},</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>
+
+    <update id="updateLabelRule" parameterType="LabelRule">
+        update label_rule
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="labelName != null">label_name = #{labelName},</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>
+
+    <delete id="deleteLabelRuleById" parameterType="Integer">
+        delete from label_rule where id = #{id}
+    </delete>
+
+    <delete id="deleteLabelRuleByIds" parameterType="String">
+        delete from label_rule where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+    
+</mapper>