123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- package req
- import (
- "github.com/druidcaesa/gotool"
- "ulink-admin/pkg/base"
- "xorm.io/xorm"
- )
- // RoleQuery 角色Get请求参数
- type RoleQuery struct {
- base.GlobalQuery
- RoleName string `form:"roleName"` //角色名称
- Status string `form:"status"` //角色状态
- RoleKey string `form:"roleKey"` //角色Key
- //fun base.TableFunc
- }
- func (this *RoleQuery) Page() int {
- return this.PageNum
- }
- func (this *RoleQuery) Size() int {
- return this.PageSize
- }
- func (this *RoleQuery) Where(session *xorm.Session) {
- if !gotool.StrUtils.HasEmpty(this.RoleName) {
- session.And("role_name like concat('%', ?, '%')", this.RoleName)
- }
- if !gotool.StrUtils.HasEmpty(this.Status) {
- session.And("status = ?", this.Status)
- }
- if !gotool.StrUtils.HasEmpty(this.RoleKey) {
- session.And("role_key like concat('%', ?, '%')", this.RoleKey)
- }
- if !gotool.StrUtils.HasEmpty(this.BeginTime) {
- session.And("create_time >= date_format(?,'%y%m%d')", this.BeginTime)
- }
- if !gotool.StrUtils.HasEmpty(this.EndTime) {
- session.And("create_time,'%y%m%d') <= date_format(?,'%y%m%d')", this.EndTime)
- }
- }
- /*func (this *RoleQuery) Table(session *xorm.Session) {
- this.fun(session)
- }*/
- /*func (this *RoleQuery) SetTable(f base.TableFunc) {
- this.fun = f
- }*/
- /*func (this *RoleQuery) (session *xorm.Session) {
- session.Table([]string{model.SysRole{}.TableName(), "r"}).
- Join("LEFT", []string{"sys_user_role", "ur"}, "ur.role_id = r.id").
- Join("LEFT", []string{"sys_user", "u"}, "u.id = ur.user_id").
- Join("LEFT", []string{"sys_dept", "d"}, "u.dept_id = d.id")
- }*/
- // RoleBody 角色Post和Put参数
- type RoleBody struct {
- Id int64 `json:"id"`
- Status string `json:"status"`
- }
|