修改delFlag属性为Integer类型

This commit is contained in:
dataprince 2023-12-19 16:10:22 +08:00
parent 7bde7c05bc
commit 95e54ad11a
10 changed files with 41 additions and 49 deletions

View File

@ -21,7 +21,6 @@
<mybatis-flex.version>1.7.5</mybatis-flex.version>
<mybatis-spring.version>3.0.3</mybatis-spring.version>
<satoken.version>1.37.0</satoken.version>
<mysql.version>8.0.33</mysql.version>
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
<HikariCP.version>5.0.1</HikariCP.version>
<bitwalker.version>1.21</bitwalker.version>
@ -179,13 +178,6 @@
<version>${satoken.version}</version>
</dependency>
<!-- Mysql驱动包 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.version}</version>
</dependency>
<!-- servlet包 -->
<dependency>
<groupId>jakarta.servlet</groupId>

View File

@ -27,8 +27,8 @@
<!-- Mysql驱动包 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
</dependency>
<!-- PostgreSql -->

View File

@ -74,7 +74,7 @@ public class SysClient extends BaseEntity {
* 删除标志0代表存在 1代表删除
*/
@Column(isLogicDelete = true)
private String delFlag;
private Integer delFlag;
}

View File

@ -38,7 +38,7 @@ public class SysDept extends BaseEntity
private String orderNum;
/** 负责人 */
private String leader;//TODO:修改为Long类型
private String leader;//TODO:修改为Long类型?
/** 联系电话 */
private String phone;
@ -49,8 +49,8 @@ public class SysDept extends BaseEntity
/** 部门状态:0正常,1停用 */
private String status;
/** 删除标志0代表存在 2代表删除) */
private String delFlag;
/** 删除标志0代表存在 1代表删除) */
private Integer delFlag;
/** 父部门名称 */
@Column(ignore = true)

View File

