This commit is contained in:
Mr. Lan 2020-07-19 10:47:20 +08:00
parent 8231711e3b
commit 4a39a38255
3 changed files with 3 additions and 2 deletions

View File

@ -32,6 +32,7 @@ func CreateClassify(c *gin.Context) {
// 判断创建的分类是否存在
err = orm.Eloquent.Table("p_process_classify").
Where("name = ?", classifyValue.Name).
Where("`delete_time` IS NULL").
Count(&classifyCount).Error
if err != nil {
app.Error(c, -1, err, "")

View File

@ -108,7 +108,7 @@ func (role *SysRole) GetRoleMeunId() ([]int, error) {
func (role *SysRole) Insert() (id int, err error) {
i := 0
orm.Eloquent.Table("sys_role").Where("role_name=? or role_key = ?", role.RoleName, role.RoleKey).Count(&i)
orm.Eloquent.Table("sys_role").Where("(role_name = ? or role_key = ?) and `delete_time` IS NULL", role.RoleName, role.RoleKey).Count(&i)
if i > 0 {
return 0, errors.New("角色名称或者角色标识已经存在!")
}

View File

@ -249,7 +249,7 @@ func (e SysUser) Insert() (id int, err error) {
// check 用户名
var count int
orm.Eloquent.Table(e.TableName()).Where("username = ?", e.Username).Count(&count)
orm.Eloquent.Table(e.TableName()).Where("username = ? and `delete_time` IS NULL", e.Username).Count(&count)
if count > 0 {
err = errors.New("账户已存在!")
return