Commit e8d92016 authored by hongguangwu's avatar hongguangwu

MVP1.5.2-开户行

parent 47d0d707
......@@ -18,6 +18,7 @@
package com.yifu.cloud.plus.v1.yifu.salary.entity;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.HeadFontStyle;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
......@@ -58,4 +59,12 @@ public class TBankSet extends BaseEntity {
@ExcelProperty("开户行")
@Schema(description = "开户行")
private String bankName;
/**
* 是否删除0:正常;1:已删除
*/
@ExcelAttribute(name = "是否删除0:正常;1:已删除")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("是否删除0:正常;1:已删除")
private String deleteFlag;
}
\ No newline at end of file
......@@ -19,6 +19,8 @@ package com.yifu.cloud.plus.v1.yifu.salary.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
......@@ -101,6 +103,13 @@ public class TBankSetController {
@PostMapping
@PreAuthorize("@pms.hasPermission('salary_tbankset_add')")
public R<Boolean> save(@RequestBody TBankSet tBankSet) {
if (Common.isEmpty(tBankSet.getBankName())) {
return R.failed("开户行不可为空!");
}
List<TBankSet> tBankSetList = tBankSetService.getList(tBankSet.getBankName(), null);
if (tBankSetList != null && !tBankSetList.isEmpty()) {
return R.failed("已存在该开户行!");
}
return R.ok(tBankSetService.save(tBankSet));
}
......@@ -115,6 +124,10 @@ public class TBankSetController {
@PutMapping
@PreAuthorize("@pms.hasPermission('salary_tbankset_edit')")
public R<Boolean> updateById(@RequestBody TBankSet tBankSet) {
List<TBankSet> tBankSetList = tBankSetService.getList(tBankSet.getBankName(), tBankSet.getId());
if (tBankSetList != null && !tBankSetList.isEmpty()) {
return R.failed("已存在该开户行!");
}
return R.ok(tBankSetService.updateById(tBankSet));
}
......@@ -129,7 +142,14 @@ public class TBankSetController {
@DeleteMapping("/{id}")
@PreAuthorize("@pms.hasPermission('salary_tbankset_del')")
public R<Boolean> removeById(@PathVariable String id) {
return R.ok(tBankSetService.removeById(id));
TBankSet bankSet = tBankSetService.getById(id);
if (bankSet != null) {
bankSet.setDeleteFlag(CommonConstants.STATUS_DEL);
tBankSetService.updateById(bankSet);
return R.ok();
} else {
return R.failed("未找到!");
}
}
/**
......
......@@ -58,4 +58,14 @@ public interface TBankSetService extends IService<TBankSet> {
void listExport(HttpServletResponse response, TBankSetSearchVo searchVo);
List<TBankSet> noPageDiy(TBankSetSearchVo searchVo);
/**
* @param bankName
* @param id
* @Description: 获取list
* @Author: hgw
* @Date: 2023/3/10 18:08
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.salary.entity.TBankSet>
**/
List<TBankSet> getList(String bankName, String id);
}
......@@ -177,6 +177,7 @@ public class TBankSetServiceImpl extends ServiceImpl<TBankSetMapper, TBankSet> i
if (Common.isNotNull(entity.getCreateName())) {
wrapper.eq(TBankSet::getCreateName, entity.getCreateName());
}
wrapper.eq(TBankSet:: getDeleteFlag, CommonConstants.STATUS_NORMAL);
return wrapper;
}
......@@ -255,4 +256,16 @@ public class TBankSetServiceImpl extends ServiceImpl<TBankSetMapper, TBankSet> i
BeanUtil.copyProperties(excel, insert);
this.save(insert);
}
@Override
public List<TBankSet> getList(String bankName, String id) {
LambdaQueryWrapper<TBankSet> wrapper = Wrappers.lambdaQuery();
wrapper.eq(TBankSet:: getDeleteFlag, CommonConstants.STATUS_NORMAL);
wrapper.eq(TBankSet:: getBankName, bankName);
if (Common.isNotNull(id)) {
wrapper.ne(TBankSet:: getId, id);
}
return baseMapper.selectList(wrapper);
}
}
......@@ -31,6 +31,7 @@
<result property="createTime" column="CREATE_TIME"/>
<result property="updateBy" column="UPDATE_BY"/>
<result property="updateTime" column="UPDATE_TIME"/>
<result property="deleteFlag" column="DELETE_FLAG"/>
</resultMap>
<sql id="Base_Column_List">
a.ID,
......@@ -39,7 +40,8 @@
a.CREATE_NAME,
a.CREATE_TIME,
a.UPDATE_BY,
a.UPDATE_TIME
a.UPDATE_TIME,
a.DELETE_FLAG
</sql>
<sql id="tBankSet_where">
<if test="tBankSet != null">
......@@ -72,7 +74,7 @@
<include refid="Base_Column_List"/>
FROM t_bank_set a
<where>
1=1
a.DELETE_FLAG = '0'
<include refid="tBankSet_where"/>
</where>
order by a.CREATE_TIME desc
......@@ -83,8 +85,9 @@
SELECT
a.BANK_NAME
FROM t_bank_set a
where a.DELETE_FLAG = '0'
<if test="bankName != null and bankName.trim() != ''">
where a.BANK_NAME = #{bankName}
and a.BANK_NAME = #{bankName}
</if>
order by a.CREATE_TIME desc
</select>
......
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