Commit 23db3e75 authored by huyuchen's avatar huyuchen

标签管理初版提交

parent 028f8f2c
......@@ -7,7 +7,6 @@ import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysUser;
import com.yifu.cloud.plus.v1.yifu.admin.api.feign.RemoteUserService;
import com.yifu.cloud.plus.v1.yifu.archives.entity.MSetttleCustomerUser;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TCustomerInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TSettleDomain;
......@@ -57,8 +56,6 @@ public class CustomerBusinessContoller {
private final MSetttleCustomerUserService mSetttleCustomerUserService;
private final RemoteUserService remoteUserService;
private static final String CREATE_TIME_COLNUM = "CREATE_TIME"; //客户创建时间
private final RedisUtil redisUtil;
......
......@@ -17,7 +17,6 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.time.LocalDateTime;
......@@ -170,7 +169,7 @@ public class TBusDeptController {
*/
@Operation(summary = "新增(yifu-mvp-business:tbusdept_add)", description = "新增(yifu-mvp-business:tbusdept_add)")
@PostMapping
@PreAuthorize("@pms.hasPermission('yifu-hro-business:tbusdept_add')")
// @PreAuthorize("@pms.hasPermission('yifu-mvp-business:tbusdept_add')")
public R<Boolean> save(@RequestBody TBusDept tBusDept) {
String error;
if (Common.isNotNull(tBusDept.getName())) {
......@@ -212,10 +211,10 @@ public class TBusDeptController {
* @param tBusDept
* @return R
*/
@Operation(summary = "修改(yifu-hro-business:tbusdept_edit)", description = "修改(yifu-hro-business:tbusdept_edit)")
@Operation(summary = "修改(yifu-mvp-business:tbusdept_edit)", description = "修改(yifu-mvp-business:tbusdept_edit)")
@SysLog("修改B端部门表")
@PutMapping
@PreAuthorize("@pms.hasPermission('yifu-hro-business:tbusdept_edit')")
// @PreAuthorize("@pms.hasPermission('yifu-mvp-business:tbusdept_edit')")
public R<Boolean> update(@RequestBody TBusDept tBusDept) {
if (Common.isNotNull(tBusDept.getName()) && Common.isNotNull(tBusDept.getId())) {
boolean flag = this.getDeptByName(tBusDept.getId(), tBusDept.getName());
......@@ -259,10 +258,10 @@ public class TBusDeptController {
* @param id
* @return R
*/
@Operation(summary = "假删除(yifu-hro-business:tbusdept_del)", description = "假删除(yifu-hro-business:tbusdept_del)")
@Operation(summary = "假删除(yifu-mvp-business:tbusdept_del)", description = "假删除(yifu-mvp-business:tbusdept_del)")
@SysLog("假删除B端部门表")
@DeleteMapping("/{id}")
@PreAuthorize("@pms.hasPermission('yifu-hro-business:tbusdept_del')")
// @PreAuthorize("@pms.hasPermission('yifu-mvp-business:tbusdept_del')")
public R<Boolean> removeById(@PathVariable Integer id) {
TBusDept tBusDept = new TBusDept();
tBusDept.setPid(id);
......@@ -380,7 +379,7 @@ public class TBusDeptController {
* @since hrob2.1
*/
@Operation(summary = "根据部门父id或等级查询部门列表", description = "根据部门父id或等级查询部门列表")
@GetMapping("/getBusDepartByLevelOrPid")
@GetMapping("/getBusDepartByLevelOrPid")
public R<List<TBusDept>> getBusDepartByLevelOrPid(
@Parameter(description = "部门父id选填,如果需要获取指定部门下面所有的部门须填写") @RequestParam(name = "pid", required = false) Integer pid,
@Parameter(description = "部门等级 1:一级部门 2:二级部门,以此类推") @RequestParam(name = "level") Integer level) {
......
package com.yifu.cloud.plus.v1.business.controller.system;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.business.entity.system.TBusLable;
import com.yifu.cloud.plus.v1.business.service.system.TBusLableService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.time.LocalDateTime;
import java.util.List;
/**
* B端标签表
*
* @author hgw
* @date 2021-08-11 17:00:52
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/tbuslable")
@Tag(name = "B端标签表")
public class TBusLableController {
private final TBusLableService tBusLableService;
/**
* 简单分页查询
*
* @param page 分页对象
* @param tBusLable B端标签表
* @return
*/
@Operation(summary = "简单分页查询", description = "简单分页查询")
@GetMapping("/page")
public R<IPage<TBusLable>> getTBusLablePage(Page<TBusLable> page, TBusLable tBusLable) {
return new R<>(tBusLableService.getTBusLablePage(page, tBusLable));
}
/**
* 获取list
*
* @param tBusLable B端标签表
* @return
*/
@Operation(description = "获取list,status:是否启用,0启用,1禁用")
@GetMapping("/getTBusLableList")
public R<List<TBusLable>> getTBusLableList(TBusLable tBusLable) {
return new R<>(tBusLableService.getTBusLableList(tBusLable));
}
/**
* 通过id查询单条记录
*
* @param id
* @return R
*/
@Operation(summary = "id查询", description = "id查询")
@GetMapping("/{id}")
public R<TBusLable> getById(@PathVariable("id") Integer id) {
return new R<>(tBusLableService.getById(id));
}
/**
* 通过idStr查询单条记录
*
* @param idStr
* @return R
*/
@Operation(summary = "idStr查询", description = "idStr查询")
@PostMapping("/getByIdStr")
public R<List<TBusLable>> getByIdStr(@RequestParam String idStr) {
List<String> list = Common.getList(idStr);
return new R<>(tBusLableService.list(Wrappers.<TBusLable>query().lambda().in(TBusLable::getId, list)));
}
/**
* 新增记录
*
* @param tBusLable
* @return R
*/
@Operation(summary = "新增(yifu-mvp-business:tbuslable_add)", description = "新增(yifu-mvp-business:tbuslable_add)")
@PostMapping
// @PreAuthorize("@pms.hasPermission('yifu-mvp-business:tbuslable_add')")
public R<Boolean> save(@RequestBody TBusLable tBusLable) {
if (Common.isNotNull(tBusLable.getName())) {
boolean flag = this.getLableByName(null, tBusLable.getName());
if (flag) {
return R.failed("标签名称不可重复");
}
} else {
return R.failed("标签名称不可为空");
}
YifuUser user = SecurityUtils.getUser();
if (user != null && user.getId() != null) {
tBusLable.setCreateTime(LocalDateTime.now());
tBusLable.setCreateUserId(String.valueOf(user.getId()));
tBusLable.setCreateUserName(user.getNickname());
return new R<>(tBusLableService.save(tBusLable));
} else {
return R.failed("未获取到登录人信息");
}
}
/**
* 检查名称是否重复,false:不重复,可以使用的名称
*
* @param name 名称
* @return
*/
private boolean getLableByName(Integer id, String name) {
List<TBusLable> list = tBusLableService.getLableByName(id, name);
return (list != null && !list.isEmpty());
}
/**
* 修改记录
*
* @param tBusLable
* @return R
*/
@Operation(summary = "修改(yifu-mvp-business:tbuslable_edit)", description = "修改(yifu-mvp-business:tbuslable_edit)")
@SysLog("修改B端标签表")
@PutMapping
// @PreAuthorize("@pms.hasPermission('yifu-mvp-business:tbuslable_edit')")
public R<Boolean> update(@RequestBody TBusLable tBusLable) {
if (Common.isNotNull(tBusLable.getId()) && Common.isNotNull(tBusLable.getName())) {
boolean flag = this.getLableByName(tBusLable.getId(), tBusLable.getName());
if (flag) {
return R.failed("标签名称不可重复");
}
} else {
return R.failed("标签id、名称不可为空");
}
return new R<>(tBusLableService.updateById(tBusLable));
}
/**
* 通过id删除一条记录
*
* @param id
* @return R
*/
@Operation(summary = "假删除(yifu-mvp-business:tbuslable_del)", description = "假删除(yifu-mvp-business:tbuslable_del)")
@SysLog("假删除B端标签表")
@DeleteMapping("/{id}")
// @PreAuthorize("@pms.hasPermission('yifu-mvp-business:tbuslable_del')")
public R<Boolean> removeById(@PathVariable Integer id) {
TBusLable tBusLable = new TBusLable();
tBusLable.setId(id);
tBusLable.setDeleteFlag(1);
return new R<>(tBusLableService.updateById(tBusLable));
}
}
package com.yifu.cloud.plus.v1.business.mapper.system;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.business.entity.system.TBusLable;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* B端标签表
*
* @author hgw
* @date 2021-08-11 17:00:52
*/
@Mapper
public interface TBusLableMapper extends BaseMapper<TBusLable> {
/**
* B端标签表简单分页查询
*
* @param tBusLable B端标签表
* @return
*/
IPage<TBusLable> getTBusLablePage(Page<TBusLable> page, @Param("tBusLable") TBusLable tBusLable);
List<TBusLable> getTBusLableList(@Param("tBusLable") TBusLable tBusLable);
List<TBusLable> getLableByName(@Param("id") Integer id, @Param("name") String name);
}
package com.yifu.cloud.plus.v1.business.service.system;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.business.entity.system.TBusLable;
import java.util.List;
/**
* B端标签表
*
* @author hgw
* @date 2021-08-11 17:00:52
*/
public interface TBusLableService extends IService<TBusLable> {
/**
* B端标签表简单分页查询
*
* @param tBusLable B端标签表
* @return
*/
IPage<TBusLable> getTBusLablePage(Page<TBusLable> page, TBusLable tBusLable);
/**
* @param tBusLable
* @Description: 获取list
* @Author: hgw
* @Date: 2021/8/11 17:31
* @return: java.util.List<com.yifu.cloud.v1.hrobusiness.api.entity.system.TBusLable>
**/
List<TBusLable> getTBusLableList(TBusLable tBusLable);
/**
* @param id
* @param name
* @Description: 获取标签list,判重
* @Author: hgw
* @Date: 2021/8/11 16:06
* @return: java.util.List<com.yifu.cloud.v1.hrobusiness.api.entity.system.TBusDept>
**/
List<TBusLable> getLableByName(Integer id, String name);
}
package com.yifu.cloud.plus.v1.business.service.system.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.yifu.cloud.plus.v1.business.entity.system.TBusLable;
import com.yifu.cloud.plus.v1.business.mapper.system.TBusLableMapper;
import com.yifu.cloud.plus.v1.business.service.system.TBusLableService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* B端标签表
*
* @author hgw
* @date 2021-08-11 17:00:52
*/
@Service("tBusLableService")
public class TBusLableServiceImpl extends ServiceImpl<TBusLableMapper, TBusLable> implements TBusLableService {
/**
* B端标签表简单分页查询
*
* @param tBusLable B端标签表
* @return
*/
@Override
public IPage<TBusLable> getTBusLablePage(Page<TBusLable> page, TBusLable tBusLable) {
return baseMapper.getTBusLablePage(page, tBusLable);
}
@Override
public List<TBusLable> getTBusLableList(TBusLable tBusLable) {
return baseMapper.getTBusLableList(tBusLable);
}
@Override
public List<TBusLable> getLableByName(Integer id, String name) {
return baseMapper.getLableByName(id, name);
}
}
<?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.yifu.cloud.plus.v1.business.mapper.system.TBusLableMapper">
<resultMap id="tBusLableMap" type="com.yifu.cloud.plus.v1.business.entity.system.TBusLable">
<id property="id" column="id"/>
<result property="name" column="name"/>
<result property="remark" column="remark"/>
<result property="status" column="status"/>
<result property="createUserId" column="create_user_id"/>
<result property="createUserName" column="create_user_name"/>
<result property="createTime" column="create_time"/>
<result property="deleteFlag" column="delete_flag"/>
</resultMap>
<sql id="Base_Column_List">
a.id,
a.name,
a.remark,
a.status,
a.create_user_id,
a.create_user_name,
a.create_time,
a.delete_flag
</sql>
<sql id="tBusLable_where">
<if test="tBusLable != null">
<if test="tBusLable.id != null">
AND a.id = #{tBusLable.id}
</if>
<if test="tBusLable.name != null and tBusLable.name.trim() != ''">
AND a.name like concat('%', #{tBusLable.name},'%')
</if>
<if test="tBusLable.remark != null and tBusLable.remark.trim() != ''">
AND a.remark = #{tBusLable.remark}
</if>
<if test="tBusLable.status != null">
AND a.status = #{tBusLable.status}
</if>
<if test="tBusLable.createUserId != null and tBusLable.createUserId.trim() != ''">
AND a.create_user_id = #{tBusLable.createUserId}
</if>
<if test="tBusLable.createUserName != null and tBusLable.createUserName.trim() != ''">
AND a.create_user_name = #{tBusLable.createUserName}
</if>
<if test="tBusLable.createTime != null">
AND a.create_time = #{tBusLable.createTime}
</if>
<if test="tBusLable.deleteFlag != null">
AND a.delete_flag = #{tBusLable.deleteFlag}
</if>
</if>
</sql>
<!--tBusLable简单分页查询-->
<select id="getTBusLablePage" resultMap="tBusLableMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_bus_lable a
<where>
a.delete_flag = 0
<include refid="tBusLable_where"/>
</where>
ORDER BY a.create_time desc
</select>
<!--list-->
<select id="getTBusLableList" resultMap="tBusLableMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_bus_lable a
<where>
a.delete_flag = 0
<include refid="tBusLable_where"/>
</where>
ORDER BY a.create_time desc
</select>
<!--判重-->
<select id="getLableByName" resultMap="tBusLableMap">
SELECT
a.id
FROM t_bus_lable a
where
a.delete_flag = 0
<if test="id != null">
and a.id != #{id}
</if>
AND a.name = #{name}
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment