123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- package req
- import (
- "github.com/druidcaesa/gotool"
- "ulink-admin/pkg/base"
- "xorm.io/xorm"
- )
- type RoleQuery struct {
- base.GlobalQuery
- RoleName string `form:"roleName"`
- Status string `form:"status"`
- RoleKey string `form:"roleKey"`
-
- }
- 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)
- }
- }
- type RoleBody struct {
- Id int64 `json:"id"`
- Status string `json:"status"`
- }
|