@ -61,9 +61,9 @@ public class SysRole extends BaseEntity {
private String status;
/**
* 删除标志0代表存在 2代表删除
* 删除标志0代表存在 1代表删除
*/
private String delFlag;
private Integer delFlag;
/**
* 备注

View File

@ -65,8 +65,8 @@ public class SysUser extends BaseEntity
/** 帐号状态0正常 1停用 */
private String status;
/** 删除标志0代表存在 2代表删除) */
private String delFlag;
/** 删除标志0代表存在 1代表删除) */
private Integer delFlag;
/** 最后登录IP */
private String loginIp;

View File

@ -44,7 +44,7 @@ public interface SysRoleMapper extends BaseMapper<SysRole>
.leftJoin(SYS_USER_ROLE).as("ur").on(SYS_USER_ROLE.ROLE_ID.eq(SYS_ROLE.ROLE_ID))
.leftJoin(SYS_USER).as("u").on(SYS_USER.USER_ID.eq(SYS_USER_ROLE.USER_ID))
.leftJoin(SYS_DEPT).as("d").on(SYS_DEPT.DEPT_ID.eq(SYS_USER.DEPT_ID));
queryWrapper.where(SYS_ROLE.DEL_FLAG.eq("0"))
queryWrapper.where(SYS_ROLE.DEL_FLAG.eq(0))
.and(SYS_USER_ROLE.USER_ID.eq(userId));
List<SysRoleVo> userRoles = selectListByQueryAs(queryWrapper, SysRoleVo.class);

View File

@ -68,7 +68,7 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptMapper, SysDept>
*/
private QueryWrapper buildQueryWrapper(SysDeptBo deptBo) {
QueryWrapper queryWrapper = super.buildBaseQueryWrapper();
queryWrapper.where(SYS_DEPT.DEL_FLAG.eq("0"));
queryWrapper.where(SYS_DEPT.DEL_FLAG.eq(0));
if (ObjectUtil.isNotNull(deptBo.getDeptId())) {
queryWrapper.and(SYS_DEPT.DEPT_ID.eq(deptBo.getDeptId()));
@ -173,7 +173,7 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptMapper, SysDept>
@Cacheable(cacheNames = CacheNames.SYS_DEPT, key = "#deptId")
@Override
public SysDeptVo selectDeptById(Long deptId) {
QueryWrapper queryWrapper = query().where(SYS_DEPT.DEL_FLAG.eq("0"));
QueryWrapper queryWrapper = query().where(SYS_DEPT.DEL_FLAG.eq(0));
queryWrapper.and(SYS_DEPT.DEPT_ID.eq(deptId));
return this.getOneAs(queryWrapper, SysDeptVo.class);//TODO:缺少parent_name
}
@ -185,7 +185,7 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptMapper, SysDept>
*/
@Override
public long selectDeptCountByName(String deptName) {
QueryWrapper queryWrapper = query().where(SYS_DEPT.DEL_FLAG.eq("0")).and(SYS_DEPT.DEPT_NAME.eq(deptName)).and(SYS_DEPT.STATUS.eq("0"));
QueryWrapper queryWrapper = query().where(SYS_DEPT.DEL_FLAG.eq(0)).and(SYS_DEPT.DEPT_NAME.eq(deptName)).and(SYS_DEPT.STATUS.eq("0"));
return this.count(queryWrapper);
}
@ -196,7 +196,7 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptMapper, SysDept>
*/
@Override
public SysDeptVo selectDeptByName(String deptName) {
QueryWrapper queryWrapper = query().where(SYS_DEPT.DEL_FLAG.eq("0")).and(SYS_DEPT.DEPT_NAME.eq(deptName)).and(SYS_DEPT.STATUS.eq("0"));
QueryWrapper queryWrapper = query().where(SYS_DEPT.DEL_FLAG.eq(0)).and(SYS_DEPT.DEPT_NAME.eq(deptName)).and(SYS_DEPT.STATUS.eq("0"));
return this.getOneAs(queryWrapper,SysDeptVo.class);
}
@ -212,7 +212,7 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptMapper, SysDept>
.select(QueryMethods.count(SYS_DEPT.DEPT_ID))
.from(SYS_DEPT)
.where(SYS_DEPT.STATUS.eq("0"))
.and(SYS_DEPT.DEL_FLAG.eq("0"))
.and(SYS_DEPT.DEL_FLAG.eq(0))
.and(QueryMethods.findInSet(QueryMethods.number(deptId),SYS_DEPT.ANCESTORS).gt(0));
return deptMapper.selectObjectByQueryAs(queryWrapper,Integer.class);
@ -229,7 +229,7 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptMapper, SysDept>
QueryWrapper queryWrapper = QueryWrapper.create()
.select(QueryMethods.count(SYS_DEPT.DEPT_ID))
.from(SYS_DEPT)
.where(SYS_DEPT.DEL_FLAG.eq("0"))
.where(SYS_DEPT.DEL_FLAG.eq(0))
.and(SYS_DEPT.PARENT_ID.eq(deptId));
int result = deptMapper.selectObjectByQueryAs(queryWrapper,Integer.class);
@ -247,7 +247,7 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptMapper, SysDept>
public boolean checkDeptNameUnique(SysDeptBo dept) {
Long deptId = ObjectUtil.isNull(dept.getDeptId()) ? -1L : dept.getDeptId();
QueryWrapper queryWrapper = query().where(SYS_DEPT.DEL_FLAG.eq("0"));
QueryWrapper queryWrapper = query().where(SYS_DEPT.DEL_FLAG.eq(0));
queryWrapper.and(SYS_DEPT.DEPT_NAME.eq(dept.getDeptName()));
queryWrapper.and(SYS_DEPT.PARENT_ID.eq(dept.getParentId()));
SysDeptVo info = this.getOneAs(queryWrapper, SysDeptVo.class);
@ -295,7 +295,7 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptMapper, SysDept>
}
SysDept dept = MapstructUtils.convert(deptBo, SysDept.class);
dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
dept.setDelFlag("0");//0 代表存在
dept.setDelFlag(0);//0 代表存在
return this.save(dept);
}
@ -379,7 +379,7 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptMapper, SysDept>
//update sys_dept set del_flag = '1' where dept_id = #{deptId}
SysDept sysDept = new SysDept();
sysDept.setDeptId(deptId);
sysDept.setDelFlag("1");
sysDept.setDelFlag(1);
return this.updateById(sysDept);
}

View File

@ -77,7 +77,7 @@ public class SysRoleServiceImpl extends BaseServiceImpl<SysRoleMapper, SysRole>
.leftJoin(SYS_USER).as("u").on(SYS_USER.USER_ID.eq(SYS_USER_ROLE.USER_ID))
.leftJoin(SYS_DEPT).as("d").on(SYS_DEPT.DEPT_ID.eq(SYS_USER.DEPT_ID));
queryWrapper.where(SYS_ROLE.DEL_FLAG.eq("0"));
queryWrapper.where(SYS_ROLE.DEL_FLAG.eq(0));
if (ObjectUtil.isNotNull(roleBo.getRoleId())) {
queryWrapper.and(SYS_ROLE.ROLE_ID.eq(roleBo.getRoleId()));
}
@ -145,7 +145,7 @@ public class SysRoleServiceImpl extends BaseServiceImpl<SysRoleMapper, SysRole>
.leftJoin(SYS_USER_ROLE).as("ur").on(SYS_USER_ROLE.ROLE_ID.eq(SYS_ROLE.ROLE_ID))
.leftJoin(SYS_USER).as("u").on(SYS_USER.USER_ID.eq(SYS_USER_ROLE.USER_ID))
.leftJoin(SYS_DEPT).as("d").on(SYS_DEPT.DEPT_ID.eq(SYS_USER.DEPT_ID));
queryWrapper.where(SYS_ROLE.DEL_FLAG.eq("0"))
queryWrapper.where(SYS_ROLE.DEL_FLAG.eq(0))
.and(SYS_USER_ROLE.USER_ID.eq(userId));
List<SysRoleVo> userRoles = this.listAs(queryWrapper, SysRoleVo.class);
@ -205,7 +205,7 @@ public class SysRoleServiceImpl extends BaseServiceImpl<SysRoleMapper, SysRole>
.leftJoin(SYS_USER_ROLE).as("ur").on(SYS_USER_ROLE.ROLE_ID.eq(SYS_ROLE.ROLE_ID))
.leftJoin(SYS_USER).as("u").on(SYS_USER.USER_ID.eq(SYS_USER_ROLE.USER_ID))
.leftJoin(SYS_DEPT).as("d").on(SYS_DEPT.DEPT_ID.eq(SYS_USER.DEPT_ID));
queryWrapper.where(SYS_ROLE.DEL_FLAG.eq("0"))
queryWrapper.where(SYS_ROLE.DEL_FLAG.eq(0))
.and(SYS_USER_ROLE.USER_ID.eq(userId));
List<SysRoleVo> perms = this.listAs(queryWrapper, SysRoleVo.class);
//List<SysRole> perms = roleMapper.selectRolePermissionByUserId(userId);
@ -272,7 +272,7 @@ public class SysRoleServiceImpl extends BaseServiceImpl<SysRoleMapper, SysRole>
public boolean checkRoleNameUnique(SysRoleBo roleBo) {
Long roleId = ObjectUtil.isNull(roleBo.getRoleId()) ? -1L : roleBo.getRoleId();
QueryWrapper queryWrapper = query().where(SYS_ROLE.ROLE_NAME.eq(roleBo.getRoleName()))
.and(SYS_ROLE.DEL_FLAG.eq("0"));
.and(SYS_ROLE.DEL_FLAG.eq(0));
SysRole info = this.getOne(queryWrapper);
if (ObjectUtil.isNotNull(info) && info.getRoleId().longValue() != roleId.longValue()) {
return UserConstants.NOT_UNIQUE;
@ -290,7 +290,7 @@ public class SysRoleServiceImpl extends BaseServiceImpl<SysRoleMapper, SysRole>
public boolean checkRoleKeyUnique(SysRoleBo roleBo) {
Long roleId = ObjectUtil.isNull(roleBo.getRoleId()) ? -1L : roleBo.getRoleId();
QueryWrapper queryWrapper = query().where(SYS_ROLE.ROLE_KEY.eq(roleBo.getRoleKey()))
.and(SYS_ROLE.DEL_FLAG.eq("0"));
.and(SYS_ROLE.DEL_FLAG.eq(0));
SysRole info = this.getOne(queryWrapper);
if (ObjectUtil.isNotNull(info) && info.getRoleId().longValue() != roleId.longValue()) {
return UserConstants.NOT_UNIQUE;
@ -359,7 +359,7 @@ public class SysRoleServiceImpl extends BaseServiceImpl<SysRoleMapper, SysRole>
@Transactional
public boolean insertRole(SysRoleBo roleBo) {
SysRole role = MapstructUtils.convert(roleBo, SysRole.class);
role.setDelFlag("0");
role.setDelFlag(0);
role.setDataScope("1");//默认1全部数据权限
// 新增角色信息
boolean inserted = this.save(role);//使用全局配置的雪花算法主键生成器生成ID值
@ -563,7 +563,7 @@ public class SysRoleServiceImpl extends BaseServiceImpl<SysRoleMapper, SysRole>
.leftJoin(SYS_USER_ROLE).as("ur").on(SYS_USER_ROLE.ROLE_ID.eq(SYS_ROLE.ROLE_ID))
.leftJoin(SYS_USER).as("u").on(SYS_USER.USER_ID.eq(SYS_USER_ROLE.USER_ID))
.leftJoin(SYS_DEPT).as("d").on(SYS_DEPT.DEPT_ID.eq(SYS_USER.DEPT_ID))
.where(SYS_ROLE.DEL_FLAG.eq("0"))
.where(SYS_ROLE.DEL_FLAG.eq(0))
.and(SYS_USER.USER_NAME.eq(userName));
return this.listAs(queryWrapper, SysRoleVo.class);
}

View File

@ -93,7 +93,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserMapper, SysUser>
.select(SYS_USER.USER_ID,SYS_USER.TENANT_ID,SYS_USER.DEPT_ID,SYS_USER.NICK_NAME,SYS_USER.USER_NAME,SYS_USER.USER_TYPE,SYS_USER.EMAIL,SYS_USER.AVATAR,SYS_USER.PHONENUMBER,SYS_USER.GENDER,SYS_USER.STATUS,SYS_USER.DEL_FLAG,SYS_USER.LOGIN_IP,SYS_USER.LOGIN_DATE,SYS_USER.CREATE_BY,SYS_USER.CREATE_TIME,SYS_USER.REMARK,SYS_DEPT.DEPT_NAME,SYS_DEPT.LEADER)
.from(SYS_USER.as("u"))
.leftJoin(SYS_DEPT).as("d").on(SYS_DEPT.DEPT_ID.eq(SYS_USER.DEPT_ID))
.where(SYS_USER.DEL_FLAG.eq("0"));
.where(SYS_USER.DEL_FLAG.eq(0));
if (ObjectUtil.isNotNull(userBo.getUserId())) {
queryWrapper.and(SYS_USER.USER_ID.eq(userBo.getUserId()));
}
@ -139,7 +139,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserMapper, SysUser>
))
.from(SYS_USER.as("u"))
.leftJoin(SYS_DEPT).as("d").on(SYS_DEPT.DEPT_ID.eq(SYS_USER.DEPT_ID))
.where(SYS_USER.DEL_FLAG.eq("0"));
.where(SYS_USER.DEL_FLAG.eq(0));
//.leftJoin(SYS_USER_ROLE).as("ur").on(SYS_USER_ROLE.USER_ID.eq(SYS_USER.USER_ID))
//.leftJoin(SYS_ROLE).as("r").on(SYS_ROLE.ROLE_ID.eq(SYS_USER_ROLE.ROLE_ID));
}
@ -198,7 +198,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserMapper, SysUser>
.leftJoin(SYS_DEPT).as("d").on(SYS_DEPT.DEPT_ID.eq(SYS_USER.DEPT_ID))
.leftJoin(SYS_USER_ROLE).as("ur").on(SYS_USER_ROLE.USER_ID.eq(SYS_USER.USER_ID))
.leftJoin(SYS_ROLE).as("r").on(SYS_ROLE.ROLE_ID.eq(SYS_USER_ROLE.ROLE_ID))
.where(SYS_USER.DEL_FLAG.eq("0"))
.where(SYS_USER.DEL_FLAG.eq(0))
.and(SYS_ROLE.ROLE_ID.eq(userBo.getRoleId()));
if (StringUtils.isNotEmpty(userBo.getUserName())) {
queryWrapper.and(SYS_USER.USER_NAME.like(userBo.getUserName()));
@ -240,7 +240,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserMapper, SysUser>
.leftJoin(SYS_DEPT).as("d").on(SYS_DEPT.DEPT_ID.eq(SYS_USER.DEPT_ID))
.leftJoin(SYS_USER_ROLE).as("ur").on(SYS_USER_ROLE.USER_ID.eq(SYS_USER.USER_ID))
.leftJoin(SYS_ROLE).as("r").on(SYS_ROLE.ROLE_ID.eq(SYS_USER_ROLE.ROLE_ID))
.where(SYS_USER.DEL_FLAG.eq("0"))
.where(SYS_USER.DEL_FLAG.eq(0))
.and(SYS_USER.STATUS.eq("0"))
.and(SYS_ROLE.ROLE_ID.ne(userBo.getRoleId()).or(SYS_ROLE.ROLE_ID.isNull()))
.and(SYS_USER.USER_ID.notIn(select(SYS_USER.USER_ID).from(SYS_USER.as("u")).innerJoin(SYS_USER_ROLE).as("ur").on(SYS_USER_ROLE.USER_ID.eq(SYS_USER.USER_ID).and(SYS_USER_ROLE.ROLE_ID.eq(userBo.getRoleId())))));
@ -264,7 +264,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserMapper, SysUser>
@Override
public SysUserVo selectUserByUserName(String userName) {
QueryWrapper queryWrapper = buildOneQueryWrapper();
queryWrapper.where(SYS_USER.DEL_FLAG.eq("0"));
queryWrapper.where(SYS_USER.DEL_FLAG.eq(0));
if (StringUtils.isNotEmpty(userName)) {
queryWrapper.and(SYS_USER.USER_NAME.eq(userName));
}
@ -280,7 +280,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserMapper, SysUser>
@Override
public SysUserVo selectUserByEmail(String email) {
QueryWrapper queryWrapper = buildOneQueryWrapper();
queryWrapper.where(SYS_USER.DEL_FLAG.eq("0"));
queryWrapper.where(SYS_USER.DEL_FLAG.eq(0));
if (StringUtils.isNotEmpty(email)) {
queryWrapper.and(SYS_USER.EMAIL.eq(email));
}
@ -318,7 +318,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserMapper, SysUser>
))
.from(SYS_USER.as("u"))
.leftJoin(SYS_DEPT).as("d").on(SYS_DEPT.DEPT_ID.eq(SYS_USER.DEPT_ID))
.where(SYS_USER.DEL_FLAG.eq("0"));
.where(SYS_USER.DEL_FLAG.eq(0));
if (ObjectUtil.isNotNull(userId)) {
queryWrapper.and(SYS_USER.USER_ID.eq(userId));
}
@ -365,7 +365,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserMapper, SysUser>
public boolean checkUserNameUnique(SysUserBo userBo) {
Long userId = ObjectUtil.isNull(userBo.getUserId()) ? -1L : userBo.getUserId();
QueryWrapper queryWrapper = query().where(SYS_USER.USER_NAME.eq(userBo.getUserName()))
.and(SYS_USER.DEL_FLAG.eq("0"));
.and(SYS_USER.DEL_FLAG.eq(0));
SysUser info = this.getOne(queryWrapper);
if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) {
return UserConstants.NOT_UNIQUE;
@ -383,7 +383,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserMapper, SysUser>
public boolean checkPhoneUnique(SysUserBo user) {
Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
QueryWrapper queryWrapper = query().where(SYS_USER.PHONENUMBER.eq(user.getPhonenumber()))
.and(SYS_USER.DEL_FLAG.eq("0"));
.and(SYS_USER.DEL_FLAG.eq(0));
SysUser info = this.getOne(queryWrapper);
if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) {
return UserConstants.NOT_UNIQUE;
@ -401,7 +401,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserMapper, SysUser>
public boolean checkEmailUnique(SysUserBo user) {
Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
QueryWrapper queryWrapper = query().where(SYS_USER.EMAIL.eq(user.getEmail()))
.and(SYS_USER.DEL_FLAG.eq("0"));
.and(SYS_USER.DEL_FLAG.eq(0));
SysUser info = this.getOne(queryWrapper);
if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) {
return UserConstants.NOT_UNIQUE;
@ -455,7 +455,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserMapper, SysUser>
.select(QueryMethods.count(SYS_USER.USER_ID))
.from(SYS_USER)
.where(SYS_USER.DEPT_ID.eq(deptId))
.and(SYS_USER.DEL_FLAG.eq("0"));
.and(SYS_USER.DEL_FLAG.eq(0));
int result = userMapper.selectObjectByQueryAs(queryWrapper,Integer.class);
return result > 0;
@ -659,7 +659,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserMapper, SysUser>
//逻辑删除用户update sys_user set del_flag = '1' where user_id = #{userId}
SysUser sysUser = new SysUser();
sysUser.setUserId(userId);
sysUser.setDelFlag("1");
sysUser.setDelFlag(1);
return this.updateById(sysUser);
}
@ -684,7 +684,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserMapper, SysUser>
//逻辑删除update sys_user set del_flag = '1' where user_id in
QueryWrapper queryWrapper = query().where(SYS_USER.USER_ID.in(Arrays.asList(userIds)));
SysUser sysUser = new SysUser();
sysUser.setDelFlag("1");
sysUser.setDelFlag(1);
return this.update(sysUser,queryWrapper);
//return UpdateChain.of(SysUser.class)
// .set(SysUser::getDelFlag, "1")
@ -765,7 +765,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserMapper, SysUser>
*/
@Override
public List<SysUserVo> selectUserListByDept(Long deptId) {
QueryWrapper queryWrapper = query().where(SYS_USER.DEPT_ID.eq(deptId)).and(SYS_USER.DEL_FLAG.eq("0"));
QueryWrapper queryWrapper = query().where(SYS_USER.DEPT_ID.eq(deptId)).and(SYS_USER.DEL_FLAG.eq(0));
return this.listAs(queryWrapper,SysUserVo.class);
}
}