Skip to content

del_flag代码不规范问题 #169

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bosscloud opened this issue May 31, 2019 · 7 comments
Closed

del_flag代码不规范问题 #169

bosscloud opened this issue May 31, 2019 · 7 comments

Comments

@bosscloud
Copy link

在版本中出现,删除状态应该统一规范 0是正常,1是删除;
但是在字典表数据管理中,研发人员使用1为正常,2标识删除;
如何后期引用mybatis-plus 3.1.1版本既可以删除@TableLogic就可了。

@zhangdaiscott
Copy link
Member

zhangdaiscott commented May 31, 2019

你用的是那个版本,现在已经修复了

@bosscloud
Copy link
Author

希望针对系统字典类型,不可以修改与删除,以免产生系统不可预估为题,影响运维以及研发上面的不必要的抢修时间消耗

@Getter
@AllArgsConstructor
public enum DictTypeEnum {
	/**
	 * 字典类型-系统内置(不可修改)
	 */
	SYSTEM("1", "系统内置"),

	/**
	 * 字典类型-业务类型
	 */
	BIZ("0", "业务类");

	/**
	 * 类型
	 */
	private String type;
	/**
	 * 描述
	 */
	private String description;
}

@bosscloud
Copy link
Author

使用的是 jeecg-boot 2.0 版本

@zhangdaiscott
Copy link
Member

看到了,感谢,这块写的不规范

@bosscloud
Copy link
Author

在代码充简单的一个删除,系统居然要查一遍,然后再删除。两次动用了数据库,如下:

	/**
	 * @功能:删除
	 * @param id
	 * @return
	 */
	@RequestMapping(value = "/delete", method = RequestMethod.DELETE)
	@CacheEvict(value="dictCache", allEntries=true)
	public Result<SysDict> delete(@RequestParam(name="id",required=true) String id) {
		Result<SysDict> result = new Result<SysDict>();
		SysDict sysDict = sysDictService.getById(id);
		if(sysDict==null) {
			result.error500("未找到对应实体");
		}else {
			boolean ok = sysDictService.removeById(sysDict);
			if(ok) {
				result.success("删除成功!");
			}
		}
		return result;
	}

建议一次性删除语句,且同时优化代码生成器里面代码。

@zhangdaiscott
Copy link
Member

ok

@zhangdaiscott
Copy link
Member

第一个问题,
第三个问题已经修复

下个版本发布
(第二个问题,暂时不做复杂配置,默认字典都是逻辑删除,这样不会影响老数据,老数据用了这个字典,还会显示)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants