单位管理接口
This commit is contained in:
parent
320d660789
commit
e6007ed667
|
|
@ -0,0 +1,100 @@
|
|||
package com.bonus.common.security.utils;
|
||||
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.ConstraintViolation;
|
||||
import javax.validation.Validator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @description: <br/>
|
||||
* 通用Server validation方法
|
||||
* <p>
|
||||
* <br/>
|
||||
* @author: Qz1997
|
||||
* @create 2021/2/9 14:41
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
@Component(value = "ValidatorsUtils")
|
||||
public final class ValidatorsUtils {
|
||||
@Resource
|
||||
private Validator validator;
|
||||
|
||||
/**
|
||||
* 验证实体
|
||||
*
|
||||
* @param obj 实体
|
||||
* @param <T> 实体类类型
|
||||
* @return 结果
|
||||
*/
|
||||
public <T> String valid(T obj) {
|
||||
return this.valid(obj, new Class<?>[]{});
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证实体
|
||||
*
|
||||
* @param obj 实体
|
||||
* @param group 实体组
|
||||
* @param <T> 实体类类型
|
||||
* @return 结果
|
||||
*/
|
||||
public <T> String valid(T obj, Class<?>... group) {
|
||||
Set<ConstraintViolation<T>> violations;
|
||||
if (ArrayUtils.isEmpty(group)) {
|
||||
violations = validator.validate(obj);
|
||||
} else {
|
||||
violations = validator.validate(obj, group);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(violations)) {
|
||||
for (ConstraintViolation<T> constraintViolation : violations) {
|
||||
return constraintViolation.getMessage();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验list
|
||||
*
|
||||
* @param objList list
|
||||
* @param <T> 实体类类型
|
||||
* @return 结果
|
||||
*/
|
||||
public <T> String validList(List<T> objList) {
|
||||
return this.validList(objList, new Class<?>[]{});
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验list
|
||||
*
|
||||
* @param objList list
|
||||
* @param group 组
|
||||
* @param <T> 实体类类型
|
||||
* @return 结果
|
||||
*/
|
||||
public <T> String validList(List<T> objList, Class<?>... group) {
|
||||
if (CollectionUtils.isEmpty(objList)) {
|
||||
return "对象空";
|
||||
}
|
||||
String result;
|
||||
for (T t : objList) {
|
||||
if (ArrayUtils.isEmpty(group)) {
|
||||
result = this.valid(t);
|
||||
} else {
|
||||
result = this.valid(t, group);
|
||||
}
|
||||
if (!StringUtils.isBlank(result)) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -9,3 +9,4 @@ com.bonus.common.security.aspect.PreAuthorizeAspect
|
|||
com.bonus.common.security.aspect.InnerAuthAspect
|
||||
com.bonus.common.security.aspect.PreventRepeatSubmitAspect
|
||||
com.bonus.common.security.handler.GlobalExceptionHandler
|
||||
com.bonus.common.security.utils.ValidatorsUtils
|
||||
|
|
|
|||
|
|
@ -0,0 +1,71 @@
|
|||
package com.bonus.base.basic.controller;
|
||||
|
||||
import com.bonus.base.basic.domain.BmProject;
|
||||
import com.bonus.base.basic.domain.UnitVo;
|
||||
import com.bonus.base.basic.service.IUnitService;
|
||||
import com.bonus.base.common.annotation.PreventRepeatSubmit;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.core.web.page.TableDataInfo;
|
||||
import com.bonus.common.log.annotation.SysLog;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
import com.bonus.common.security.annotation.RequiresPermissions;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @className:UnitController
|
||||
* @author:cwchen
|
||||
* @date:2025-04-10-10:22
|
||||
* @version:1.0
|
||||
* @description:单位管理-控制层
|
||||
*/
|
||||
@Api(tags = "单位管理")
|
||||
@RestController
|
||||
@RequestMapping("/unit")
|
||||
public class UnitController extends BaseController {
|
||||
|
||||
@Resource(name = "IUnitService")
|
||||
private IUnitService service;
|
||||
|
||||
@ApiOperation(value = "查询单位数据")
|
||||
// @RequiresPermissions("basic:unit:list")
|
||||
@SysLog(title = "单位管理", businessType = OperaType.QUERY, logType = 1,module = "单位管理->查询单位数据")
|
||||
@GetMapping("/queryUnitList")
|
||||
public TableDataInfo queryUnitList(UnitVo vo) {
|
||||
startPage();
|
||||
List<UnitVo> list = service.queryUnitList(vo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "新增单位")
|
||||
// @PreventRepeatSubmit
|
||||
// @RequiresPermissions("basic:unit:add")
|
||||
@SysLog(title = "单位管理", businessType = OperaType.INSERT, logType = 1,module = "单位管理->新增单位")
|
||||
@PostMapping("addUnit")
|
||||
public AjaxResult addUnit(@RequestBody UnitVo vo) {
|
||||
return service.addUnit(vo);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改单位")
|
||||
// @PreventRepeatSubmit
|
||||
// @RequiresPermissions("basic:unit:edit")
|
||||
@SysLog(title = "单位管理", businessType = OperaType.UPDATE, logType = 1,module = "单位管理->修改单位")
|
||||
@PostMapping("editUnit")
|
||||
public AjaxResult editUnit(@RequestBody UnitVo vo) {
|
||||
return service.editUnit(vo);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除单位")
|
||||
// @PreventRepeatSubmit
|
||||
// @RequiresPermissions("basic:unit:del")
|
||||
@SysLog(title = "单位管理", businessType = OperaType.UPDATE, logType = 1,module = "单位管理->删除单位")
|
||||
@PostMapping("delUnit")
|
||||
public AjaxResult delUnit(@RequestBody UnitVo vo) {
|
||||
return service.delUnit(vo);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,101 @@
|
|||
package com.bonus.base.basic.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Pattern;
|
||||
|
||||
/**
|
||||
* @className:SysUnitVo
|
||||
* @author:cwchen
|
||||
* @date:2025-04-10-9:44
|
||||
* @version:1.0
|
||||
* @description:参建单位-VO
|
||||
*/
|
||||
@Data
|
||||
public class UnitVo {
|
||||
|
||||
@NotBlank(message = "id不能为空", groups = {Edit.class,Del.class})
|
||||
private String id;
|
||||
/**
|
||||
* 单位名称
|
||||
*/
|
||||
@NotBlank(message = "单位名称不能为空", groups = {Add.class, Edit.class})
|
||||
@Length(max = 64, message = "单位名称字符长度不能超过64", groups = {Add.class, Edit.class})
|
||||
private String unitName;
|
||||
/**
|
||||
* 单位类型
|
||||
*/
|
||||
@NotBlank(message = "单位类型不能为空", groups = {Add.class, Edit.class})
|
||||
private String unitType;
|
||||
/**
|
||||
* 统一信用代码
|
||||
*/
|
||||
@NotBlank(message = "统一信用代码不能为空", groups = {Add.class, Edit.class})
|
||||
@Length(max = 64, message = "统一信用代码字符长度不能超过64", groups = {Add.class, Edit.class})
|
||||
private String unitCode;
|
||||
/**
|
||||
* 联系人
|
||||
*/
|
||||
@NotBlank(message = "联系人不能为空", groups = {Add.class, Edit.class})
|
||||
@Length(max = 32, message = "联系人字符长度不能超过32", groups = {Add.class, Edit.class})
|
||||
private String unitUser;
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
@NotBlank(message = "联系电话不能为空", groups = {Add.class, Edit.class})
|
||||
@Pattern(regexp = "^1[3-9]\\d{9}$", message = "联系电话格式不正确", groups = {Add.class, Edit.class})
|
||||
private String unitPhone;
|
||||
/**
|
||||
* 法人姓名
|
||||
*/
|
||||
@NotBlank(message = "法人姓名不能为空", groups = {Add.class, Edit.class})
|
||||
@Length(max = 32, message = "法人姓名字符长度不能超过32", groups = {Add.class, Edit.class})
|
||||
private String suffUser;
|
||||
/**
|
||||
* 法人手机号
|
||||
*/
|
||||
@NotBlank(message = "法人手机号不能为空", groups = {Add.class, Edit.class})
|
||||
@Pattern(regexp = "^1[3-9]\\d{9}$", message = "法人手机号格式不正确", groups = {Add.class, Edit.class})
|
||||
private String suffPhone;
|
||||
/**
|
||||
* 公司地址
|
||||
*/
|
||||
@Length(max = 32, message = "公司地址字符长度不能超过32", groups = {Add.class, Edit.class})
|
||||
private String address;
|
||||
/**
|
||||
* 公司简介
|
||||
*/
|
||||
@Length(max = 256, message = "公司简介字符长度不能超过256", groups = {Add.class, Edit.class})
|
||||
private String brief;
|
||||
/**
|
||||
* 公司成立日期
|
||||
*/
|
||||
@NotBlank(message = "公司成立日期不能为空", groups = {Add.class, Edit.class})
|
||||
private String createDay;
|
||||
/**
|
||||
* 注册资本
|
||||
*/
|
||||
@Length(max = 32, message = "注册资本字符长度不能超过32", groups = {Add.class, Edit.class})
|
||||
private String register;
|
||||
|
||||
/**
|
||||
* 新增条件限制
|
||||
*/
|
||||
public interface Add {
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改条件限制
|
||||
*/
|
||||
public interface Edit {
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除条件限制
|
||||
*/
|
||||
public interface Del {
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
package com.bonus.base.basic.mapper;
|
||||
|
||||
import com.bonus.base.basic.domain.UnitVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @className:IUnitMapper
|
||||
* @author:cwchen
|
||||
* @date:2025-04-10-10:26
|
||||
* @version:1.0
|
||||
* @description:参建单位-数据层
|
||||
*/
|
||||
@Repository(value = "IUnitMapper")
|
||||
public interface IUnitMapper {
|
||||
|
||||
/**
|
||||
* 查询单位数据
|
||||
*
|
||||
* @param vo
|
||||
* @return List<UnitVo>
|
||||
* @author cwchen
|
||||
* @date 2025/4/10 10:55
|
||||
*/
|
||||
List<UnitVo> queryUnitList(UnitVo vo);
|
||||
|
||||
/**
|
||||
* 查询字段是否重复
|
||||
*
|
||||
* @param vo
|
||||
* @return int
|
||||
* @author cwchen
|
||||
* @date 2025/4/10 13:36
|
||||
*/
|
||||
int queryValueIsExist(@Param("params") UnitVo vo,@Param("value")String value, @Param("columnName") String columnName);
|
||||
|
||||
/**
|
||||
* 1.新增/2.修改/3.删除单位
|
||||
* @param vo
|
||||
* @param type
|
||||
* @return void
|
||||
* @author cwchen
|
||||
* @date 2025/4/10 13:53
|
||||
*/
|
||||
void addOrUpdateUnit(@Param("params") UnitVo vo, @Param("type") int type);
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
package com.bonus.base.basic.service;
|
||||
|
||||
import com.bonus.base.basic.domain.UnitVo;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @className:IUnitService
|
||||
* @author:cwchen
|
||||
* @date:2025-04-10-10:24
|
||||
* @version:1.0
|
||||
* @description:参建单位-业务层
|
||||
*/
|
||||
public interface IUnitService {
|
||||
/**
|
||||
* 查询单位数据
|
||||
* @param vo
|
||||
* @return List<UnitVo>
|
||||
* @author cwchen
|
||||
* @date 2025/4/10 10:52
|
||||
*/
|
||||
List<UnitVo> queryUnitList(UnitVo vo);
|
||||
|
||||
/**
|
||||
* 新增单位
|
||||
* @param vo
|
||||
* @return AjaxResult
|
||||
* @author cwchen
|
||||
* @date 2025/4/10 13:29
|
||||
*/
|
||||
AjaxResult addUnit(UnitVo vo);
|
||||
|
||||
/**
|
||||
* 修改单位
|
||||
* @param vo
|
||||
* @return AjaxResult
|
||||
* @author cwchen
|
||||
* @date 2025/4/10 14:00
|
||||
*/
|
||||
AjaxResult editUnit(UnitVo vo);
|
||||
|
||||
/**
|
||||
* 删除单位
|
||||
* @param vo
|
||||
* @return AjaxResult
|
||||
* @author cwchen
|
||||
* @date 2025/4/10 14:01
|
||||
*/
|
||||
AjaxResult delUnit(UnitVo vo);
|
||||
}
|
||||
|
|
@ -0,0 +1,114 @@
|
|||
package com.bonus.base.basic.service.impl;
|
||||
|
||||
import com.bonus.base.basic.domain.UnitVo;
|
||||
import com.bonus.base.basic.mapper.IUnitMapper;
|
||||
import com.bonus.base.basic.service.IUnitService;
|
||||
import com.bonus.common.core.utils.uuid.IdUtils;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.security.utils.ValidatorsUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @className:UnitServiceImpl
|
||||
* @author:cwchen
|
||||
* @date:2025-04-10-10:25
|
||||
* @version:1.0
|
||||
* @description:参建单位-业务逻辑层
|
||||
*/
|
||||
@Service(value = "IUnitService")
|
||||
@Slf4j
|
||||
public class UnitServiceImpl implements IUnitService {
|
||||
|
||||
@Resource(name = "IUnitMapper")
|
||||
private IUnitMapper mapper;
|
||||
|
||||
@Resource(name = "ValidatorsUtils")
|
||||
private ValidatorsUtils validatorsUtils;
|
||||
|
||||
@Override
|
||||
public List<UnitVo> queryUnitList(UnitVo vo) {
|
||||
try {
|
||||
List<UnitVo> list = Optional.ofNullable(mapper.queryUnitList(vo)).orElseGet(ArrayList::new);
|
||||
return list;
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
return new ArrayList<UnitVo>();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult addUnit(UnitVo vo) {
|
||||
try {
|
||||
// 校验必填数据
|
||||
String validResult = validatorsUtils.valid(vo, UnitVo.Add.class);
|
||||
if (StringUtils.isNotBlank(validResult)) {
|
||||
return AjaxResult.error(validResult);
|
||||
}
|
||||
// 校验公司名称是否重复
|
||||
int flag = mapper.queryValueIsExist(vo,vo.getUnitName(),"unit_name");
|
||||
if (flag > 0) return AjaxResult.error("公司名称已存在");
|
||||
// 校验统一信用代码是否重复
|
||||
int flag2 = mapper.queryValueIsExist(vo,vo.getUnitCode(),"unit_code");
|
||||
if (flag2 > 0) return AjaxResult.error("统一信用代码已存在");
|
||||
vo.setId(IdUtils.simpleUUID());
|
||||
mapper.addOrUpdateUnit(vo,1);
|
||||
return AjaxResult.success();
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult editUnit(UnitVo vo) {
|
||||
try {
|
||||
// 校验必填数据
|
||||
String validResult = validatorsUtils.valid(vo, UnitVo.Edit.class);
|
||||
if (StringUtils.isNotBlank(validResult)) {
|
||||
return AjaxResult.error(validResult);
|
||||
}
|
||||
// 校验公司名称是否重复
|
||||
int flag = mapper.queryValueIsExist(vo,vo.getUnitName(),"unit_name");
|
||||
if (flag > 0) return AjaxResult.error("公司名称已存在");
|
||||
// 校验统一信用代码是否重复
|
||||
int flag2 = mapper.queryValueIsExist(vo,vo.getUnitCode(),"unit_code");
|
||||
if (flag2 > 0) return AjaxResult.error("统一信用代码已存在");
|
||||
mapper.addOrUpdateUnit(vo,2);
|
||||
return AjaxResult.success();
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult delUnit(UnitVo vo) {
|
||||
try {
|
||||
// 校验必填数据
|
||||
String validResult = validatorsUtils.valid(vo, UnitVo.Del.class);
|
||||
if (StringUtils.isNotBlank(validResult)) {
|
||||
return AjaxResult.error(validResult);
|
||||
}
|
||||
mapper.addOrUpdateUnit(vo,3);
|
||||
return AjaxResult.success();
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
<?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.bonus.base.basic.mapper.IUnitMapper">
|
||||
<insert id="addOrUpdateUnit">
|
||||
<if test="type == 1">
|
||||
INSERT INTO tt_sys_unit
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="params.id != null and params.id != ''">id,</if>
|
||||
<if test="params.unitName != null and params.unitName != ''">unit_name,</if>
|
||||
<if test="params.unitType != null and params.unitType != ''">unit_type,</if>
|
||||
<if test="params.unitCode != null and params.unitCode != ''">unit_code,</if>
|
||||
<if test="params.unitUser != null and params.unitUser!=''">unit_user,</if>
|
||||
<if test="params.unitPhone != null and params.unitPhone!=''">unit_phone,</if>
|
||||
<if test="params.suffUser != null and params.suffUser!=''">suff_user,</if>
|
||||
<if test="params.suffPhone != null and params.suffPhone!=''">suff_phone,</if>
|
||||
<if test="params.address != null and params.address!=''">address,</if>
|
||||
<if test="params.brief != null and params.brief!=''">brief,</if>
|
||||
<if test="params.createDay != null and params.createDay!=''">create_day,</if>
|
||||
<if test="params.register != null and params.register!=''">register,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="params.id != null and params.id != ''">#{params.id},</if>
|
||||
<if test="params.unitName != null and params.unitName != ''">#{params.unitName},</if>
|
||||
<if test="params.unitType != null and params.unitType != ''">#{params.unitType},</if>
|
||||
<if test="params.unitCode != null and params.unitCode != ''">#{params.unitCode},</if>
|
||||
<if test="params.unitUser != null and params.unitUser!=''">#{params.unitUser},</if>
|
||||
<if test="params.unitPhone != null and params.unitPhone!=''">#{params.unitPhone},</if>
|
||||
<if test="params.suffUser != null and params.suffUser!=''">#{params.suffUser},</if>
|
||||
<if test="params.suffPhone != null and params.suffPhone!=''">#{params.suffPhone},</if>
|
||||
<if test="params.address != null and params.address!=''">#{params.address},</if>
|
||||
<if test="params.brief != null and params.brief!=''">#{params.brief},</if>
|
||||
<if test="params.createDay != null and params.createDay!=''">#{params.createDay},</if>
|
||||
<if test="params.register != null and params.register!=''">#{params.register},</if>
|
||||
</trim>
|
||||
</if>
|
||||
<if test="type == 2">
|
||||
UPDATE tt_sys_unit
|
||||
<trim prefix="SET " suffixOverrides=",">
|
||||
unit_name = #{params.unitName},
|
||||
unit_type = #{params.unitType},
|
||||
unit_code = #{params.unitCode},
|
||||
unit_user = #{params.unitUser},
|
||||
unit_phone =#{params.unitPhone},
|
||||
suff_user = #{params.suffUser},
|
||||
suff_phone = #{params.suffPhone},
|
||||
address = #{params.address},
|
||||
brief = #{params.brief},
|
||||
create_day = #{params.createDay},
|
||||
register = #{params.register},
|
||||
</trim>
|
||||
WHERE id = #{params.id}
|
||||
</if>
|
||||
<if test="type == 3">
|
||||
UPDATE tt_sys_unit SET is_active = '0' WHERE id = #{params.id}
|
||||
</if>
|
||||
</insert>
|
||||
|
||||
<!--查询单位数据-->
|
||||
<select id="queryUnitList" resultType="com.bonus.base.basic.domain.UnitVo">
|
||||
SELECT id,
|
||||
unit_name AS unitName,
|
||||
unit_type AS unitType,
|
||||
unit_code AS unitCode,
|
||||
unit_user AS unitUser,
|
||||
unit_phone AS unitPhone,
|
||||
suff_user AS suffUser,
|
||||
suff_phone AS suffPhone,
|
||||
address AS address,
|
||||
brief AS brief,
|
||||
create_day AS createDay,
|
||||
register AS register
|
||||
FROM tt_sys_unit
|
||||
<where>
|
||||
AND is_active = '1'
|
||||
</where>
|
||||
</select>
|
||||
<!--查询字段是否重复-->
|
||||
<select id="queryValueIsExist" resultType="java.lang.Integer">
|
||||
<if test="params.id==null or params.id==''">
|
||||
SELECT COUNT(1)
|
||||
FROM tt_sys_unit
|
||||
WHERE ${columnName} = #{value} AND is_active = '1'
|
||||
</if>
|
||||
<if test="params.id!=null and params.id!=''">
|
||||
SELECT COUNT(1)
|
||||
FROM tt_sys_unit
|
||||
WHERE ${columnName} = #{value} AND id != #{params.id} AND is_active = '1'
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue