Merge remote-tracking branch 'origin/master'

This commit is contained in:
user 2023-10-11 18:34:41 +08:00
commit af2b03dd44
39 changed files with 2178 additions and 192 deletions

View File

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询员工列表
export function listStaff(query) {
return request({
url: '/business/member/staff/list',
method: 'get',
params: query
})
}
// 查询字典类型详细
export function getStaff(id) {
return request({
url: '/business/member/staff' + id,
method: 'get'
})
}
// 新增字典类型
export function addStaff(data) {
return request({
url: '/business/member/staff',
method: 'post',
data: data
})
}
// 修改字典类型
export function updateStaff(data) {
return request({
url: '/business/member/staff',
method: 'put',
data: data
})
}
// 删除字典类型
export function delStaff(id) {
return request({
url: '/business/member/staff' + id,
method: 'delete'
})
}

View File

@ -1,131 +1,135 @@
<template>
<div class="app-container">
<el-form :model="queryParams" class="main-search" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="员工类别" prop="category">
<el-select v-model="queryParams.category" clearable placeholder="请选择员工类别">
<el-option
v-for="item in categoryOptions"
:key="item.key"
:label="item.name"
:value="item.key"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="姓名" prop="name">
<el-input
v-model="queryParams.realName"
placeholder="请输入姓名"
clearable
style="width: 240px;"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="手机号" prop="mobile">
<el-input
v-model="queryParams.mobile"
placeholder="请输入手机号"
clearable
style="width: 240px;"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="状态" prop="auditedStatus">
<el-select
v-model="queryParams.auditedStatus"
placeholder="状态"
clearable
style="width: 240px"
>
<el-option key="A" label="启用" value="A"/>
<el-option key="N" label="禁用" value="N"/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['staff:list']"
>新增员工</el-button>
</el-form-item>
</el-form>
<el-card >
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="员工类别" prop="category">
<el-select v-model="queryParams.category" clearable placeholder="请选择员工类别">
<el-option
v-for="item in categoryOptions"
:key="item.key"
:label="item.name"
:value="item.key"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="姓名" prop="name">
<el-input
v-model="queryParams.realName"
placeholder="请输入姓名"
clearable
style="width: 240px;"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="手机号" prop="mobile">
<el-input
v-model="queryParams.mobile"
placeholder="请输入手机号"
clearable
style="width: 240px;"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="状态" prop="auditedStatus">
<el-select
v-model="queryParams.auditedStatus"
placeholder="状态"
clearable
style="width: 240px"
>
<el-option key="A" label="启用" value="A"/>
<el-option key="N" label="禁用" value="N"/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
<el-row :gutter="10" class="mb8">
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
</el-form-item>
</el-form>
</el-card>
<el-table ref="tables" v-loading="loading" :data="list" @selection-change="handleSelectionChange" :default-sort="defaultSort" @sort-change="handleSortChange">
<el-table-column label="ID" align="center" prop="id" width="80" />
<el-table-column label="类别" align="center" prop="category">
<template slot-scope="scope">
<el-card style="margin-top: 20px" >
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
icon="el-icon-plus"
@click="handleAdd"
>新增员工</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table ref="tables" v-loading="loading" :data="list" @selection-change="handleSelectionChange" :default-sort="defaultSort" @sort-change="handleSortChange">
<el-table-column label="ID" align="center" prop="id" width="80" />
<el-table-column label="类别" align="center" prop="category">
<template slot-scope="scope">
<span v-if="scope.row.category">
<span>{{ getName(categoryOptions, scope.row.category) }}</span>
</span>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="姓名" align="center" prop="realName" />
<el-table-column label="手机号" align="center" prop="mobile" />
<el-table-column label="关联会员ID" align="center" prop="userId" />
<el-table-column label="所属店铺" align="center" prop="storeName">
<template slot-scope="scope">
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="姓名" align="center" prop="realName" />
<el-table-column label="手机号" align="center" prop="mobile" />
<el-table-column label="关联会员ID" align="center" prop="userId" />
<el-table-column label="所属店铺" align="center" prop="storeName">
<template slot-scope="scope">
<span v-if="scope.row.storeId">
<span>{{ getName(storeOptions, scope.row.storeId) }}</span>
</span>
<span v-else></span>
</template>
</el-table-column>
<el-table-column label="状态" align="center" prop="storeName">
<template slot-scope="scope">
<el-switch
v-model="scope.row.auditedStatus"
active-value="A"
inactive-value="N"
@change="handleStatusChange(scope.row)"
></el-switch>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="更新时间" align="center" prop="updateTime">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.updateTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
v-hasPermi="['staff:list']"
@click="handleUpdate(scope.row)"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
v-hasPermi="['staff:list']"
@click="handleDelete(scope.row)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<span v-else></span>
</template>
</el-table-column>
<el-table-column label="状态" align="center" prop="storeName">
<template slot-scope="scope">
<el-switch
v-model="scope.row.auditedStatus"
active-value="A"
inactive-value="N"
@change="handleStatusChange(scope.row)"
></el-switch>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="更新时间" align="center" prop="updateTime">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.updateTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
v-hasPermi="['staff:list']"
@click="handleUpdate(scope.row)"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
v-hasPermi="['staff:list']"
@click="handleDelete(scope.row)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.page"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.page"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</el-card>
<!-- 添加或修改对话框 -->
<el-dialog :title="title" :visible.sync="open" class="common-dialog" width="700px" append-to-body>
@ -204,6 +208,8 @@
<script>
import { getStaffList, getStaffInfo, updateStaffStatus, deleteStaff, saveStaff } from "@/api/staff";
import { searchStore } from "@/api/store";
import {getName} from "../../utils/fuint";
import {listStaff} from "@/api/staff/staff";
export default {
name: "StaffList",
@ -212,7 +218,7 @@ export default {
//
title: "",
//
loading: true,
loading: false,
//
ids: [],
//
@ -259,26 +265,36 @@ export default {
},
created() {
this.getList();
this.getStoreList();
// this.getStoreList();
},
methods: {
getName,
//
getList() {
this.loading = true;
getStaffList(this.addDateRange(this.queryParams, this.dateRange)).then( response => {
this.list = response.data.paginationResponse.content;
this.total = response.data.paginationResponse.totalElements;
this.categoryOptions = response.data.categoryList;
this.loading = false;
// this.loading = true;
listStaff().then(response => {
this.list = response.data.records;
this.total = response.data.total;
}
);
// getStaffList(this.addDateRange(this.queryParams, this.dateRange)).then( response => {
// this.list = response.data.paginationResponse.content;
// this.total = response.data.paginationResponse.totalElements;
// this.categoryOptions = response.data.categoryList;
// this.loading = false;
// }
// );
},
//
getStoreList() {
searchStore().then( response => {
this.storeOptions = response.data.storeList;
listStaff().then(response => {
this.storeOptions = response.data.records;
}
);
// searchStore().then(response => {
// this.storeOptions = response.data.storeList;
// }
// );
},
//
handleQuery() {

View File

@ -26,7 +26,7 @@ spring.redis.pool.min-idle=0
spring.redis.timeout=5000
# 系统名称
system.name = fuint会员营销管理系统
system.name = 蓝鲸智慧油站系统
# 前端h5地址
website.url=https://www.fuint.cn/h5/

View File

@ -126,6 +126,10 @@
<artifactId>IJPay-AliPay</artifactId>
<version>2.9.6</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
</dependencies>
<build>

View File

@ -0,0 +1,75 @@
package com.fuint.business.member.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.member.entity.LJStaff;
import com.fuint.business.member.service.ILJStaffService;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/business/member/staff")
public class LJStaffController extends BaseController {
@Autowired
private ILJStaffService mtStaffService;
/**
* 根据条件分页查询员工信息
* @param staff
* @param pageNo
* @param pageSize
* @return
*/
@GetMapping("/list")
public ResponseObject list(LJStaff staff,
@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize){
Page page =new Page(pageNo,pageSize);
IPage<LJStaff> list = mtStaffService.selectStaffList(page,staff);
return getSuccessResult(list);
}
/**
* 根据id查询员工信息
* @param id
* @return
*/
@GetMapping("/{id}")
public ResponseObject staffInfo(@PathVariable Integer id){
LJStaff staff = mtStaffService.selectStaffById(id);
return getSuccessResult(staff);
}
/**
* 批量删除员工信息
* @return
*/
@DeleteMapping("/id")
public ResponseObject remove(@PathVariable Integer id){
mtStaffService.removeById(id);
return getSuccessResult("操作成功");
}
/**
* 添加员工信息
* @param staff
* @return
*/
@PostMapping
public ResponseObject add(@Validated @RequestBody LJStaff staff){
return getSuccessResult(mtStaffService.insertStaff(staff));
}
/**
* 修改员工信息
* @param staff
* @return
*/
@PutMapping
public ResponseObject edit(@Validated @RequestBody LJStaff staff){
return getSuccessResult(mtStaffService.updateStaff(staff));
}
}

View File

@ -0,0 +1,58 @@
package com.fuint.business.member.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.util.Date;
/**
* 角色表
*
* Created by FSQ
* CopyRight https://www.fuint.cn
*/
@Getter
@Setter
@TableName("t_duty")
@ApiModel(value = "TDuty对象", description = "角色表")
public class LJDuty implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty("角色ID")
@TableId(value = "duty_id", type = IdType.AUTO)
private Integer dutyId;
@ApiModelProperty("商户ID")
private Integer merchantId;
@ApiModelProperty("角色名称")
private String dutyName;
@ApiModelProperty("状态(A: 可用 D: 禁用)")
private String status;
@ApiModelProperty("描述")
private String description;
@ApiModelProperty("角色类型")
private String dutyType;
@ApiModelProperty("创建时间")
private Date createTime;
@ApiModelProperty("修改时间")
private Date updateTime;
@ApiModelProperty("创建用户")
private Date createUser;
@ApiModelProperty("修改用户")
private Date updateUser;
}

View File

@ -0,0 +1,115 @@
package com.fuint.business.member.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fuint.framework.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.util.Date;
/**
* 店铺员工表
*
* Created by FSQ
* CopyRight https://www.fuint.cn
*/
@Getter
@Setter
@TableName("mt_staff")
@ApiModel(value = "MtStaff对象", description = "店铺员工表")
public class LJStaff extends BaseEntity implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty("自增ID")
@TableId(value = "ID", type = IdType.AUTO)
private Integer id;
@ApiModelProperty("员工类别")
private Integer category;
@ApiModelProperty("用户ID")
private Integer userId;
@ApiModelProperty("手机号码")
private String mobile;
@ApiModelProperty("真实姓名")
private String realName;
@ApiModelProperty("微信号")
private String wechat;
@ApiModelProperty("商户ID")
private Integer merchantId;
@ApiModelProperty("店铺ID")
private Integer storeId;
@ApiModelProperty("审核状态A审核通过U未审核D无效; ")
private String auditedStatus;
@ApiModelProperty("审核时间")
private Date auditedTime;
@ApiModelProperty("备注")
private String description;
@ApiModelProperty("一键加油: 显示、隐藏")
private String isRefuel;
@ApiModelProperty("交班模式:当前门店统一交班;当前账户交班;指定商户号交班")
private String handoverMode;
@ApiModelProperty("交班权限,有权限;没有权限")
private String handoverPrem;
@ApiModelProperty("交班退出:交班退出;交班不退出")
private String out;
@ApiModelProperty("交班记录,全部记录;名下记录;禁用权限")
private String record;
@ApiModelProperty("交班商户号,启用;禁用")
private String merchantStatus;
@ApiModelProperty("员工筛选,启用;禁用")
private String screen;
@ApiModelProperty("POS权限")
private String posPrem;
@ApiModelProperty("小程序权限")
private String appletPrem;
@ApiModelProperty("收款通知(模板通知),禁用;全部交易;名下交易;指定邮箱")
private String notice;
@ApiModelProperty("模板油枪号,对应油枪号信息,当收款通知选择指定邮箱时才可选择")
private String oilGunId;
@ApiModelProperty("时间范围1不限2当天33天内47天内530天内6当月7当前班次")
private String timeFrame;
@ApiModelProperty("退款权限,有权限;无权限")
private String refund;
@ApiModelProperty("交易统计1全部交易2名下交易")
private String transaction;
@ApiModelProperty("核销权限1洗车卡券2兑换券")
private String writeOff;
@ApiModelProperty("特殊权限1PC后台管理2POS收银系统3PC收银权限4小程序端报表")
private String specialPrem;
@ApiModelProperty("公众号1未关注2已关注")
private String official;
}

View File

@ -0,0 +1,61 @@
package com.fuint.business.member.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.member.entity.LJStaff;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
/**
* 店铺员工表 Mapper 接口
*
* Created by FSQ
* CopyRight https://www.fuint.cn
*/
@Mapper
public interface LJStaffMapper extends BaseMapper<LJStaff> {
/**
* 根据条件分页查询员工信息
* @param page
* @param staff
* @return
*/
public IPage<LJStaff> selectLJStaffList(Page page, @Param("staff") LJStaff staff);
/**
* 根据id查询员工信息
* @param id
* @return
*/
public LJStaff selectLJStaffById(@Param("id") int id);
/**
* 根据id删除员工信息
* @param id
* @return
*/
public int deleteStaffById(@Param("id") int id);
/**
* 添加员工信息
* @param staff
* @return
*/
public int insertStaff(LJStaff staff);
/**
* 修改员工信息
* @param staff
* @return
*/
public int updateStaff(LJStaff staff);
int updateStatus(@Param("id") Integer id, @Param("status") String status, @Param("updateTime") Date updateTime);
LJStaff queryStaffByMobile(@Param("mobile") String mobile);
LJStaff queryStaffByUserId(@Param("userId") Integer userId);
}

View File

@ -0,0 +1,149 @@
<?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.fuint.business.member.mapper.LJStaffMapper">
<resultMap type="com.fuint.business.member.entity.LJStaff" id="LJStaffResult">
<id property="id" column="id" />
<result property="merchantId" column="merchant_id" />
<result property="storeId" column="store_id" />
<result property="userId" column="user_id" />
<result property="category" column="category" />
<result property="mobile" column="mobile" />
<result property="realName" column="real_name" />
<result property="wechat" column="wechat" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="auditedStatus" column="audited_status" />
<result property="auditedTime" column="audited_time" />
<result property="description" column="description" />
<result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" />
<result property="isRefuel" column="is_refuel" />
<result property="handoverMode" column="handover_mode" />
<result property="handoverPrem" column="handover_prem" />
<result property="handoverPrem" column="handover_prem" />
<result property="out" column="out" />
<result property="record" column="record" />
<result property="merchantStatus" column="merchant_status" />
<result property="screen" column="screen" />
<result property="posPrem" column="pos_prem" />
<result property="appletPrem" column="applet_prem" />
<result property="notice" column="notice" />
<result property="oilGunId" column="oil_gun_id" />
<result property="timeFrame" column="time_frame" />
<result property="refund" column="refund" />
<result property="transaction" column="transaction" />
<result property="writeOff" column="write_off" />
<result property="specialPrem" column="special_prem" />
<result property="official" column="official" />
</resultMap>
<sql id="selectMtStaff">
select id, merchant_id, store_id, user_id, category, mobile, real_name, wechat, create_time, update_time,
audited_status, audited_time, description, create_by, update_by, is_refuel, handover_mode, handover_prem,
`out`, record, merchant_status, screen, pos_prem, applet_prem, notice, oil_gun_id, time_frame, refund, transaction,
write_off, special_prem, official from mt_staff
</sql>
<!--根据条件分页查询用户信息-->
<select id="selectLJStaffList" resultMap="LJStaffResult">
<include refid="selectMtStaff"></include>
<where>
<if test="staff.realName != null and staff.realName != ''">
and real_name like concat('%', #{staff.realName}, '%')
</if>
<if test="staff.mobile != null and staff.mobile != ''">
and mobile like concat('%', #{staff.mobile}, '%')
</if>
</where>
</select>
<!--根据id查询员工信息-->
<select id="selectLJStaffById" resultMap="LJStaffResult">
<include refid="selectMtStaff"></include>
where id = #{id}
</select>
<!--根据id查询员工信息-->
<select id="deleteStaffById">
delete from mt_staff where id = #{id}
</select>
<!--增加员工信息-->
<insert id="insertStaff">
insert into mt_staff(
<if test="merchantId != null">merchant_id,</if>
<if test="storeId != null">store_id,</if>
<if test="userId != null">user_id,</if>
<if test="category != null">category,</if>
<if test="mobile != null and mobile != ''">mobile,</if>
<if test="realName != null and realName != ''">real_name,</if>
<if test="wechat != null and wechat != ''">wechat,</if>
<if test="updateTime != null and updateTime != ''">update_time,</if>
<if test="auditedStatus != null and auditedStatus != ''">audited_status,</if>
<if test="auditedTime != null and auditedTime != ''">audited_time,</if>
<if test="description != null and description != ''">description,</if>
<if test="createUser != null and createUser != ''">create_user,</if>
<if test="updateUser != null and updateUser != ''">update_user,</if>
<if test="isRefuel != null and isRefuel != ''">is_refuel,</if>
<if test="handoverMode != null and handoverMode != ''">handover_mode,</if>
<if test="handoverPrem != null and handoverPrem != ''">handover_prem,</if>
<if test="out != null and out != ''">out,</if>
<if test="record != null and record != ''">record,</if>
<if test="merchantStatus != null and merchantStatus != ''">merchant_status,</if>
<if test="screen != null and screen != ''">screen,</if>
<if test="posPrem != null and posPrem != ''">pos_prem,</if>
<if test="appletPrem != null and appletPrem != ''">applet_prem,</if>
<if test="notice != null and notice != ''">notice,</if>
<if test="oilGunId != null and oilGunId != ''">oil_gun_id,</if>
<if test="timeFrame != null and timeFrame != ''">time_frame,</if>
<if test="refund != null and refund != ''">refund,</if>
<if test="transaction != null and transaction != ''">transaction,</if>
<if test="writeOff != null and writeOff != ''">write_off,</if>
<if test="specialPrem != null and specialPrem != ''">special_prem,</if>
<if test="official != null and official != ''">official,</if>
create_time
)values (
<if test="merchantId != null">#{merchantId},</if>
<if test="storeId != null">#{storeId},</if>
<if test="userId != null">#{userId},</if>
<if test="category != null">#{category},</if>
<if test="mobile != null and mobile != ''">#{mobile},</if>
<if test="realName != null and realName != ''">#{realName},</if>
<if test="wechat != null and wechat != ''">#{wechat},</if>
<if test="updateTime != null and updateTime != ''">#{updateTime},</if>
<if test="auditedStatus != null and auditedStatus != ''">#{auditedStatus},</if>
<if test="auditedTime != null and auditedTime != ''">#{auditedTime},</if>
<if test="description != null and description != ''">#{description},</if>
<if test="createUser != null and createUser != ''">#{createUser},</if>
<if test="updateUser != null and updateUser != ''">#{updateUser},</if>
<if test="isRefuel != null and isRefuel != ''">#{isRefuel},</if>
<if test="handoverMode != null and handoverMode != ''">#{handoverMode},</if>
<if test="handoverPrem != null and handoverPrem != ''">#{handoverPrem},</if>
<if test="out != null and out != ''">#{out},</if>
<if test="record != null and record != ''">#{record},</if>
<if test="merchantStatus != null and merchantStatus != ''">#{merchantStatus},</if>
<if test="screen != null and screen != ''">#{screen},</if>
<if test="posPrem != null and posPrem != ''">#{posPrem},</if>
<if test="appletPrem != null and appletPrem != ''">#{appletPrem},</if>
<if test="notice != null and notice != ''">#{notice},</if>
<if test="oilGunId != null and oilGunId != ''">#{oilGunId},</if>
<if test="timeFrame != null and timeFrame != ''">#{time_frame},</if>
<if test="refund != null and refund != ''">#{refund},</if>
<if test="transaction != null and transaction != ''">#{transaction},</if>
<if test="writeOff != null and writeOff != ''">#{write_off},</if>
<if test="specialPrem != null and specialPrem != ''">#{special_prem},</if>
<if test="official != null and official != ''">#{official},</if>
sysdate()
)
</insert>
<!-- 修改员工信息-->
<update id="updateStaff"></update>
<update id="updateStatus">
update mt_staff p set p.AUDITED_STATUS = #{status}, p.UPDATE_TIME = #{updateTime} where p.ID = #{id}
</update>
<select id="queryStaffByMobile" resultType="com.fuint.repository.model.MtStaff">
select * from mt_staff t where t.MOBILE = #{mobile} and t.AUDITED_STATUS != 'D'
</select>
<select id="queryStaffByUserId" resultType="com.fuint.repository.model.MtStaff">
select * from mt_staff t where t.USER_ID = #{userId} and t.AUDITED_STATUS != 'D'
</select>
</mapper>

View File

@ -0,0 +1,40 @@
package com.fuint.business.member.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fuint.business.member.entity.LJStaff;
/**
* 员工管理 业务层
*/
public interface ILJStaffService extends IService<LJStaff> {
/**
* 根据条件分页查询员工信息
* @param page
* @return
*/
public IPage<LJStaff> selectStaffList(Page page, LJStaff LJStaff);
/**
* 根据id查询员工信息
* @param id
* @return
*/
public LJStaff selectStaffById(int id);
/**
* 批量删除员工信息
* @param ids
*/
public void deleteStaffByIds(Integer[] ids);
/**
* 增加员工信息
* @param staff
* @return
*/
public int insertStaff(LJStaff staff);
public int updateStaff(LJStaff staff);
}

View File

@ -0,0 +1,72 @@
package com.fuint.business.member.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.member.entity.LJStaff;
import com.fuint.business.member.mapper.LJStaffMapper;
import com.fuint.business.member.service.ILJStaffService;
import org.springframework.stereotype.Service;
import java.util.Date;
/**
* 员工管理 业务层
*/
@Service
public class LJStaffServiceImpl extends ServiceImpl<LJStaffMapper, LJStaff> implements ILJStaffService {
/**
* 根据条件分页查询员工信息
* @param page
* @param staff
* @return
*/
@Override
public IPage<LJStaff> selectStaffList(Page page, LJStaff staff) {
return baseMapper.selectLJStaffList(page,staff);
}
/**
* 根据id查询员工信息
* @param id
* @return
*/
@Override
public LJStaff selectStaffById(int id) {
return baseMapper.selectById(id);
}
/**
* 根据id批量删除员工信息
* @param ids
*/
@Override
public void deleteStaffByIds(Integer[] ids) {
for (int id : ids){
baseMapper.deleteById(id);
}
}
/**
* 添加用户信息
* @param staff
* @return
*/
@Override
public int insertStaff(LJStaff staff) {
staff.setCreateTime(new Date());
int row = baseMapper.insert(staff);
return row;
}
/**
* 修改用户信息
* @param staff
* @return
*/
@Override
public int updateStaff(LJStaff staff) {
int row = baseMapper.updateById(staff);
return row;
}
}

View File

@ -0,0 +1,88 @@
package com.fuint.business.store.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.api.ApiController;
import com.baomidou.mybatisplus.extension.api.R;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.store.entity.ChainStoreInfo;
import com.fuint.business.store.service.ChainStoreInfoService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.io.Serializable;
import java.util.List;
/**
* (ChainStoreInfo)表控制层
*
* @author makejava
* @since 2023-10-11 13:17:02
*/
@RestController
@RequestMapping("chainStoreInfo")
public class ChainStoreInfoController extends ApiController {
/**
* 服务对象
*/
@Resource
private ChainStoreInfoService chainStoreInfoService;
/**
* 分页查询所有数据
*
* @param page 分页对象
* @param chainStoreInfo 查询实体
* @return 所有数据
*/
@GetMapping
public R selectAll(Page<ChainStoreInfo> page, ChainStoreInfo chainStoreInfo) {
return success(this.chainStoreInfoService.page(page, new QueryWrapper<>(chainStoreInfo)));
}
/**
* 通过主键查询单条数据
*
* @param id 主键
* @return 单条数据
*/
@GetMapping("{id}")
public R selectOne(@PathVariable Serializable id) {
return success(this.chainStoreInfoService.getById(id));
}
/**
* 新增数据
*
* @param chainStoreInfo 实体对象
* @return 新增结果
*/
@PostMapping
public R insert(@RequestBody ChainStoreInfo chainStoreInfo) {
return success(this.chainStoreInfoService.save(chainStoreInfo));
}
/**
* 修改数据
*
* @param chainStoreInfo 实体对象
* @return 修改结果
*/
@PutMapping
public R update(@RequestBody ChainStoreInfo chainStoreInfo) {
return success(this.chainStoreInfoService.updateById(chainStoreInfo));
}
/**
* 删除数据
*
* @param idList 主键结合
* @return 删除结果
*/
@DeleteMapping
public R delete(@RequestParam("idList") List<Long> idList) {
return success(this.chainStoreInfoService.removeByIds(idList));
}
}

View File

@ -0,0 +1,127 @@
package com.fuint.business.store.entity;
import java.util.Date;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import java.io.Serializable;
/**
* (ChainStoreInfo)表实体类
*
* @author makejava
* @since 2023-10-11 13:17:02
*/
@SuppressWarnings("serial")
public class ChainStoreInfo extends Model<ChainStoreInfo> {
//主键
private Integer id;
//连锁店名称
private String storeName;
//总店地址
private String storeAddress;
//总店联系方式
private String storePhone;
//总店经度
private String storeLat;
//总店纬度
private String storeLng;
//创建时间
private Date createTime;
//创建人
private String createBy;
//更新时间
private Date updateTime;
//更新人
private String updateBy;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getStoreName() {
return storeName;
}
public void setStoreName(String storeName) {
this.storeName = storeName;
}
public String getStoreAddress() {
return storeAddress;
}
public void setStoreAddress(String storeAddress) {
this.storeAddress = storeAddress;
}
public String getStorePhone() {
return storePhone;
}
public void setStorePhone(String storePhone) {
this.storePhone = storePhone;
}
public String getStoreLat() {
return storeLat;
}
public void setStoreLat(String storeLat) {
this.storeLat = storeLat;
}
public String getStoreLng() {
return storeLng;
}
public void setStoreLng(String storeLng) {
this.storeLng = storeLng;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getUpdateBy() {
return updateBy;
}
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy;
}
/**
* 获取主键值
*
* @return 主键值
*/
@Override
protected Serializable pkVal() {
return this.id;
}
}

View File

@ -0,0 +1,15 @@
package com.fuint.business.store.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fuint.business.store.entity.ChainStoreInfo;
/**
* (ChainStoreInfo)表数据库访问层
*
* @author makejava
* @since 2023-10-11 13:17:02
*/
public interface ChainStoreInfoMapper extends BaseMapper<ChainStoreInfo> {
}

View File

@ -0,0 +1,6 @@
<?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.fuint.business.store.mapper.ChainStoreInfoMapper">
</mapper>

View File

@ -0,0 +1,15 @@
package com.fuint.business.store.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fuint.business.store.entity.ChainStoreInfo;
/**
* (ChainStoreInfo)表服务接口
*
* @author makejava
* @since 2023-10-11 13:17:02
*/
public interface ChainStoreInfoService extends IService<ChainStoreInfo> {
}

View File

@ -0,0 +1,19 @@
package com.fuint.business.store.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.store.mapper.ChainStoreInfoMapper;
import com.fuint.business.store.entity.ChainStoreInfo;
import com.fuint.business.store.service.ChainStoreInfoService;
import org.springframework.stereotype.Service;
/**
* (ChainStoreInfo)表服务实现类
*
* @author makejava
* @since 2023-10-11 13:17:02
*/
@Service("chainStoreInfoService")
public class ChainStoreInfoServiceImpl extends ServiceImpl<ChainStoreInfoMapper, ChainStoreInfo> implements ChainStoreInfoService {
}

View File

@ -4,6 +4,7 @@ import java.io.Serializable;
import java.util.List;
import java.util.stream.Collectors;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fuint.system.dept.entity.SysDept;
/**
* TreeSelect树结构实体类
@ -25,10 +26,17 @@ public class TreeSelect implements Serializable {
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<TreeSelect> childrens;
public TreeSelect() {
// empty
public TreeSelect()
{
}
public TreeSelect(SysDept dept)
{
this.id = dept.getDeptId();
this.label = dept.getDeptName();
this.childrens = dept.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
}
public TreeSelect(TreeNode menu) {
this.id = menu.getId();
this.label = menu.getName();

View File

@ -1,5 +1,6 @@
package com.fuint.common.dto;
import com.fuint.framework.entity.BaseEntity;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@ -11,7 +12,7 @@ import java.util.Date;
* CopyRight https://www.fuint.cn
*/
@Data
public class AccountInfo implements Serializable {
public class AccountInfo implements Serializable {
private Integer id;
private String accountKey;
@ -30,6 +31,8 @@ public class AccountInfo implements Serializable {
private Integer storeId;
private String storeName;
private Integer staffId;
//部门主键
private Long deptId;
private String token;
}

View File

@ -1,5 +1,7 @@
package com.fuint.common.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fuint.common.dto.AccountDto;
import com.fuint.common.dto.AccountInfo;
@ -25,6 +27,7 @@ public interface AccountService extends IService<TAccount> {
* @return
*/
PaginationResponse<AccountDto> getAccountListByPagination(PaginationRequest paginationRequest) throws BusinessCheckException;
IPage<TAccount> listAccount(Page page,TAccount accountInfo);
/**
* 根据用户名获取用户对象

View File

@ -1,12 +1,14 @@
package com.fuint.common.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.common.dto.AccountDto;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.service.AccountService;
import com.fuint.common.service.StaffService;
import com.fuint.common.util.TokenUtil;
import com.fuint.framework.annoation.OperationServiceLog;
import com.fuint.framework.exception.BusinessCheckException;
import com.fuint.framework.exception.BusinessRuntimeException;
@ -14,6 +16,8 @@ import com.fuint.framework.pagination.PaginationRequest;
import com.fuint.framework.pagination.PaginationResponse;
import com.fuint.repository.mapper.*;
import com.fuint.repository.model.*;
import com.fuint.system.dept.entity.SysDept;
import com.fuint.system.dept.service.ISysDeptService;
import com.fuint.utils.Digests;
import com.fuint.utils.Encodes;
import com.github.pagehelper.Page;
@ -58,6 +62,8 @@ public class AccountServiceImpl extends ServiceImpl<TAccountMapper, TAccount> im
*/
@Autowired
private StaffService staffService;
@Autowired
private ISysDeptService deptService;
/**
* 分页查询账号列表
@ -121,6 +127,13 @@ public class AccountServiceImpl extends ServiceImpl<TAccountMapper, TAccount> im
return paginationResponse;
}
@Override
public IPage<TAccount> listAccount(com.baomidou.mybatisplus.extension.plugins.pagination.Page page, TAccount accountInfo) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
SysDept sysDept = deptService.selectDeptById(nowAccountInfo.getDeptId());
return baseMapper.listAccount(page, accountInfo,sysDept.getAncestors());
}
@Override
public AccountInfo getAccountByName(String userName) {
Map<String, Object> param = new HashMap();
@ -136,6 +149,7 @@ public class AccountServiceImpl extends ServiceImpl<TAccountMapper, TAccount> im
accountInfo.setStaffId(account.getStaffId());
accountInfo.setStoreId(account.getStoreId());
accountInfo.setMerchantId(account.getMerchantId());
accountInfo.setDeptId(account.getDeptId());
if (account.getMerchantId() != null && account.getMerchantId() > 0) {
MtMerchant mtMerchant = mtMerchantMapper.selectById(account.getMerchantId());
if (mtMerchant != null) {
@ -178,8 +192,8 @@ public class AccountServiceImpl extends ServiceImpl<TAccountMapper, TAccount> im
account.setStaffId(tAccount.getStaffId());
account.setMerchantId(tAccount.getMerchantId());
account.setStoreId(tAccount.getStoreId());
account.setCreateDate(new Date());
account.setModifyDate(new Date());
account.setCreateTime(new Date());
account.setUpdateTime(new Date());
account.setStoreId(tAccount.getStoreId());
account.setStaffId(tAccount.getStaffId());
account.setPassword(tAccount.getPassword());
@ -228,7 +242,7 @@ public class AccountServiceImpl extends ServiceImpl<TAccountMapper, TAccount> im
if (oldAccount == null) {
throw new BusinessCheckException("账户不存在.");
}
tAccount.setModifyDate(new Date());
tAccount.setUpdateTime(new Date());
if (duties != null && duties.size() > 0) {
if (tAccount.getAcctId() != null && tAccount.getAcctId() > 0) {
tAccountDutyMapper.deleteDutiesByAccountId(tAccount.getAcctId());
@ -283,7 +297,7 @@ public class AccountServiceImpl extends ServiceImpl<TAccountMapper, TAccount> im
public void deleteAccount(Long userId) {
TAccount tAccount = tAccountMapper.selectById(userId);
tAccount.setAccountStatus(-1);
tAccount.setModifyDate(new Date());
tAccount.setUpdateTime(new Date());
tAccountMapper.updateById(tAccount);
}

View File

@ -0,0 +1,126 @@
package com.fuint.system.dept.controller;
import com.fuint.common.constant.UserConstants;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.StringUtils;
import com.fuint.common.util.TokenUtil;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import com.fuint.system.dept.entity.SysDept;
import com.fuint.system.dept.service.ISysDeptService;
import lombok.extern.java.Log;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 部门信息
*
* @author ruoyi
*/
@RestController
@RequestMapping("/system/dept")
public class SysDeptController extends BaseController
{
@Autowired
private ISysDeptService deptService;
/**
* 获取部门列表
*/
@GetMapping("/list")
public ResponseObject list(SysDept dept)
{
List<SysDept> depts = deptService.selectDeptList(dept);
return getSuccessResult(depts);
}
/**
* 查询部门列表排除节点
*/
@GetMapping("/list/exclude/{deptId}")
public ResponseObject excludeChild(@PathVariable(value = "deptId", required = false) Long deptId)
{
List<SysDept> depts = deptService.selectDeptList(new SysDept());
depts.removeIf(d -> d.getDeptId().intValue() == deptId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""));
return getSuccessResult(depts);
}
/**
* 根据部门编号获取详细信息
*/
@GetMapping(value = "/{deptId}")
public ResponseObject getInfo(@PathVariable Long deptId)
{
return getSuccessResult(deptService.selectDeptById(deptId));
}
/**
* 新增部门
*/
@PostMapping("/add")
public ResponseObject add(@Validated @RequestBody SysDept dept)
{
if (!deptService.checkDeptNameUnique(dept))
{
return getFailureResult("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
}
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
dept.setCreateBy(nowAccountInfo.getId().toString());
return getSuccessResult(deptService.insertDept(dept));
}
/**
* 修改部门
*/
@PostMapping("/edit")
public ResponseObject edit(@Validated @RequestBody SysDept dept)
{
Long deptId = dept.getDeptId();
if (!deptService.checkDeptNameUnique(dept))
{
return getFailureResult("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
}
else if (dept.getParentId().equals(deptId))
{
return getFailureResult("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
}
else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0)
{
return getFailureResult("该部门包含未停用的子部门!");
}
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
dept.setCreateBy(nowAccountInfo.getId().toString());
return getSuccessResult(deptService.updateDept(dept));
}
/**
* 删除部门
*/
@DeleteMapping("/{deptId}")
public ResponseObject remove(@PathVariable Long deptId)
{
if (deptService.hasChildByDeptId(deptId))
{
return getFailureResult("存在下级部门,不允许删除");
}
if (deptService.checkDeptExistUser(deptId))
{
return getFailureResult("部门存在用户,不允许删除");
}
return getSuccessResult(deptService.deleteDeptById(deptId));
}
/**
* 获取部门树列表
*/
@GetMapping("/deptTree")
public ResponseObject deptTree(SysDept dept)
{
return getSuccessResult(deptService.selectDeptTreeList(dept));
}
}

View File

@ -0,0 +1,64 @@
package com.fuint.system.dept.entity;
import com.fuint.framework.entity.BaseEntity;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.ArrayList;
import java.util.List;
/**
* 部门表 sys_dept
*
* @author ruoyi
*/
@Data
public class SysDept extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 部门ID */
private Long deptId;
/** 父部门ID */
private Long parentId;
/** 祖级列表 */
private String ancestors;
/** 部门名称 */
private String deptName;
/** 显示顺序 */
private Integer orderNum;
//节点类型:1代理商2连锁店3基本门店
private String deptType;
/** 负责人 */
private Integer leaderAccountId;
/** 联系电话 */
private String phone;
/** 邮箱 */
private String email;
/** 部门状态:0正常,1停用 */
private String status;
/** 删除标志0代表存在 2代表删除 */
private String delFlag;
/** 父部门名称 */
private String parentName;
/** 子部门 */
private List<SysDept> children = new ArrayList<SysDept>();
}

View File

@ -0,0 +1,120 @@
package com.fuint.system.dept.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fuint.system.dept.entity.SysDept;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 部门管理 数据层
*
* @author ruoyi
*/
public interface SysDeptMapper extends BaseMapper<SysDept>
{
/**
* 查询部门管理数据
*
* @param dept 部门信息
* @return 部门信息集合
*/
public List<SysDept> selectDeptList(@Param("dept") SysDept dept,@Param("ownDeptStr") String ownDeptStr);
/**
* 根据角色ID查询部门树信息
*
* @param roleId 角色ID
* @param deptCheckStrictly 部门树选择项是否关联显示
* @return 选中部门列表
*/
public List<Long> selectDeptListByRoleId(@Param("roleId") Long roleId, @Param("deptCheckStrictly") boolean deptCheckStrictly);
/**
* 根据部门ID查询信息
*
* @param deptId 部门ID
* @return 部门信息
*/
public SysDept selectDeptById(Long deptId);
/**
* 根据ID查询所有子部门
*
* @param deptId 部门ID
* @return 部门列表
*/
public List<SysDept> selectChildrenDeptById(Long deptId);
/**
* 根据ID查询所有子部门正常状态
*
* @param deptId 部门ID
* @return 子部门数
*/
public int selectNormalChildrenDeptById(Long deptId);
/**
* 是否存在子节点
*
* @param deptId 部门ID
* @return 结果
*/
public int hasChildByDeptId(Long deptId);
/**
* 查询部门是否存在用户
*
* @param deptId 部门ID
* @return 结果
*/
public int checkDeptExistUser(Long deptId);
/**
* 校验部门名称是否唯一
*
* @param deptName 部门名称
* @param parentId 父部门ID
* @return 结果
*/
public SysDept checkDeptNameUnique(@Param("deptName") String deptName, @Param("parentId") Long parentId);
/**
* 新增部门信息
*
* @param dept 部门信息
* @return 结果
*/
public int insertDept(SysDept dept);
/**
* 修改部门信息
*
* @param dept 部门信息
* @return 结果
*/
public int updateDept(SysDept dept);
/**
* 修改所在部门正常状态
*
* @param deptIds 部门ID组
*/
public void updateDeptStatusNormal(Long[] deptIds);
/**
* 修改子元素关系
*
* @param depts 子元素
* @return 结果
*/
public int updateDeptChildren(@Param("depts") List<SysDept> depts);
/**
* 删除部门管理信息
*
* @param deptId 部门ID
* @return 结果
*/
public int deleteDeptById(Long deptId);
}

View File

@ -0,0 +1,140 @@
<?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.fuint.system.dept.mapper.SysDeptMapper">
<select id="selectDeptList" resultType="com.fuint.system.dept.entity.SysDept">
select *
from sys_dept d
where d.del_flag = '0'
<if test="dept.deptId != null and dept.deptId != 0">
AND dept_id = #{dept.deptId}
</if>
<if test="dept.parentId != null and dept.parentId != 0">
AND parent_id = #{dept.parentId}
</if>
<if test="dept.deptName != null and dept.deptName != ''">
AND dept_name like concat('%', #{dept.deptName}, '%')
</if>
<if test="dept.status != null and dept.status != ''">
AND status = #{dept.status}
</if>
<!-- 数据范围过滤 -->
<if test="ownDeptStr != null and ownDeptStr!=''">
AND ancestors like concat (#{ownDeptStr},'%')
</if>
order by d.parent_id, d.order_num
</select>
<select id="selectDeptListByRoleId" resultType="Long">
select d.dept_id
from sys_dept d
left join sys_role_dept rd on d.dept_id = rd.dept_id
where rd.role_id = #{roleId}
<if test="deptCheckStrictly">
and d.dept_id not in (select d.parent_id from sys_dept d inner join sys_role_dept rd on d.dept_id = rd.dept_id and rd.role_id = #{roleId})
</if>
order by d.parent_id, d.order_num
</select>
<select id="selectDeptById" parameterType="Long" resultType="com.fuint.system.dept.entity.SysDept">
select d.*,
(select dept_name from sys_dept where dept_id = d.parent_id) parent_name
from sys_dept d
where d.dept_id = #{deptId}
</select>
<select id="checkDeptExistUser" parameterType="Long" resultType="int">
select count(1) from t_account where dept_id = #{deptId}
</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" resultType="com.fuint.system.dept.entity.SysDept">
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" resultType="com.fuint.system.dept.entity.SysDept">
select *
from sys_dept
where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1
</select>
<insert id="insertDept">
insert into sys_dept(
<if test="parentId != null and parentId != 0">parent_id,</if>
<if test="deptName != null and deptName != ''">dept_name,</if>
<if test="ancestors != null and ancestors != ''">ancestors,</if>
<if test="orderNum != null">order_num,</if>
<if test="leader != null and leader != ''">leader,</if>
<if test="phone != null and phone != ''">phone,</if>
<if test="email != null and email != ''">email,</if>
<if test="status != null">status,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)values(
<if test="parentId != null and parentId != 0">#{parentId},</if>
<if test="deptName != null and deptName != ''">#{deptName},</if>
<if test="ancestors != null and ancestors != ''">#{ancestors},</if>
<if test="orderNum != null">#{orderNum},</if>
<if test="leader != null and leader != ''">#{leader},</if>
<if test="phone != null and phone != ''">#{phone},</if>
<if test="email != null and email != ''">#{email},</if>
<if test="status != null">#{status},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert>
<update id="updateDept">
update sys_dept
<set>
<if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>
<if test="deptName != null and deptName != ''">dept_name = #{deptName},</if>
<if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if>
<if test="orderNum != null">order_num = #{orderNum},</if>
<if test="leader != null">leader = #{leader},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="email != null">email = #{email},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate()
</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"
separator=" " open="case dept_id" close="end">
when #{item.deptId} then #{item.ancestors}
</foreach>
where dept_id in
<foreach collection="depts" item="item" index="index"
separator="," open="(" close=")">
#{item.deptId}
</foreach>
</update>
<update id="updateDeptStatusNormal" parameterType="Long">
update sys_dept set status = '0' where dept_id in
<foreach collection="array" item="deptId" open="(" separator="," close=")">
#{deptId}
</foreach>
</update>
<delete id="deleteDeptById" parameterType="Long">
update sys_dept set del_flag = '2' where dept_id = #{deptId}
</delete>
</mapper>

View File

@ -0,0 +1,114 @@
package com.fuint.system.dept.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fuint.common.domain.TreeSelect;
import com.fuint.system.dept.entity.SysDept;
import java.util.List;
/**
* 部门管理 服务层
*
* @author ruoyi
*/
public interface ISysDeptService extends IService<SysDept>
{
/**
* 查询部门管理数据
*
* @param dept 部门信息
* @return 部门信息集合
*/
public List<SysDept> selectDeptList(SysDept dept);
/**
* 查询部门树结构信息
*
* @param dept 部门信息
* @return 部门树信息集合
*/
public List<TreeSelect> selectDeptTreeList(SysDept dept);
/**
* 构建前端所需要树结构
*
* @param depts 部门列表
* @return 树结构列表
*/
public List<SysDept> buildDeptTree(List<SysDept> depts);
/**
* 构建前端所需要下拉树结构
*
* @param depts 部门列表
* @return 下拉树结构列表
*/
public List<TreeSelect> buildDeptTreeSelect(List<SysDept> depts);
/**
* 根据部门ID查询信息
*
* @param deptId 部门ID
* @return 部门信息
*/
public SysDept selectDeptById(Long deptId);
/**
* 根据ID查询所有子部门正常状态
*
* @param deptId 部门ID
* @return 子部门数
*/
public int selectNormalChildrenDeptById(Long deptId);
/**
* 是否存在部门子节点
*
* @param deptId 部门ID
* @return 结果
*/
public boolean hasChildByDeptId(Long deptId);
/**
* 查询部门是否存在用户
*
* @param deptId 部门ID
* @return 结果 true 存在 false 不存在
*/
public boolean checkDeptExistUser(Long deptId);
/**
* 校验部门名称是否唯一
*
* @param dept 部门信息
* @return 结果
*/
public boolean checkDeptNameUnique(SysDept dept);
/**
* 新增保存部门信息
*
* @param dept 部门信息
* @return 结果
*/
public int insertDept(SysDept dept);
/**
* 修改保存部门信息
*
* @param dept 部门信息
* @return 结果
*/
public int updateDept(SysDept dept);
/**
* 删除部门管理信息
*
* @param deptId 部门ID
* @return 结果
*/
public int deleteDeptById(Long deptId);
}

View File

@ -0,0 +1,304 @@
package com.fuint.system.dept.service.impl;
import com.aliyun.oss.ServiceException;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.common.constant.UserConstants;
import com.fuint.common.domain.TreeSelect;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.Convert;
import com.fuint.common.util.SpringUtils;
import com.fuint.common.util.StringUtils;
import com.fuint.common.util.TokenUtil;
import com.fuint.system.dept.entity.SysDept;
import com.fuint.system.dept.mapper.SysDeptMapper;
import com.fuint.system.dept.service.ISysDeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;
/**
* 部门管理 服务实现
*
* @author ruoyi
*/
@Service
public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper,SysDept> implements ISysDeptService
{
/**
* 查询部门管理数据
*
* @param dept 部门信息
* @return 部门信息集合
*/
@Override
public List<SysDept> selectDeptList(SysDept dept)
{
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
SysDept sysDept = baseMapper.selectDeptById(nowAccountInfo.getDeptId());
return baseMapper.selectDeptList(dept,sysDept.getAncestors());
}
/**
* 查询部门树结构信息
*
* @param dept 部门信息
* @return 部门树信息集合
*/
@Override
public List<TreeSelect> selectDeptTreeList(SysDept dept)
{
List<SysDept> depts = this.selectDeptList(dept);
return buildDeptTreeSelect(depts);
}
/**
* 构建前端所需要树结构
*
* @param depts 部门列表
* @return 树结构列表
*/
@Override
public List<SysDept> buildDeptTree(List<SysDept> depts)
{
List<SysDept> returnList = new ArrayList<SysDept>();
List<Long> tempList = depts.stream().map(SysDept::getDeptId).collect(Collectors.toList());
for (SysDept dept : depts)
{
// 如果是顶级节点, 遍历该父节点的所有子节点
if (!tempList.contains(dept.getParentId()))
{
recursionFn(depts, dept);
returnList.add(dept);
}
}
if (returnList.isEmpty())
{
returnList = depts;
}
return returnList;
}
/**
* 构建前端所需要下拉树结构
*
* @param depts 部门列表
* @return 下拉树结构列表
*/
@Override
public List<TreeSelect> buildDeptTreeSelect(List<SysDept> depts)
{
List<SysDept> deptTrees = buildDeptTree(depts);
return deptTrees.stream().map(TreeSelect::new).collect(Collectors.toList());
}
/**
* 根据部门ID查询信息
*
* @param deptId 部门ID
* @return 部门信息
*/
@Override
public SysDept selectDeptById(Long deptId)
{
return baseMapper.selectDeptById(deptId);
}
/**
* 根据ID查询所有子部门正常状态
*
* @param deptId 部门ID
* @return 子部门数
*/
@Override
public int selectNormalChildrenDeptById(Long deptId)
{
return baseMapper.selectNormalChildrenDeptById(deptId);
}
/**
* 是否存在子节点
*
* @param deptId 部门ID
* @return 结果
*/
@Override
public boolean hasChildByDeptId(Long deptId)
{
int result = baseMapper.hasChildByDeptId(deptId);
return result > 0;
}
/**
* 查询部门是否存在用户
*
* @param deptId 部门ID
* @return 结果 true 存在 false 不存在
*/
@Override
public boolean checkDeptExistUser(Long deptId)
{
int result = baseMapper.checkDeptExistUser(deptId);
return result > 0;
}
/**
* 校验部门名称是否唯一
*
* @param dept 部门信息
* @return 结果
*/
@Override
public boolean checkDeptNameUnique(SysDept dept)
{
Long deptId = StringUtils.isNull(dept.getDeptId()) ? -1L : dept.getDeptId();
SysDept info = baseMapper.checkDeptNameUnique(dept.getDeptName(), dept.getParentId());
if (StringUtils.isNotNull(info) && info.getDeptId().longValue() != deptId.longValue())
{
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
}
/**
* 新增保存部门信息
*
* @param dept 部门信息
* @return 结果
*/
@Override
public int insertDept(SysDept dept)
{
if (null!=dept.getParentId()){
SysDept info = baseMapper.selectDeptById(dept.getParentId());
// 如果父节点不为正常状态,则不允许新增子节点
if (!UserConstants.DEPT_NORMAL.equals(info.getStatus()))
{
throw new ServiceException("部门停用,不允许新增");
}
dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
}
return baseMapper.insertDept(dept);
}
/**
* 修改保存部门信息
*
* @param dept 部门信息
* @return 结果
*/
@Override
public int updateDept(SysDept dept)
{
SysDept newParentDept = baseMapper.selectDeptById(dept.getParentId());
SysDept oldDept = baseMapper.selectDeptById(dept.getDeptId());
if (StringUtils.isNotNull(newParentDept) && StringUtils.isNotNull(oldDept))
{
String newAncestors = newParentDept.getAncestors() + "," + newParentDept.getDeptId();
String oldAncestors = oldDept.getAncestors();
dept.setAncestors(newAncestors);
updateDeptChildren(dept.getDeptId(), newAncestors, oldAncestors);
}
int result = baseMapper.updateDept(dept);
if (UserConstants.DEPT_NORMAL.equals(dept.getStatus()) && StringUtils.isNotEmpty(dept.getAncestors())
&& !StringUtils.equals("0", dept.getAncestors()))
{
// 如果该部门是启用状态则启用该部门的所有上级部门
updateParentDeptStatusNormal(dept);
}
return result;
}
/**
* 修改该部门的父级部门状态
*
* @param dept 当前部门
*/
private void updateParentDeptStatusNormal(SysDept dept)
{
String ancestors = dept.getAncestors();
Long[] deptIds = Convert.toLongArray(ancestors);
baseMapper.updateDeptStatusNormal(deptIds);
}
/**
* 修改子元素关系
*
* @param deptId 被修改的部门ID
* @param newAncestors 新的父ID集合
* @param oldAncestors 旧的父ID集合
*/
public void updateDeptChildren(Long deptId, String newAncestors, String oldAncestors)
{
List<SysDept> children = baseMapper.selectChildrenDeptById(deptId);
for (SysDept child : children)
{
child.setAncestors(child.getAncestors().replaceFirst(oldAncestors, newAncestors));
}
if (children.size() > 0)
{
baseMapper.updateDeptChildren(children);
}
}
/**
* 删除部门管理信息
*
* @param deptId 部门ID
* @return 结果
*/
@Override
public int deleteDeptById(Long deptId)
{
return baseMapper.deleteDeptById(deptId);
}
/**
* 递归列表
*/
private void recursionFn(List<SysDept> list, SysDept t)
{
// 得到子节点列表
List<SysDept> childList = getChildList(list, t);
t.setChildren(childList);
for (SysDept tChild : childList)
{
if (hasChild(list, tChild))
{
recursionFn(list, tChild);
}
}
}
/**
* 得到子节点列表
*/
private List<SysDept> getChildList(List<SysDept> list, SysDept t)
{
List<SysDept> tlist = new ArrayList<SysDept>();
Iterator<SysDept> it = list.iterator();
while (it.hasNext())
{
SysDept n = (SysDept) it.next();
if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getDeptId().longValue())
{
tlist.add(n);
}
}
return tlist;
}
/**
* 判断是否有子节点
*/
private boolean hasChild(List<SysDept> list, SysDept t)
{
return getChildList(list, t).size() > 0;
}
}

View File

@ -37,7 +37,7 @@ public class SysDictDataController extends BaseController
@GetMapping("/list")
public ResponseObject list(SysDictData dictData,
@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageNum",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize)
{
Page page =new Page(pageNo,pageSize);

View File

@ -30,7 +30,7 @@ public class SysDictTypeController extends BaseController
@GetMapping("/list")
public ResponseObject list(SysDictType dictType,
@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageNum",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize)
{
Page page =new Page(pageNo,pageSize);

View File

@ -40,10 +40,10 @@ public class DictUtils
*/
public static List<SysDictData> getDictCache(String key)
{
JSONArray arrayCache = SpringUtils.getBean(RedisCache.class).getCacheObject(getCacheKey(key));
Object arrayCache = SpringUtils.getBean(RedisCache.class).getCacheObject(getCacheKey(key));
if (StringUtils.isNotNull(arrayCache))
{
return arrayCache.toList(SysDictData.class);
return JSONArray.parseArray(JSONArray.toJSONString(arrayCache),SysDictData.class);
}
return null;
}

View File

@ -1,5 +1,7 @@
package com.fuint.module.backendApi.controller;
package com.fuint.system.user.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.common.util.Constants;
import com.fuint.common.dto.AccountDto;
import com.fuint.common.dto.AccountInfo;
@ -69,52 +71,18 @@ public class BackendAccountController extends BaseController {
/**
* 账户信息列表
*
* @param request HttpServletRequest对象
* @return 账户信息列表
*/
@ApiOperation(value = "账户信息列表")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@CrossOrigin
public ResponseObject list(HttpServletRequest request) throws BusinessCheckException {
String token = request.getHeader("Access-Token");
Integer page = request.getParameter("page") == null ? Constants.PAGE_NUMBER : Integer.parseInt(request.getParameter("page"));
Integer pageSize = request.getParameter("pageSize") == null ? Constants.PAGE_SIZE : Integer.parseInt(request.getParameter("pageSize"));
String accountName = request.getParameter("accountName") == null ? "" : request.getParameter("accountName");
String realName = request.getParameter("realName") == null ? "" : request.getParameter("realName");
String accountStatus = request.getParameter("accountStatus") == null ? "" : request.getParameter("accountStatus");
public ResponseObject list(TAccount accountInfo,
@RequestParam(value = "pageNum",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize) throws BusinessCheckException {
AccountInfo accountInfo = TokenUtil.getAccountInfoByToken(token);
if (accountInfo == null) {
return getFailureResult(1001, "请先登录");
}
PaginationRequest paginationRequest = new PaginationRequest();
paginationRequest.setCurrentPage(page);
paginationRequest.setPageSize(pageSize);
Map<String, Object> searchParams = new HashMap<>();
if (StringUtil.isNotEmpty(accountName)) {
searchParams.put("name", accountName);
}
if (StringUtil.isNotEmpty(realName)) {
searchParams.put("realName", realName);
}
if (StringUtil.isNotEmpty(accountStatus)) {
searchParams.put("status", accountStatus);
}
if (StringUtil.isNotEmpty(accountStatus)) {
searchParams.put("status", accountStatus);
}
if (accountInfo.getMerchantId() != null && accountInfo.getMerchantId() > 0) {
searchParams.put("merchantId", accountInfo.getMerchantId());
}
if (accountInfo.getStoreId() != null && accountInfo.getStoreId() > 0) {
searchParams.put("storeId", accountInfo.getStoreId());
}
paginationRequest.setSearchParams(searchParams);
PaginationResponse<AccountDto> paginationResponse = tAccountService.getAccountListByPagination(paginationRequest);
return getSuccessResult(paginationResponse);
Page page =new Page(pageNo,pageSize);
IPage<TAccount> res = tAccountService.listAccount(page,accountInfo);
return getSuccessResult(res);
}
/**
@ -170,9 +138,9 @@ public class BackendAccountController extends BaseController {
accountDto.setAccountKey(tAccount.getAccountKey());
accountDto.setAccountName(tAccount.getAccountName());
accountDto.setAccountStatus(tAccount.getAccountStatus());
accountDto.setCreateDate(tAccount.getCreateDate());
accountDto.setCreateDate(tAccount.getCreateTime());
accountDto.setRealName(tAccount.getRealName());
accountDto.setModifyDate(tAccount.getModifyDate());
accountDto.setModifyDate(tAccount.getUpdateTime());
accountDto.setStaffId(tAccount.getStaffId());
accountDto.setMerchantId(tAccount.getMerchantId());
if (tAccount.getStoreId() > 0) {

View File

@ -90,7 +90,7 @@ public class GlobalExceptionHandler {
public ResponseObject handleException(LoginEffectiveException e, HttpServletRequest request) {
String requestURI = request.getRequestURI();
log.error("登录信息失效", requestURI, e);
return new ResponseObject(101, e.getMessage(), null);
return new ResponseObject(1001, e.getMessage(), null);
}
/**

View File

@ -75,4 +75,13 @@ public class BaseController {
public ResponseObject getFailureResult(int errorCode, String message, Object data) {
return new ResponseObject(errorCode, message, data);
}
/**
* 获取错返回结果(无参数替换)
*
* @return
*/
public ResponseObject getFailureResult(String message) {
return new ResponseObject(201, message, null);
}
}

View File

@ -1,7 +1,10 @@
package com.fuint.repository.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.repository.model.TAccount;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
/**
* 后台账号 Mapper 接口
@ -10,5 +13,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* CopyRight https://www.fuint.cn
*/
public interface TAccountMapper extends BaseMapper<TAccount> {
IPage<TAccount> listAccount(Page page, @Param("accountInfo") TAccount accountInfo,@Param("ancestors") String ancestors);
}

View File

@ -64,4 +64,60 @@ public class MtStaff implements Serializable {
@ApiModelProperty("备注")
private String description;
@ApiModelProperty("创建用户")
private String createUser;
@ApiModelProperty("修改用户")
private String updateUser;
@ApiModelProperty("一键加油: 显示、隐藏")
private String isRefuel;
@ApiModelProperty("交班模式:当前门店统一交班;当前账户交班;指定商户号交班")
private String handoverMode;
@ApiModelProperty("交班权限,有权限;没有权限")
private String handoverPrem;
@ApiModelProperty("交班退出:交班退出;交班不退出")
private String out;
@ApiModelProperty("交班记录,全部记录;名下记录;禁用权限")
private String record;
@ApiModelProperty("交班商户号,启用;禁用")
private String merchantStatus;
@ApiModelProperty("员工筛选,启用;禁用")
private String screen;
@ApiModelProperty("POS权限")
private String posPrem;
@ApiModelProperty("小程序权限")
private String appletPrem;
@ApiModelProperty("收款通知(模板通知),禁用;全部交易;名下交易;指定邮箱")
private String notice;
@ApiModelProperty("模板油枪号,对应油枪号信息,当收款通知选择指定邮箱时才可选择")
private String oilGunId;
@ApiModelProperty("时间范围1不限2当天33天内47天内530天内6当月7当前班次")
private String timeFrame;
@ApiModelProperty("退款权限,有权限;无权限")
private String refund;
@ApiModelProperty("交易统计1全部交易2名下交易")
private String transaction;
@ApiModelProperty("核销权限1洗车卡券2兑换券")
private String writeOff;
@ApiModelProperty("特殊权限1PC后台管理2POS收银系统3PC收银权限4小程序端报表")
private String specialPrem;
@ApiModelProperty("公众号1未关注2已关注")
private String official;
}

View File

@ -1,10 +1,13 @@
package com.fuint.repository.model;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import com.fuint.repository.model.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
@ -20,7 +23,7 @@ import lombok.Setter;
@Setter
@TableName("t_account")
@ApiModel(value = "TAccount对象", description = "后台管理员表")
public class TAccount implements Serializable {
public class TAccount extends BaseEntity implements Serializable {
private static final long serialVersionUID = 1L;
@ -43,12 +46,6 @@ public class TAccount implements Serializable {
@ApiModelProperty("0 未激活 1已激活")
private Integer isActive;
@ApiModelProperty("创建时间")
private Date createDate;
@ApiModelProperty("修改时间")
private Date modifyDate;
@ApiModelProperty("随机码")
private String salt;
@ -69,4 +66,11 @@ public class TAccount implements Serializable {
@ApiModelProperty("员工ID")
private Integer staffId;
@ApiModelProperty("账户头像地址")
private String avatar;
//机构主键
private Long deptId;
@TableField(exist = false)
private String deptName;
}

View File

@ -4,6 +4,9 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import com.fuint.repository.model.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
@ -19,7 +22,7 @@ import lombok.Setter;
@Setter
@TableName("t_duty")
@ApiModel(value = "TDuty对象", description = "角色表")
public class TDuty implements Serializable {
public class TDuty extends BaseEntity implements Serializable {
private static final long serialVersionUID = 1L;
@ -41,4 +44,6 @@ public class TDuty implements Serializable {
@ApiModelProperty("角色类型")
private String dutyType;
}

View File

@ -0,0 +1,123 @@
package com.fuint.repository.model.base;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* Entity基类
*
* @author ruoyi
*/
public class BaseEntity implements Serializable
{
private static final long serialVersionUID = 1L;
/** 搜索值 */
@JsonIgnore
@TableField(exist = false)
private String searchValue;
/** 创建者 */
private String createBy;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/** 更新者 */
private String updateBy;
/** 更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
/** 备注 */
@TableField(exist = false)
private String remark;
/** 请求参数 */
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@TableField(exist = false)
private Map<String, Object> params;
public String getSearchValue()
{
return searchValue;
}
public void setSearchValue(String searchValue)
{
this.searchValue = searchValue;
}
public String getCreateBy()
{
return createBy;
}
public void setCreateBy(String createBy)
{
this.createBy = createBy;
}
public Date getCreateTime()
{
return createTime;
}
public void setCreateTime(Date createTime)
{
this.createTime = createTime;
}
public String getUpdateBy()
{
return updateBy;
}
public void setUpdateBy(String updateBy)
{
this.updateBy = updateBy;
}
public Date getUpdateTime()
{
return updateTime;
}
public void setUpdateTime(Date updateTime)
{
this.updateTime = updateTime;
}
public String getRemark()
{
return remark;
}
public void setRemark(String remark)
{
this.remark = remark;
}
public Map<String, Object> getParams()
{
if (params == null)
{
params = new HashMap<>();
}
return params;
}
public void setParams(Map<String, Object> params)
{
this.params = params;
}
}

View File

@ -1,5 +1,23 @@
<?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.fuint.repository.mapper.TAccountMapper">
<select id="listAccount" resultType="com.fuint.repository.model.TAccount">
SELECT
ta.*,sd.dept_name
FROM
`t_account` ta
left join sys_dept sd on sd.dept_id = ta.dept_id
<if test="accountInfo.realName != null and accountInfo.realName != ''">
AND ta.real_name = like concat('%',#{accountInfo.realName},'%')
</if>
<if test="accountInfo.deptId != null">
AND ta.dept_id = #{accountInfo.deptId}
</if>
<!-- 数据范围过滤 -->
<if test="ownDeptStr != null and ownDeptStr!=''">
AND sd.ancestors like concat (#{ownDeptStr},'%')
</if>
order by create_time desc
</select>
</mapper>