diff --git a/dsBaseRpc/Sql/t_base_organization.sql b/dsBaseRpc/Sql/t_base_organization.sql index e71c5250..8bf74501 100644 --- a/dsBaseRpc/Sql/t_base_organization.sql +++ b/dsBaseRpc/Sql/t_base_organization.sql @@ -33,5 +33,5 @@ SELECT DATE_FORMAT(t1.`create_time`,'%Y/%m/%d %H:%i:%s') AS `create_time`, case t1.`b_use` when -1 then 1 else 0 end AS `del_flag` FROM - `t_base_organization` as t1 where t1.b_use=1 + `t_base_organization` as t1 where t1.b_use in (1,-2) ) as t1 \ No newline at end of file diff --git a/dsBaseRpc/Utils/SqlKit/SqlKit.go b/dsBaseRpc/Utils/SqlKit/SqlKit.go index 47152397..38e2b354 100644 --- a/dsBaseRpc/Utils/SqlKit/SqlKit.go +++ b/dsBaseRpc/Utils/SqlKit/SqlKit.go @@ -32,7 +32,8 @@ func DeleteIds(tableName string, ids []string) error { //2、获取此表的主键 _, PkField := GetTablePk(tableName) //3、批量删除 - var myBuilder = builder.Dialect(builder.MYSQL).Update(builder.Eq{"b_use": -1}).From(tableName).Where(builder.In(PkField, ids)) + // -1:未启用,-2:删除 + var myBuilder = builder.Dialect(builder.MYSQL).Update(builder.Eq{"b_use": -2}).From(tableName).Where(builder.In(PkField, ids)) sql, _ := myBuilder.ToBoundSQL() _, err := db.SQL(sql).Execute() return err