Commit 89e46fcc authored by hongguangwu's avatar hongguangwu

MVP1.7.18-法大大公司主体相关

parent 16596bd1
...@@ -21,6 +21,7 @@ import com.alibaba.excel.annotation.ExcelProperty; ...@@ -21,6 +21,7 @@ import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute; import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity; import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
...@@ -28,6 +29,8 @@ import lombok.Data; ...@@ -28,6 +29,8 @@ import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.Length;
import java.time.LocalDateTime;
/** /**
* 法大大专业版公司信息表 * 法大大专业版公司信息表
* *
...@@ -95,5 +98,27 @@ public class TFascCompany extends BaseEntity { ...@@ -95,5 +98,27 @@ public class TFascCompany extends BaseEntity {
@ExcelProperty("场景码") @ExcelProperty("场景码")
@Schema(description = "场景码") @Schema(description = "场景码")
private String businessId; private String businessId;
/**
* 是否删除:0未删除1已删除
*/
@ExcelAttribute(name = "是否删除", maxLength = 1)
@Length(max = 1, message = "是否删除不能超过1个字符")
@ExcelProperty("是否删除")
@Schema(description = "是否删除")
private String deleteFlag;
/**
* 删除人姓名
*/
@ExcelAttribute(name = "删除人姓名", maxLength = 64)
@Length(max = 64, message = "删除人姓名不能超过64个字符")
@ExcelProperty("删除人姓名")
@Schema(description = "删除人姓名")
private String deleteName;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")
@ExcelAttribute(name = "删除时间")
@ExcelProperty("删除时间")
@Schema(description = "删除时间")
private LocalDateTime deleteTime;
} }
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.archives.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TFascCompany;
import com.yifu.cloud.plus.v1.yifu.archives.service.TFascCompanyService;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
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.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.time.LocalDateTime;
/**
* 法大大专业版公司信息表
*
* @author hgw
* @date 2025-10-22 17:43:17
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/tfasccompany")
@Tag(name = "法大大专业版公司信息表管理")
public class TFascCompanyController {
private final TFascCompanyService tFascCompanyService;
/**
* 简单分页查询
*
* @param page 分页对象
* @param tFascCompany 法大大专业版公司信息表
* @return
*/
@Operation(description = "简单分页查询")
@GetMapping("/page")
public R<IPage<TFascCompany>> getTFascCompanyPage(Page<TFascCompany> page, TFascCompany tFascCompany) {
return new R<>(tFascCompanyService.getTFascCompanyPage(page, tFascCompany));
}
/**
* 通过id查询法大大专业版公司信息表
*
* @param id id
* @return R
*/
@Operation(summary = "通过id查询", description = "通过id查询")
@GetMapping("/{id}")
public R<TFascCompany> getById(@PathVariable("id") String id) {
return R.ok(tFascCompanyService.getById(id));
}
/**
* 新增法大大专业版公司信息表
*
* @param tFascCompany 法大大专业版公司信息表
* @return R
*/
@Operation(summary = "新增法大大专业版公司信息表", description = "新增法大大专业版公司信息表:hasPermission('archives_tfasccompany_add')")
@SysLog("新增法大大专业版公司信息表")
@PostMapping
@PreAuthorize("@pms.hasPermission('archives_tfasccompany_add')")
public R<Boolean> save(@RequestBody TFascCompany tFascCompany) {
if (Common.isEmpty(tFascCompany.getCompanyName())) {
return R.failed("请填写公司主体!");
}
int num = tFascCompanyService.getTFascCompanyByNameAndId(tFascCompany.getCompanyName(), null);
if (num > 0) {
return R.failed("该公司主体已存在,请勿重复配置!");
}
R<Boolean> failed = judgeFieldMust(tFascCompany);
if (failed != null) {
return failed;
}
return R.ok(tFascCompanyService.save(tFascCompany));
}
private R<Boolean> judgeFieldMust(TFascCompany tFascCompany) {
if (Common.isEmpty(tFascCompany.getAppId())) {
return R.failed("请填写appId!");
}
if (Common.isEmpty(tFascCompany.getAppSecret())) {
return R.failed("请填写appSecret!");
}
if (Common.isEmpty(tFascCompany.getAppUrl())) {
return R.failed("请填写AppUrl!");
}
if (Common.isEmpty(tFascCompany.getOpenId())) {
return R.failed("请填写openCorpId!");
}
if (Common.isEmpty(tFascCompany.getAppUrl())) {
return R.failed("请填写appUrl!");
}
if (Common.isEmpty(tFascCompany.getBusinessId())) {
return R.failed("请填写businessId!");
}
return null;
}
/**
* 修改法大大专业版公司信息表
*
* @param tFascCompany 法大大专业版公司信息表
* @return R
*/
@Operation(summary = "修改法大大专业版公司信息表", description = "修改法大大专业版公司信息表:hasPermission('archives_tfasccompany_edit')")
@SysLog("修改法大大专业版公司信息表")
@PutMapping
@PreAuthorize("@pms.hasPermission('archives_tfasccompany_edit')")
public R<Boolean> updateById(@RequestBody TFascCompany tFascCompany) {
if (Common.isEmpty(tFascCompany.getId())) {
return R.failed("请传参ID!");
}
if (Common.isEmpty(tFascCompany.getCompanyName())) {
return R.failed("请传参公司主体!");
}
int num = tFascCompanyService.getTFascCompanyByNameAndId(tFascCompany.getCompanyName(), tFascCompany.getId());
if (num > 0) {
return R.failed("该公司主体已存在,请勿重复配置!");
}
R<Boolean> failed = judgeFieldMust(tFascCompany);
if (failed != null) {
return failed;
}
return R.ok(tFascCompanyService.updateById(tFascCompany));
}
/**
* 通过id删除法大大专业版公司信息表
*
* @param id id
* @return R
*/
@Operation(summary = "通过id删除法大大专业版公司信息表", description = "通过id删除法大大专业版公司信息表:hasPermission('archives_tfasccompany_del')")
@SysLog("通过id删除法大大专业版公司信息表")
@GetMapping("/deleteCompanyById")
@PreAuthorize("@pms.hasPermission('archives_tfasccompany_del')")
public R<String> deleteCompanyById(@RequestParam String id) {
if (CommonConstants.ONE_STRING.equals(id)) {
return R.failed("请勿删除此条数据!");
}
YifuUser user = SecurityUtils.getUser();
if (user == null || Common.isEmpty(user.getNickname())) {
return R.failed("请登录!");
}
TFascCompany tFascCompany = tFascCompanyService.getById(id);
if (tFascCompany == null || Common.isEmpty(tFascCompany.getId())) {
return R.failed("根据ID未找到数据!");
} else {
tFascCompany.setDeleteFlag(CommonConstants.DELETE_FLAG);
tFascCompany.setDeleteName(user.getNickname());
tFascCompany.setDeleteTime(LocalDateTime.now());
tFascCompanyService.updateById(tFascCompany);
return R.ok("已删除!");
}
}
}
...@@ -18,8 +18,11 @@ ...@@ -18,8 +18,11 @@
package com.yifu.cloud.plus.v1.yifu.archives.mapper; package com.yifu.cloud.plus.v1.yifu.archives.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; 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.yifu.archives.entity.TFascCompany; import com.yifu.cloud.plus.v1.yifu.archives.entity.TFascCompany;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
...@@ -36,4 +39,10 @@ public interface TFascCompanyMapper extends BaseMapper<TFascCompany> { ...@@ -36,4 +39,10 @@ public interface TFascCompanyMapper extends BaseMapper<TFascCompany> {
* @return * @return
*/ */
List<TFascCompany> getTFascCompanyAllList(); List<TFascCompany> getTFascCompanyAllList();
IPage<TFascCompany> getTFascCompanyPage(Page<TFascCompany> page, @Param("tFascCompany") TFascCompany tFascCompany);
// 查重
int getTFascCompanyByNameAndId(@Param("companyName") String companyName, @Param("id") String id);
} }
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
package com.yifu.cloud.plus.v1.yifu.archives.service; package com.yifu.cloud.plus.v1.yifu.archives.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.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TFascCompany; import com.yifu.cloud.plus.v1.yifu.archives.entity.TFascCompany;
...@@ -35,4 +37,10 @@ public interface TFascCompanyService extends IService<TFascCompany> { ...@@ -35,4 +37,10 @@ public interface TFascCompanyService extends IService<TFascCompany> {
* @return * @return
*/ */
List<TFascCompany> getTFascCompanyAllList(); List<TFascCompany> getTFascCompanyAllList();
IPage<TFascCompany> getTFascCompanyPage(Page<TFascCompany> page, TFascCompany tFascCompany);
// 查重
int getTFascCompanyByNameAndId(String companyName, String id);
} }
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
*/ */
package com.yifu.cloud.plus.v1.yifu.archives.service.impl; package com.yifu.cloud.plus.v1.yifu.archives.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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TFascCompany; import com.yifu.cloud.plus.v1.yifu.archives.entity.TFascCompany;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TFascCompanyMapper; import com.yifu.cloud.plus.v1.yifu.archives.mapper.TFascCompanyMapper;
...@@ -43,4 +45,15 @@ public class TFascCompanyServiceImpl extends ServiceImpl<TFascCompanyMapper, TFa ...@@ -43,4 +45,15 @@ public class TFascCompanyServiceImpl extends ServiceImpl<TFascCompanyMapper, TFa
public List<TFascCompany> getTFascCompanyAllList() { public List<TFascCompany> getTFascCompanyAllList() {
return baseMapper.getTFascCompanyAllList(); return baseMapper.getTFascCompanyAllList();
} }
@Override
public IPage<TFascCompany> getTFascCompanyPage(Page<TFascCompany> page, TFascCompany tFascCompany){
return baseMapper.getTFascCompanyPage(page,tFascCompany);
}
// 查重
@Override
public int getTFascCompanyByNameAndId(String companyName, String id) {
return baseMapper.getTFascCompanyByNameAndId(companyName,id);
}
} }
...@@ -36,6 +36,9 @@ ...@@ -36,6 +36,9 @@
<result property="updateBy" column="UPDATE_BY"/> <result property="updateBy" column="UPDATE_BY"/>
<result property="updateTime" column="UPDATE_TIME"/> <result property="updateTime" column="UPDATE_TIME"/>
<result property="businessId" column="business_id"/> <result property="businessId" column="business_id"/>
<result property="deleteFlag" column="DELETE_FLAG"/>
<result property="deleteName" column="DELETE_NAME"/>
<result property="deleteTime" column="DELETE_TIME"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
a.id, a.id,
...@@ -49,7 +52,10 @@ ...@@ -49,7 +52,10 @@
a.CREATE_TIME, a.CREATE_TIME,
a.UPDATE_BY, a.UPDATE_BY,
a.UPDATE_TIME, a.UPDATE_TIME,
a.business_id a.business_id,
a.DELETE_FLAG,
a.DELETE_NAME,
a.DELETE_TIME
</sql> </sql>
<sql id="tFascCompany_where"> <sql id="tFascCompany_where">
<if test="tFascCompany != null"> <if test="tFascCompany != null">
...@@ -57,7 +63,7 @@ ...@@ -57,7 +63,7 @@
AND a.id = #{tFascCompany.id} AND a.id = #{tFascCompany.id}
</if> </if>
<if test="tFascCompany.companyName != null and tFascCompany.companyName.trim() != ''"> <if test="tFascCompany.companyName != null and tFascCompany.companyName.trim() != ''">
AND a.company_name = #{tFascCompany.companyName} AND a.company_name like concat('%', #{tFascCompany.companyName}, '%')
</if> </if>
<if test="tFascCompany.appId != null and tFascCompany.appId.trim() != ''"> <if test="tFascCompany.appId != null and tFascCompany.appId.trim() != ''">
AND a.app_id = #{tFascCompany.appId} AND a.app_id = #{tFascCompany.appId}
...@@ -90,8 +96,33 @@ ...@@ -90,8 +96,33 @@
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
FROM t_fasc_company a FROM t_fasc_company a
<where> <where>
1=1 a.DELETE_FLAG = '0'
<include refid="tFascCompany_where"/> <include refid="tFascCompany_where"/>
</where> </where>
order by a.CREATE_TIME asc
</select> </select>
<!--tFascCompany简单分页查询,排序顺序,为了总公司在第一位-->
<select id="getTFascCompanyPage" resultMap="tFascCompanyMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_fasc_company a
<where>
a.DELETE_FLAG = '0'
<include refid="tFascCompany_where"/>
</where>
order by a.CREATE_TIME asc
</select>
<!--查重 -->
<select id="getTFascCompanyByNameAndId" resultType="java.lang.Integer">
SELECT
count(1)
FROM t_fasc_company a
where a.DELETE_FLAG = '0' and a.company_name = #{companyName}
<if test="id != null and id.trim() != ''">
AND a.id != #{id}
</if>
</select>
</mapper> </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