Commit d96df699 authored by 张宽's avatar 张宽

first commit

parent 4baf4693
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
#!/bin/bash
rm -rf dao/src/main/java/com/haomostudio/SeekTruthBackend/*
rm -rf domain/src/main/java/com/haomostudio/SeekTruthBackend/*
rm -rf web/src/main/resources/mybatis/com/haomostudio/SeekTruthBackend/*
#!/bin/bash
rm -rf dao/src/main/java/com/haomostudio/zhangjiakouapibackend/dao/*
rm -rf domain/src/main/java/com/haomostudio/zhangjiakouapibackend/domain/*
rm -rf web/src/main/resources/mybatis/com/haomostudio/zhangjiakouapibackend/crm/*
package com.haomostudio.delivery.dao;
import com.haomostudio.delivery.po.Catalog;
import com.haomostudio.delivery.po.CatalogExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds;
public interface CatalogMapper {
long countByExample(CatalogExample example);
int deleteByExample(CatalogExample example);
int deleteByPrimaryKey(String cid);
int insert(Catalog record);
int insertSelective(Catalog record);
List<Catalog> selectByExampleWithRowbounds(CatalogExample example, RowBounds rowBounds);
List<Catalog> selectByExample(CatalogExample example);
Catalog selectByPrimaryKey(String cid);
int updateByExampleSelective(@Param("record") Catalog record, @Param("example") CatalogExample example);
int updateByExample(@Param("record") Catalog record, @Param("example") CatalogExample example);
int updateByPrimaryKeySelective(Catalog record);
int updateByPrimaryKey(Catalog record);
}
\ No newline at end of file
package com.haomostudio.delivery.dao;
import com.haomostudio.delivery.po.Dept;
import com.haomostudio.delivery.po.DeptExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds;
public interface DeptMapper {
long countByExample(DeptExample example);
int deleteByExample(DeptExample example);
int deleteByPrimaryKey(String did);
int insert(Dept record);
int insertSelective(Dept record);
List<Dept> selectByExampleWithRowbounds(DeptExample example, RowBounds rowBounds);
List<Dept> selectByExample(DeptExample example);
Dept selectByPrimaryKey(String did);
int updateByExampleSelective(@Param("record") Dept record, @Param("example") DeptExample example);
int updateByExample(@Param("record") Dept record, @Param("example") DeptExample example);
int updateByPrimaryKeySelective(Dept record);
int updateByPrimaryKey(Dept record);
}
\ No newline at end of file
package com.haomostudio.delivery.dao;
import com.haomostudio.delivery.po.RoleCatalog;
import com.haomostudio.delivery.po.RoleCatalogExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds;
public interface RoleCatalogMapper {
long countByExample(RoleCatalogExample example);
int deleteByExample(RoleCatalogExample example);
int deleteByPrimaryKey(String roleCatalogid);
int insert(RoleCatalog record);
int insertSelective(RoleCatalog record);
List<RoleCatalog> selectByExampleWithRowbounds(RoleCatalogExample example, RowBounds rowBounds);
List<RoleCatalog> selectByExample(RoleCatalogExample example);
RoleCatalog selectByPrimaryKey(String roleCatalogid);
int updateByExampleSelective(@Param("record") RoleCatalog record, @Param("example") RoleCatalogExample example);
int updateByExample(@Param("record") RoleCatalog record, @Param("example") RoleCatalogExample example);
int updateByPrimaryKeySelective(RoleCatalog record);
int updateByPrimaryKey(RoleCatalog record);
}
\ No newline at end of file
package com.haomostudio.delivery.dao;
import com.haomostudio.delivery.po.TRole;
import com.haomostudio.delivery.po.TRoleExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds;
public interface TRoleMapper {
long countByExample(TRoleExample example);
int deleteByExample(TRoleExample example);
int deleteByPrimaryKey(String rid);
int insert(TRole record);
int insertSelective(TRole record);
List<TRole> selectByExampleWithRowbounds(TRoleExample example, RowBounds rowBounds);
List<TRole> selectByExample(TRoleExample example);
TRole selectByPrimaryKey(String rid);
int updateByExampleSelective(@Param("record") TRole record, @Param("example") TRoleExample example);
int updateByExample(@Param("record") TRole record, @Param("example") TRoleExample example);
int updateByPrimaryKeySelective(TRole record);
int updateByPrimaryKey(TRole record);
}
\ No newline at end of file
package com.haomostudio.delivery.dao;
import com.haomostudio.delivery.po.TUserRole;
import com.haomostudio.delivery.po.TUserRoleExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds;
public interface TUserRoleMapper {
long countByExample(TUserRoleExample example);
int deleteByExample(TUserRoleExample example);
int deleteByPrimaryKey(String userRoleid);
int insert(TUserRole record);
int insertSelective(TUserRole record);
List<TUserRole> selectByExampleWithRowbounds(TUserRoleExample example, RowBounds rowBounds);
List<TUserRole> selectByExample(TUserRoleExample example);
TUserRole selectByPrimaryKey(String userRoleid);
int updateByExampleSelective(@Param("record") TUserRole record, @Param("example") TUserRoleExample example);
int updateByExample(@Param("record") TUserRole record, @Param("example") TUserRoleExample example);
int updateByPrimaryKeySelective(TUserRole record);
int updateByPrimaryKey(TUserRole record);
}
\ No newline at end of file
package com.haomostudio.delivery.dao;
import com.haomostudio.delivery.po.User;
import com.haomostudio.delivery.po.UserExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds;
public interface UserMapper {
long countByExample(UserExample example);
int deleteByExample(UserExample example);
int deleteByPrimaryKey(String uid);
int insert(User record);
int insertSelective(User record);
List<User> selectByExampleWithRowbounds(UserExample example, RowBounds rowBounds);
List<User> selectByExample(UserExample example);
User selectByPrimaryKey(String uid);
int updateByExampleSelective(@Param("record") User record, @Param("example") UserExample example);
int updateByExample(@Param("record") User record, @Param("example") UserExample example);
int updateByPrimaryKeySelective(User record);
int updateByPrimaryKey(User record);
}
\ No newline at end of file
package com.haomostudio.Util;
/**
* Created by guanpb on 2018/7/10.
*/
public class Page {
// 分页查询开始记录位置
private int begin;
// 分页查看下结束位置
private int end;
// 每页显示记录数
private int length;
// 查询结果总记录数
private int count;
// 当前页码
private int current;
// 总共页数
private int total;
public Page() {
}
/**
* 构造函数
*
* @param begin
* @param length
*/
public Page(int begin, int length) {
this.begin = begin;
this.length = length;
this.end = this.begin + this.length;
this.current = (int) Math.floor((this.begin * 1.0d) / this.length) + 1;
}
/**
* @param begin
* @param length
* @param count
*/
public Page(int begin, int length, int count) {
this(begin, length);
this.count = count;
}
/**
* @return the begin
*/
public int getBegin() {
return begin;
}
/**
* @return the end
*/
public int getEnd() {
return end;
}
/**
* @param end
* the end to set
*/
public void setEnd(int end) {
this.end = end;
}
/**
* @param begin
* the begin to set
*/
public void setBegin(int begin) {
this.begin = begin;
if (this.length != 0) {
this.current = (int) Math.floor((this.begin * 1.0d) / this.length) + 1;
}
}
/**
* @return the length
*/
public int getLength() {
return length;
}
/**
* @param length
* the length to set
*/
public void setLength(int length) {
this.length = length;
if (this.begin != 0) {
this.current = (int) Math.floor((this.begin * 1.0d) / this.length) + 1;
}
}
/**
* @return the count
*/
public int getCount() {
return count;
}
/**
* @param count
* the count to set
*/
public void setCount(int count) {
this.count = count;
this.total = (int) Math.floor((this.count * 1.0d) / this.length);
if (this.count % this.length != 0) {
this.total++;
}
}
/**
* @return the current
*/
public int getCurrent() {
return current;
}
/**
* @param current
* the current to set
*/
public void setCurrent(int current) {
this.current = current;
}
/**
* @return the total
*/
public int getTotal() {
if (total == 0) {
return 1;
}
return total;
}
/**
* @param total
* the total to set
*/
public void setTotal(int total) {
this.total = total;
}
}
package com.haomostudio.delivery.po;
import java.util.Date;
public class Catalog {
private String cid;
private String cname;
private String resource;
private String id;
private Date createTime;
private Date lastUpdateTime;
public String getCid() {
return cid;
}
public void setCid(String cid) {
this.cid = cid;
}
public String getCname() {
return cname;
}
public void setCname(String cname) {
this.cname = cname;
}
public String getResource() {
return resource;
}
public void setResource(String resource) {
this.resource = resource;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getLastUpdateTime() {
return lastUpdateTime;
}
public void setLastUpdateTime(Date lastUpdateTime) {
this.lastUpdateTime = lastUpdateTime;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", cid=").append(cid);
sb.append(", cname=").append(cname);
sb.append(", resource=").append(resource);
sb.append(", id=").append(id);
sb.append(", createTime=").append(createTime);
sb.append(", lastUpdateTime=").append(lastUpdateTime);
sb.append("]");
return sb.toString();
}
}
\ No newline at end of file
package com.haomostudio.delivery.po;
import com.haomostudio.Util.Page;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class CatalogExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
protected Page page;
public CatalogExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
public void setPage(Page page) {
this.page=page;
}
public Page getPage() {
return page;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andCidIsNull() {
addCriterion("cid is null");
return (Criteria) this;
}
public Criteria andCidIsNotNull() {
addCriterion("cid is not null");
return (Criteria) this;
}
public Criteria andCidEqualTo(String value) {
addCriterion("cid =", value, "cid");
return (Criteria) this;
}
public Criteria andCidNotEqualTo(String value) {
addCriterion("cid <>", value, "cid");
return (Criteria) this;
}
public Criteria andCidGreaterThan(String value) {
addCriterion("cid >", value, "cid");
return (Criteria) this;
}
public Criteria andCidGreaterThanOrEqualTo(String value) {
addCriterion("cid >=", value, "cid");
return (Criteria) this;
}
public Criteria andCidLessThan(String value) {
addCriterion("cid <", value, "cid");
return (Criteria) this;
}
public Criteria andCidLessThanOrEqualTo(String value) {
addCriterion("cid <=", value, "cid");
return (Criteria) this;
}
public Criteria andCidLike(String value) {
addCriterion("cid like", value, "cid");
return (Criteria) this;
}
public Criteria andCidNotLike(String value) {
addCriterion("cid not like", value, "cid");
return (Criteria) this;
}
public Criteria andCidIn(List<String> values) {
addCriterion("cid in", values, "cid");
return (Criteria) this;
}
public Criteria andCidNotIn(List<String> values) {
addCriterion("cid not in", values, "cid");
return (Criteria) this;
}
public Criteria andCidBetween(String value1, String value2) {
addCriterion("cid between", value1, value2, "cid");
return (Criteria) this;
}
public Criteria andCidNotBetween(String value1, String value2) {
addCriterion("cid not between", value1, value2, "cid");
return (Criteria) this;
}
public Criteria andCnameIsNull() {
addCriterion("cname is null");
return (Criteria) this;
}
public Criteria andCnameIsNotNull() {
addCriterion("cname is not null");
return (Criteria) this;
}
public Criteria andCnameEqualTo(String value) {
addCriterion("cname =", value, "cname");
return (Criteria) this;
}
public Criteria andCnameNotEqualTo(String value) {
addCriterion("cname <>", value, "cname");
return (Criteria) this;
}
public Criteria andCnameGreaterThan(String value) {
addCriterion("cname >", value, "cname");
return (Criteria) this;
}
public Criteria andCnameGreaterThanOrEqualTo(String value) {
addCriterion("cname >=", value, "cname");
return (Criteria) this;
}
public Criteria andCnameLessThan(String value) {
addCriterion("cname <", value, "cname");
return (Criteria) this;
}
public Criteria andCnameLessThanOrEqualTo(String value) {
addCriterion("cname <=", value, "cname");
return (Criteria) this;
}
public Criteria andCnameLike(String value) {
addCriterion("cname like", value, "cname");
return (Criteria) this;
}
public Criteria andCnameNotLike(String value) {
addCriterion("cname not like", value, "cname");
return (Criteria) this;
}
public Criteria andCnameIn(List<String> values) {
addCriterion("cname in", values, "cname");
return (Criteria) this;
}
public Criteria andCnameNotIn(List<String> values) {
addCriterion("cname not in", values, "cname");
return (Criteria) this;
}
public Criteria andCnameBetween(String value1, String value2) {
addCriterion("cname between", value1, value2, "cname");
return (Criteria) this;
}
public Criteria andCnameNotBetween(String value1, String value2) {
addCriterion("cname not between", value1, value2, "cname");
return (Criteria) this;
}
public Criteria andResourceIsNull() {
addCriterion("resource is null");
return (Criteria) this;
}
public Criteria andResourceIsNotNull() {
addCriterion("resource is not null");
return (Criteria) this;
}
public Criteria andResourceEqualTo(String value) {
addCriterion("resource =", value, "resource");
return (Criteria) this;
}
public Criteria andResourceNotEqualTo(String value) {
addCriterion("resource <>", value, "resource");
return (Criteria) this;
}
public Criteria andResourceGreaterThan(String value) {
addCriterion("resource >", value, "resource");
return (Criteria) this;
}
public Criteria andResourceGreaterThanOrEqualTo(String value) {
addCriterion("resource >=", value, "resource");
return (Criteria) this;
}
public Criteria andResourceLessThan(String value) {
addCriterion("resource <", value, "resource");
return (Criteria) this;
}
public Criteria andResourceLessThanOrEqualTo(String value) {
addCriterion("resource <=", value, "resource");
return (Criteria) this;
}
public Criteria andResourceLike(String value) {
addCriterion("resource like", value, "resource");
return (Criteria) this;
}
public Criteria andResourceNotLike(String value) {
addCriterion("resource not like", value, "resource");
return (Criteria) this;
}
public Criteria andResourceIn(List<String> values) {
addCriterion("resource in", values, "resource");
return (Criteria) this;
}
public Criteria andResourceNotIn(List<String> values) {
addCriterion("resource not in", values, "resource");
return (Criteria) this;
}
public Criteria andResourceBetween(String value1, String value2) {
addCriterion("resource between", value1, value2, "resource");
return (Criteria) this;
}
public Criteria andResourceNotBetween(String value1, String value2) {
addCriterion("resource not between", value1, value2, "resource");
return (Criteria) this;
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(String value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(String value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(String value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(String value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(String value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(String value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdLike(String value) {
addCriterion("id like", value, "id");
return (Criteria) this;
}
public Criteria andIdNotLike(String value) {
addCriterion("id not like", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<String> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<String> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(String value1, String value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(String value1, String value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Date value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Date value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Date value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Date value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Date> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Date> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Date value1, Date value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeIsNull() {
addCriterion("last_update_time is null");
return (Criteria) this;
}
public Criteria andLastUpdateTimeIsNotNull() {
addCriterion("last_update_time is not null");
return (Criteria) this;
}
public Criteria andLastUpdateTimeEqualTo(Date value) {
addCriterion("last_update_time =", value, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeNotEqualTo(Date value) {
addCriterion("last_update_time <>", value, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeGreaterThan(Date value) {
addCriterion("last_update_time >", value, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("last_update_time >=", value, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeLessThan(Date value) {
addCriterion("last_update_time <", value, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeLessThanOrEqualTo(Date value) {
addCriterion("last_update_time <=", value, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeIn(List<Date> values) {
addCriterion("last_update_time in", values, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeNotIn(List<Date> values) {
addCriterion("last_update_time not in", values, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeBetween(Date value1, Date value2) {
addCriterion("last_update_time between", value1, value2, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeNotBetween(Date value1, Date value2) {
addCriterion("last_update_time not between", value1, value2, "lastUpdateTime");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}
\ No newline at end of file
package com.haomostudio.delivery.po;
import java.util.Date;
public class Dept {
private String did;
private String id;
private String dname;
private Date createTime;
private Date lastUpdateTime;
public String getDid() {
return did;
}
public void setDid(String did) {
this.did = did;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getDname() {
return dname;
}
public void setDname(String dname) {
this.dname = dname;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getLastUpdateTime() {
return lastUpdateTime;
}
public void setLastUpdateTime(Date lastUpdateTime) {
this.lastUpdateTime = lastUpdateTime;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", did=").append(did);
sb.append(", id=").append(id);
sb.append(", dname=").append(dname);
sb.append(", createTime=").append(createTime);
sb.append(", lastUpdateTime=").append(lastUpdateTime);
sb.append("]");
return sb.toString();
}
}
\ No newline at end of file
package com.haomostudio.delivery.po;
import com.haomostudio.Util.Page;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class DeptExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
protected Page page;
public DeptExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
public void setPage(Page page) {
this.page=page;
}
public Page getPage() {
return page;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andDidIsNull() {
addCriterion("did is null");
return (Criteria) this;
}
public Criteria andDidIsNotNull() {
addCriterion("did is not null");
return (Criteria) this;
}
public Criteria andDidEqualTo(String value) {
addCriterion("did =", value, "did");
return (Criteria) this;
}
public Criteria andDidNotEqualTo(String value) {
addCriterion("did <>", value, "did");
return (Criteria) this;
}
public Criteria andDidGreaterThan(String value) {
addCriterion("did >", value, "did");
return (Criteria) this;
}
public Criteria andDidGreaterThanOrEqualTo(String value) {
addCriterion("did >=", value, "did");
return (Criteria) this;
}
public Criteria andDidLessThan(String value) {
addCriterion("did <", value, "did");
return (Criteria) this;
}
public Criteria andDidLessThanOrEqualTo(String value) {
addCriterion("did <=", value, "did");
return (Criteria) this;
}
public Criteria andDidLike(String value) {
addCriterion("did like", value, "did");
return (Criteria) this;
}
public Criteria andDidNotLike(String value) {
addCriterion("did not like", value, "did");
return (Criteria) this;
}
public Criteria andDidIn(List<String> values) {
addCriterion("did in", values, "did");
return (Criteria) this;
}
public Criteria andDidNotIn(List<String> values) {
addCriterion("did not in", values, "did");
return (Criteria) this;
}
public Criteria andDidBetween(String value1, String value2) {
addCriterion("did between", value1, value2, "did");
return (Criteria) this;
}
public Criteria andDidNotBetween(String value1, String value2) {
addCriterion("did not between", value1, value2, "did");
return (Criteria) this;
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(String value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(String value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(String value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(String value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(String value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(String value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdLike(String value) {
addCriterion("id like", value, "id");
return (Criteria) this;
}
public Criteria andIdNotLike(String value) {
addCriterion("id not like", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<String> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<String> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(String value1, String value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(String value1, String value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andDnameIsNull() {
addCriterion("dname is null");
return (Criteria) this;
}
public Criteria andDnameIsNotNull() {
addCriterion("dname is not null");
return (Criteria) this;
}
public Criteria andDnameEqualTo(String value) {
addCriterion("dname =", value, "dname");
return (Criteria) this;
}
public Criteria andDnameNotEqualTo(String value) {
addCriterion("dname <>", value, "dname");
return (Criteria) this;
}
public Criteria andDnameGreaterThan(String value) {
addCriterion("dname >", value, "dname");
return (Criteria) this;
}
public Criteria andDnameGreaterThanOrEqualTo(String value) {
addCriterion("dname >=", value, "dname");
return (Criteria) this;
}
public Criteria andDnameLessThan(String value) {
addCriterion("dname <", value, "dname");
return (Criteria) this;
}
public Criteria andDnameLessThanOrEqualTo(String value) {
addCriterion("dname <=", value, "dname");
return (Criteria) this;
}
public Criteria andDnameLike(String value) {
addCriterion("dname like", value, "dname");
return (Criteria) this;
}
public Criteria andDnameNotLike(String value) {
addCriterion("dname not like", value, "dname");
return (Criteria) this;
}
public Criteria andDnameIn(List<String> values) {
addCriterion("dname in", values, "dname");
return (Criteria) this;
}
public Criteria andDnameNotIn(List<String> values) {
addCriterion("dname not in", values, "dname");
return (Criteria) this;
}
public Criteria andDnameBetween(String value1, String value2) {
addCriterion("dname between", value1, value2, "dname");
return (Criteria) this;
}
public Criteria andDnameNotBetween(String value1, String value2) {
addCriterion("dname not between", value1, value2, "dname");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Date value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Date value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Date value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Date value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Date> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Date> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Date value1, Date value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeIsNull() {
addCriterion("last_update_time is null");
return (Criteria) this;
}
public Criteria andLastUpdateTimeIsNotNull() {
addCriterion("last_update_time is not null");
return (Criteria) this;
}
public Criteria andLastUpdateTimeEqualTo(Date value) {
addCriterion("last_update_time =", value, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeNotEqualTo(Date value) {
addCriterion("last_update_time <>", value, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeGreaterThan(Date value) {
addCriterion("last_update_time >", value, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("last_update_time >=", value, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeLessThan(Date value) {
addCriterion("last_update_time <", value, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeLessThanOrEqualTo(Date value) {
addCriterion("last_update_time <=", value, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeIn(List<Date> values) {
addCriterion("last_update_time in", values, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeNotIn(List<Date> values) {
addCriterion("last_update_time not in", values, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeBetween(Date value1, Date value2) {
addCriterion("last_update_time between", value1, value2, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeNotBetween(Date value1, Date value2) {
addCriterion("last_update_time not between", value1, value2, "lastUpdateTime");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}
\ No newline at end of file
package com.haomostudio.delivery.po;
import java.util.Date;
public class RoleCatalog {
private String roleCatalogid;
private String rid;
private String cid;
private String id;
private Date createTime;
private Date lastUpdateTime;
public String getRoleCatalogid() {
return roleCatalogid;
}
public void setRoleCatalogid(String roleCatalogid) {
this.roleCatalogid = roleCatalogid;
}
public String getRid() {
return rid;
}
public void setRid(String rid) {
this.rid = rid;
}
public String getCid() {
return cid;
}
public void setCid(String cid) {
this.cid = cid;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getLastUpdateTime() {
return lastUpdateTime;
}
public void setLastUpdateTime(Date lastUpdateTime) {
this.lastUpdateTime = lastUpdateTime;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", roleCatalogid=").append(roleCatalogid);
sb.append(", rid=").append(rid);
sb.append(", cid=").append(cid);
sb.append(", id=").append(id);
sb.append(", createTime=").append(createTime);
sb.append(", lastUpdateTime=").append(lastUpdateTime);
sb.append("]");
return sb.toString();
}
}
\ No newline at end of file
package com.haomostudio.delivery.po;
import com.haomostudio.Util.Page;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class RoleCatalogExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
protected Page page;
public RoleCatalogExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
public void setPage(Page page) {
this.page=page;
}
public Page getPage() {
return page;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andRoleCatalogidIsNull() {
addCriterion("role_catalogid is null");
return (Criteria) this;
}
public Criteria andRoleCatalogidIsNotNull() {
addCriterion("role_catalogid is not null");
return (Criteria) this;
}
public Criteria andRoleCatalogidEqualTo(String value) {
addCriterion("role_catalogid =", value, "roleCatalogid");
return (Criteria) this;
}
public Criteria andRoleCatalogidNotEqualTo(String value) {
addCriterion("role_catalogid <>", value, "roleCatalogid");
return (Criteria) this;
}
public Criteria andRoleCatalogidGreaterThan(String value) {
addCriterion("role_catalogid >", value, "roleCatalogid");
return (Criteria) this;
}
public Criteria andRoleCatalogidGreaterThanOrEqualTo(String value) {
addCriterion("role_catalogid >=", value, "roleCatalogid");
return (Criteria) this;
}
public Criteria andRoleCatalogidLessThan(String value) {
addCriterion("role_catalogid <", value, "roleCatalogid");
return (Criteria) this;
}
public Criteria andRoleCatalogidLessThanOrEqualTo(String value) {
addCriterion("role_catalogid <=", value, "roleCatalogid");
return (Criteria) this;
}
public Criteria andRoleCatalogidLike(String value) {
addCriterion("role_catalogid like", value, "roleCatalogid");
return (Criteria) this;
}
public Criteria andRoleCatalogidNotLike(String value) {
addCriterion("role_catalogid not like", value, "roleCatalogid");
return (Criteria) this;
}
public Criteria andRoleCatalogidIn(List<String> values) {
addCriterion("role_catalogid in", values, "roleCatalogid");
return (Criteria) this;
}
public Criteria andRoleCatalogidNotIn(List<String> values) {
addCriterion("role_catalogid not in", values, "roleCatalogid");
return (Criteria) this;
}
public Criteria andRoleCatalogidBetween(String value1, String value2) {
addCriterion("role_catalogid between", value1, value2, "roleCatalogid");
return (Criteria) this;
}
public Criteria andRoleCatalogidNotBetween(String value1, String value2) {
addCriterion("role_catalogid not between", value1, value2, "roleCatalogid");
return (Criteria) this;
}
public Criteria andRidIsNull() {
addCriterion("rid is null");
return (Criteria) this;
}
public Criteria andRidIsNotNull() {
addCriterion("rid is not null");
return (Criteria) this;
}
public Criteria andRidEqualTo(String value) {
addCriterion("rid =", value, "rid");
return (Criteria) this;
}
public Criteria andRidNotEqualTo(String value) {
addCriterion("rid <>", value, "rid");
return (Criteria) this;
}
public Criteria andRidGreaterThan(String value) {
addCriterion("rid >", value, "rid");
return (Criteria) this;
}
public Criteria andRidGreaterThanOrEqualTo(String value) {
addCriterion("rid >=", value, "rid");
return (Criteria) this;
}
public Criteria andRidLessThan(String value) {
addCriterion("rid <", value, "rid");
return (Criteria) this;
}
public Criteria andRidLessThanOrEqualTo(String value) {
addCriterion("rid <=", value, "rid");
return (Criteria) this;
}
public Criteria andRidLike(String value) {
addCriterion("rid like", value, "rid");
return (Criteria) this;
}
public Criteria andRidNotLike(String value) {
addCriterion("rid not like", value, "rid");
return (Criteria) this;
}
public Criteria andRidIn(List<String> values) {
addCriterion("rid in", values, "rid");
return (Criteria) this;
}
public Criteria andRidNotIn(List<String> values) {
addCriterion("rid not in", values, "rid");
return (Criteria) this;
}
public Criteria andRidBetween(String value1, String value2) {
addCriterion("rid between", value1, value2, "rid");
return (Criteria) this;
}
public Criteria andRidNotBetween(String value1, String value2) {
addCriterion("rid not between", value1, value2, "rid");
return (Criteria) this;
}
public Criteria andCidIsNull() {
addCriterion("cid is null");
return (Criteria) this;
}
public Criteria andCidIsNotNull() {
addCriterion("cid is not null");
return (Criteria) this;
}
public Criteria andCidEqualTo(String value) {
addCriterion("cid =", value, "cid");
return (Criteria) this;
}
public Criteria andCidNotEqualTo(String value) {
addCriterion("cid <>", value, "cid");
return (Criteria) this;
}
public Criteria andCidGreaterThan(String value) {
addCriterion("cid >", value, "cid");
return (Criteria) this;
}
public Criteria andCidGreaterThanOrEqualTo(String value) {
addCriterion("cid >=", value, "cid");
return (Criteria) this;
}
public Criteria andCidLessThan(String value) {
addCriterion("cid <", value, "cid");
return (Criteria) this;
}
public Criteria andCidLessThanOrEqualTo(String value) {
addCriterion("cid <=", value, "cid");
return (Criteria) this;
}
public Criteria andCidLike(String value) {
addCriterion("cid like", value, "cid");
return (Criteria) this;
}
public Criteria andCidNotLike(String value) {
addCriterion("cid not like", value, "cid");
return (Criteria) this;
}
public Criteria andCidIn(List<String> values) {
addCriterion("cid in", values, "cid");
return (Criteria) this;
}
public Criteria andCidNotIn(List<String> values) {
addCriterion("cid not in", values, "cid");
return (Criteria) this;
}
public Criteria andCidBetween(String value1, String value2) {
addCriterion("cid between", value1, value2, "cid");
return (Criteria) this;
}
public Criteria andCidNotBetween(String value1, String value2) {
addCriterion("cid not between", value1, value2, "cid");
return (Criteria) this;
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(String value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(String value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(String value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(String value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(String value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(String value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdLike(String value) {
addCriterion("id like", value, "id");
return (Criteria) this;
}
public Criteria andIdNotLike(String value) {
addCriterion("id not like", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<String> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<String> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(String value1, String value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(String value1, String value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Date value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Date value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Date value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Date value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Date> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Date> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Date value1, Date value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeIsNull() {
addCriterion("last_update_time is null");
return (Criteria) this;
}
public Criteria andLastUpdateTimeIsNotNull() {
addCriterion("last_update_time is not null");
return (Criteria) this;
}
public Criteria andLastUpdateTimeEqualTo(Date value) {
addCriterion("last_update_time =", value, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeNotEqualTo(Date value) {
addCriterion("last_update_time <>", value, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeGreaterThan(Date value) {
addCriterion("last_update_time >", value, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("last_update_time >=", value, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeLessThan(Date value) {
addCriterion("last_update_time <", value, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeLessThanOrEqualTo(Date value) {
addCriterion("last_update_time <=", value, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeIn(List<Date> values) {
addCriterion("last_update_time in", values, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeNotIn(List<Date> values) {
addCriterion("last_update_time not in", values, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeBetween(Date value1, Date value2) {
addCriterion("last_update_time between", value1, value2, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeNotBetween(Date value1, Date value2) {
addCriterion("last_update_time not between", value1, value2, "lastUpdateTime");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}
\ No newline at end of file
package com.haomostudio.delivery.po;
import java.util.Date;
public class TRole {
private String rid;
private String rname;
private String id;
private Date createTime;
private Date lastUpdateTime;
public String getRid() {
return rid;
}
public void setRid(String rid) {
this.rid = rid;
}
public String getRname() {
return rname;
}
public void setRname(String rname) {
this.rname = rname;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getLastUpdateTime() {
return lastUpdateTime;
}
public void setLastUpdateTime(Date lastUpdateTime) {
this.lastUpdateTime = lastUpdateTime;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", rid=").append(rid);
sb.append(", rname=").append(rname);
sb.append(", id=").append(id);
sb.append(", createTime=").append(createTime);
sb.append(", lastUpdateTime=").append(lastUpdateTime);
sb.append("]");
return sb.toString();
}
}
\ No newline at end of file
package com.haomostudio.delivery.po;
import com.haomostudio.Util.Page;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class TRoleExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
protected Page page;
public TRoleExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
public void setPage(Page page) {
this.page=page;
}
public Page getPage() {
return page;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andRidIsNull() {
addCriterion("rid is null");
return (Criteria) this;
}
public Criteria andRidIsNotNull() {
addCriterion("rid is not null");
return (Criteria) this;
}
public Criteria andRidEqualTo(String value) {
addCriterion("rid =", value, "rid");
return (Criteria) this;
}
public Criteria andRidNotEqualTo(String value) {
addCriterion("rid <>", value, "rid");
return (Criteria) this;
}
public Criteria andRidGreaterThan(String value) {
addCriterion("rid >", value, "rid");
return (Criteria) this;
}
public Criteria andRidGreaterThanOrEqualTo(String value) {
addCriterion("rid >=", value, "rid");
return (Criteria) this;
}
public Criteria andRidLessThan(String value) {
addCriterion("rid <", value, "rid");
return (Criteria) this;
}
public Criteria andRidLessThanOrEqualTo(String value) {
addCriterion("rid <=", value, "rid");
return (Criteria) this;
}
public Criteria andRidLike(String value) {
addCriterion("rid like", value, "rid");
return (Criteria) this;
}
public Criteria andRidNotLike(String value) {
addCriterion("rid not like", value, "rid");
return (Criteria) this;
}
public Criteria andRidIn(List<String> values) {
addCriterion("rid in", values, "rid");
return (Criteria) this;
}
public Criteria andRidNotIn(List<String> values) {
addCriterion("rid not in", values, "rid");
return (Criteria) this;
}
public Criteria andRidBetween(String value1, String value2) {
addCriterion("rid between", value1, value2, "rid");
return (Criteria) this;
}
public Criteria andRidNotBetween(String value1, String value2) {
addCriterion("rid not between", value1, value2, "rid");
return (Criteria) this;
}
public Criteria andRnameIsNull() {
addCriterion("rname is null");
return (Criteria) this;
}
public Criteria andRnameIsNotNull() {
addCriterion("rname is not null");
return (Criteria) this;
}
public Criteria andRnameEqualTo(String value) {
addCriterion("rname =", value, "rname");
return (Criteria) this;
}
public Criteria andRnameNotEqualTo(String value) {
addCriterion("rname <>", value, "rname");
return (Criteria) this;
}
public Criteria andRnameGreaterThan(String value) {
addCriterion("rname >", value, "rname");
return (Criteria) this;
}
public Criteria andRnameGreaterThanOrEqualTo(String value) {
addCriterion("rname >=", value, "rname");
return (Criteria) this;
}
public Criteria andRnameLessThan(String value) {
addCriterion("rname <", value, "rname");
return (Criteria) this;
}
public Criteria andRnameLessThanOrEqualTo(String value) {
addCriterion("rname <=", value, "rname");
return (Criteria) this;
}
public Criteria andRnameLike(String value) {
addCriterion("rname like", value, "rname");
return (Criteria) this;
}
public Criteria andRnameNotLike(String value) {
addCriterion("rname not like", value, "rname");
return (Criteria) this;
}
public Criteria andRnameIn(List<String> values) {
addCriterion("rname in", values, "rname");
return (Criteria) this;
}
public Criteria andRnameNotIn(List<String> values) {
addCriterion("rname not in", values, "rname");
return (Criteria) this;
}
public Criteria andRnameBetween(String value1, String value2) {
addCriterion("rname between", value1, value2, "rname");
return (Criteria) this;
}
public Criteria andRnameNotBetween(String value1, String value2) {
addCriterion("rname not between", value1, value2, "rname");
return (Criteria) this;
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(String value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(String value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(String value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(String value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(String value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(String value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdLike(String value) {
addCriterion("id like", value, "id");
return (Criteria) this;
}
public Criteria andIdNotLike(String value) {
addCriterion("id not like", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<String> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<String> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(String value1, String value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(String value1, String value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Date value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Date value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Date value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Date value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Date> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Date> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Date value1, Date value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeIsNull() {
addCriterion("last_update_time is null");
return (Criteria) this;
}
public Criteria andLastUpdateTimeIsNotNull() {
addCriterion("last_update_time is not null");
return (Criteria) this;
}
public Criteria andLastUpdateTimeEqualTo(Date value) {
addCriterion("last_update_time =", value, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeNotEqualTo(Date value) {
addCriterion("last_update_time <>", value, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeGreaterThan(Date value) {
addCriterion("last_update_time >", value, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("last_update_time >=", value, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeLessThan(Date value) {
addCriterion("last_update_time <", value, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeLessThanOrEqualTo(Date value) {
addCriterion("last_update_time <=", value, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeIn(List<Date> values) {
addCriterion("last_update_time in", values, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeNotIn(List<Date> values) {
addCriterion("last_update_time not in", values, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeBetween(Date value1, Date value2) {
addCriterion("last_update_time between", value1, value2, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeNotBetween(Date value1, Date value2) {
addCriterion("last_update_time not between", value1, value2, "lastUpdateTime");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}
\ No newline at end of file
package com.haomostudio.delivery.po;
import java.util.Date;
public class TUserRole {
private String userRoleid;
private String uid;
private String rid;
private String id;
private Date createTime;
private Date lastUpdateTime;
public String getUserRoleid() {
return userRoleid;
}
public void setUserRoleid(String userRoleid) {
this.userRoleid = userRoleid;
}
public String getUid() {
return uid;
}
public void setUid(String uid) {
this.uid = uid;
}
public String getRid() {
return rid;
}
public void setRid(String rid) {
this.rid = rid;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getLastUpdateTime() {
return lastUpdateTime;
}
public void setLastUpdateTime(Date lastUpdateTime) {
this.lastUpdateTime = lastUpdateTime;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", userRoleid=").append(userRoleid);
sb.append(", uid=").append(uid);
sb.append(", rid=").append(rid);
sb.append(", id=").append(id);
sb.append(", createTime=").append(createTime);
sb.append(", lastUpdateTime=").append(lastUpdateTime);
sb.append("]");
return sb.toString();
}
}
\ No newline at end of file
package com.haomostudio.delivery.po;
import com.haomostudio.Util.Page;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class TUserRoleExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
protected Page page;
public TUserRoleExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
public void setPage(Page page) {
this.page=page;
}
public Page getPage() {
return page;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andUserRoleidIsNull() {
addCriterion("user_roleid is null");
return (Criteria) this;
}
public Criteria andUserRoleidIsNotNull() {
addCriterion("user_roleid is not null");
return (Criteria) this;
}
public Criteria andUserRoleidEqualTo(String value) {
addCriterion("user_roleid =", value, "userRoleid");
return (Criteria) this;
}
public Criteria andUserRoleidNotEqualTo(String value) {
addCriterion("user_roleid <>", value, "userRoleid");
return (Criteria) this;
}
public Criteria andUserRoleidGreaterThan(String value) {
addCriterion("user_roleid >", value, "userRoleid");
return (Criteria) this;
}
public Criteria andUserRoleidGreaterThanOrEqualTo(String value) {
addCriterion("user_roleid >=", value, "userRoleid");
return (Criteria) this;
}
public Criteria andUserRoleidLessThan(String value) {
addCriterion("user_roleid <", value, "userRoleid");
return (Criteria) this;
}
public Criteria andUserRoleidLessThanOrEqualTo(String value) {
addCriterion("user_roleid <=", value, "userRoleid");
return (Criteria) this;
}
public Criteria andUserRoleidLike(String value) {
addCriterion("user_roleid like", value, "userRoleid");
return (Criteria) this;
}
public Criteria andUserRoleidNotLike(String value) {
addCriterion("user_roleid not like", value, "userRoleid");
return (Criteria) this;
}
public Criteria andUserRoleidIn(List<String> values) {
addCriterion("user_roleid in", values, "userRoleid");
return (Criteria) this;
}
public Criteria andUserRoleidNotIn(List<String> values) {
addCriterion("user_roleid not in", values, "userRoleid");
return (Criteria) this;
}
public Criteria andUserRoleidBetween(String value1, String value2) {
addCriterion("user_roleid between", value1, value2, "userRoleid");
return (Criteria) this;
}
public Criteria andUserRoleidNotBetween(String value1, String value2) {
addCriterion("user_roleid not between", value1, value2, "userRoleid");
return (Criteria) this;
}
public Criteria andUidIsNull() {
addCriterion("uid is null");
return (Criteria) this;
}
public Criteria andUidIsNotNull() {
addCriterion("uid is not null");
return (Criteria) this;
}
public Criteria andUidEqualTo(String value) {
addCriterion("uid =", value, "uid");
return (Criteria) this;
}
public Criteria andUidNotEqualTo(String value) {
addCriterion("uid <>", value, "uid");
return (Criteria) this;
}
public Criteria andUidGreaterThan(String value) {
addCriterion("uid >", value, "uid");
return (Criteria) this;
}
public Criteria andUidGreaterThanOrEqualTo(String value) {
addCriterion("uid >=", value, "uid");
return (Criteria) this;
}
public Criteria andUidLessThan(String value) {
addCriterion("uid <", value, "uid");
return (Criteria) this;
}
public Criteria andUidLessThanOrEqualTo(String value) {
addCriterion("uid <=", value, "uid");
return (Criteria) this;
}
public Criteria andUidLike(String value) {
addCriterion("uid like", value, "uid");
return (Criteria) this;
}
public Criteria andUidNotLike(String value) {
addCriterion("uid not like", value, "uid");
return (Criteria) this;
}
public Criteria andUidIn(List<String> values) {
addCriterion("uid in", values, "uid");
return (Criteria) this;
}
public Criteria andUidNotIn(List<String> values) {
addCriterion("uid not in", values, "uid");
return (Criteria) this;
}
public Criteria andUidBetween(String value1, String value2) {
addCriterion("uid between", value1, value2, "uid");
return (Criteria) this;
}
public Criteria andUidNotBetween(String value1, String value2) {
addCriterion("uid not between", value1, value2, "uid");
return (Criteria) this;
}
public Criteria andRidIsNull() {
addCriterion("rid is null");
return (Criteria) this;
}
public Criteria andRidIsNotNull() {
addCriterion("rid is not null");
return (Criteria) this;
}
public Criteria andRidEqualTo(String value) {
addCriterion("rid =", value, "rid");
return (Criteria) this;
}
public Criteria andRidNotEqualTo(String value) {
addCriterion("rid <>", value, "rid");
return (Criteria) this;
}
public Criteria andRidGreaterThan(String value) {
addCriterion("rid >", value, "rid");
return (Criteria) this;
}
public Criteria andRidGreaterThanOrEqualTo(String value) {
addCriterion("rid >=", value, "rid");
return (Criteria) this;
}
public Criteria andRidLessThan(String value) {
addCriterion("rid <", value, "rid");
return (Criteria) this;
}
public Criteria andRidLessThanOrEqualTo(String value) {
addCriterion("rid <=", value, "rid");
return (Criteria) this;
}
public Criteria andRidLike(String value) {
addCriterion("rid like", value, "rid");
return (Criteria) this;
}
public Criteria andRidNotLike(String value) {
addCriterion("rid not like", value, "rid");
return (Criteria) this;
}
public Criteria andRidIn(List<String> values) {
addCriterion("rid in", values, "rid");
return (Criteria) this;
}
public Criteria andRidNotIn(List<String> values) {
addCriterion("rid not in", values, "rid");
return (Criteria) this;
}
public Criteria andRidBetween(String value1, String value2) {
addCriterion("rid between", value1, value2, "rid");
return (Criteria) this;
}
public Criteria andRidNotBetween(String value1, String value2) {
addCriterion("rid not between", value1, value2, "rid");
return (Criteria) this;
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(String value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(String value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(String value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(String value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(String value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(String value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdLike(String value) {
addCriterion("id like", value, "id");
return (Criteria) this;
}
public Criteria andIdNotLike(String value) {
addCriterion("id not like", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<String> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<String> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(String value1, String value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(String value1, String value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Date value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Date value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Date value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Date value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Date> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Date> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Date value1, Date value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeIsNull() {
addCriterion("last_update_time is null");
return (Criteria) this;
}
public Criteria andLastUpdateTimeIsNotNull() {
addCriterion("last_update_time is not null");
return (Criteria) this;
}
public Criteria andLastUpdateTimeEqualTo(Date value) {
addCriterion("last_update_time =", value, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeNotEqualTo(Date value) {
addCriterion("last_update_time <>", value, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeGreaterThan(Date value) {
addCriterion("last_update_time >", value, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("last_update_time >=", value, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeLessThan(Date value) {
addCriterion("last_update_time <", value, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeLessThanOrEqualTo(Date value) {
addCriterion("last_update_time <=", value, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeIn(List<Date> values) {
addCriterion("last_update_time in", values, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeNotIn(List<Date> values) {
addCriterion("last_update_time not in", values, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeBetween(Date value1, Date value2) {
addCriterion("last_update_time between", value1, value2, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeNotBetween(Date value1, Date value2) {
addCriterion("last_update_time not between", value1, value2, "lastUpdateTime");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}
\ No newline at end of file
package com.haomostudio.delivery.po;
import java.util.Date;
public class User {
private String uid;
private String username;
private String did;
private String password;
private String gender;
private String age;
private String id;
private Date createTime;
private Date lastUpdateTime;
public String getUid() {
return uid;
}
public void setUid(String uid) {
this.uid = uid;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getDid() {
return did;
}
public void setDid(String did) {
this.did = did;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public String getAge() {
return age;
}
public void setAge(String age) {
this.age = age;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getLastUpdateTime() {
return lastUpdateTime;
}
public void setLastUpdateTime(Date lastUpdateTime) {
this.lastUpdateTime = lastUpdateTime;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", uid=").append(uid);
sb.append(", username=").append(username);
sb.append(", did=").append(did);
sb.append(", password=").append(password);
sb.append(", gender=").append(gender);
sb.append(", age=").append(age);
sb.append(", id=").append(id);
sb.append(", createTime=").append(createTime);
sb.append(", lastUpdateTime=").append(lastUpdateTime);
sb.append("]");
return sb.toString();
}
}
\ No newline at end of file
package com.haomostudio.delivery.po;
import com.haomostudio.Util.Page;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class UserExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
protected Page page;
public UserExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
public void setPage(Page page) {
this.page=page;
}
public Page getPage() {
return page;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andUidIsNull() {
addCriterion("uid is null");
return (Criteria) this;
}
public Criteria andUidIsNotNull() {
addCriterion("uid is not null");
return (Criteria) this;
}
public Criteria andUidEqualTo(String value) {
addCriterion("uid =", value, "uid");
return (Criteria) this;
}
public Criteria andUidNotEqualTo(String value) {
addCriterion("uid <>", value, "uid");
return (Criteria) this;
}
public Criteria andUidGreaterThan(String value) {
addCriterion("uid >", value, "uid");
return (Criteria) this;
}
public Criteria andUidGreaterThanOrEqualTo(String value) {
addCriterion("uid >=", value, "uid");
return (Criteria) this;
}
public Criteria andUidLessThan(String value) {
addCriterion("uid <", value, "uid");
return (Criteria) this;
}
public Criteria andUidLessThanOrEqualTo(String value) {
addCriterion("uid <=", value, "uid");
return (Criteria) this;
}
public Criteria andUidLike(String value) {
addCriterion("uid like", value, "uid");
return (Criteria) this;
}
public Criteria andUidNotLike(String value) {
addCriterion("uid not like", value, "uid");
return (Criteria) this;
}
public Criteria andUidIn(List<String> values) {
addCriterion("uid in", values, "uid");
return (Criteria) this;
}
public Criteria andUidNotIn(List<String> values) {
addCriterion("uid not in", values, "uid");
return (Criteria) this;
}
public Criteria andUidBetween(String value1, String value2) {
addCriterion("uid between", value1, value2, "uid");
return (Criteria) this;
}
public Criteria andUidNotBetween(String value1, String value2) {
addCriterion("uid not between", value1, value2, "uid");
return (Criteria) this;
}
public Criteria andUsernameIsNull() {
addCriterion("username is null");
return (Criteria) this;
}
public Criteria andUsernameIsNotNull() {
addCriterion("username is not null");
return (Criteria) this;
}
public Criteria andUsernameEqualTo(String value) {
addCriterion("username =", value, "username");
return (Criteria) this;
}
public Criteria andUsernameNotEqualTo(String value) {
addCriterion("username <>", value, "username");
return (Criteria) this;
}
public Criteria andUsernameGreaterThan(String value) {
addCriterion("username >", value, "username");
return (Criteria) this;
}
public Criteria andUsernameGreaterThanOrEqualTo(String value) {
addCriterion("username >=", value, "username");
return (Criteria) this;
}
public Criteria andUsernameLessThan(String value) {
addCriterion("username <", value, "username");
return (Criteria) this;
}
public Criteria andUsernameLessThanOrEqualTo(String value) {
addCriterion("username <=", value, "username");
return (Criteria) this;
}
public Criteria andUsernameLike(String value) {
addCriterion("username like", value, "username");
return (Criteria) this;
}
public Criteria andUsernameNotLike(String value) {
addCriterion("username not like", value, "username");
return (Criteria) this;
}
public Criteria andUsernameIn(List<String> values) {
addCriterion("username in", values, "username");
return (Criteria) this;
}
public Criteria andUsernameNotIn(List<String> values) {
addCriterion("username not in", values, "username");
return (Criteria) this;
}
public Criteria andUsernameBetween(String value1, String value2) {
addCriterion("username between", value1, value2, "username");
return (Criteria) this;
}
public Criteria andUsernameNotBetween(String value1, String value2) {
addCriterion("username not between", value1, value2, "username");
return (Criteria) this;
}
public Criteria andDidIsNull() {
addCriterion("did is null");
return (Criteria) this;
}
public Criteria andDidIsNotNull() {
addCriterion("did is not null");
return (Criteria) this;
}
public Criteria andDidEqualTo(String value) {
addCriterion("did =", value, "did");
return (Criteria) this;
}
public Criteria andDidNotEqualTo(String value) {
addCriterion("did <>", value, "did");
return (Criteria) this;
}
public Criteria andDidGreaterThan(String value) {
addCriterion("did >", value, "did");
return (Criteria) this;
}
public Criteria andDidGreaterThanOrEqualTo(String value) {
addCriterion("did >=", value, "did");
return (Criteria) this;
}
public Criteria andDidLessThan(String value) {
addCriterion("did <", value, "did");
return (Criteria) this;
}
public Criteria andDidLessThanOrEqualTo(String value) {
addCriterion("did <=", value, "did");
return (Criteria) this;
}
public Criteria andDidLike(String value) {
addCriterion("did like", value, "did");
return (Criteria) this;
}
public Criteria andDidNotLike(String value) {
addCriterion("did not like", value, "did");
return (Criteria) this;
}
public Criteria andDidIn(List<String> values) {
addCriterion("did in", values, "did");
return (Criteria) this;
}
public Criteria andDidNotIn(List<String> values) {
addCriterion("did not in", values, "did");
return (Criteria) this;
}
public Criteria andDidBetween(String value1, String value2) {
addCriterion("did between", value1, value2, "did");
return (Criteria) this;
}
public Criteria andDidNotBetween(String value1, String value2) {
addCriterion("did not between", value1, value2, "did");
return (Criteria) this;
}
public Criteria andPasswordIsNull() {
addCriterion("password is null");
return (Criteria) this;
}
public Criteria andPasswordIsNotNull() {
addCriterion("password is not null");
return (Criteria) this;
}
public Criteria andPasswordEqualTo(String value) {
addCriterion("password =", value, "password");
return (Criteria) this;
}
public Criteria andPasswordNotEqualTo(String value) {
addCriterion("password <>", value, "password");
return (Criteria) this;
}
public Criteria andPasswordGreaterThan(String value) {
addCriterion("password >", value, "password");
return (Criteria) this;
}
public Criteria andPasswordGreaterThanOrEqualTo(String value) {
addCriterion("password >=", value, "password");
return (Criteria) this;
}
public Criteria andPasswordLessThan(String value) {
addCriterion("password <", value, "password");
return (Criteria) this;
}
public Criteria andPasswordLessThanOrEqualTo(String value) {
addCriterion("password <=", value, "password");
return (Criteria) this;
}
public Criteria andPasswordLike(String value) {
addCriterion("password like", value, "password");
return (Criteria) this;
}
public Criteria andPasswordNotLike(String value) {
addCriterion("password not like", value, "password");
return (Criteria) this;
}
public Criteria andPasswordIn(List<String> values) {
addCriterion("password in", values, "password");
return (Criteria) this;
}
public Criteria andPasswordNotIn(List<String> values) {
addCriterion("password not in", values, "password");
return (Criteria) this;
}
public Criteria andPasswordBetween(String value1, String value2) {
addCriterion("password between", value1, value2, "password");
return (Criteria) this;
}
public Criteria andPasswordNotBetween(String value1, String value2) {
addCriterion("password not between", value1, value2, "password");
return (Criteria) this;
}
public Criteria andGenderIsNull() {
addCriterion("gender is null");
return (Criteria) this;
}
public Criteria andGenderIsNotNull() {
addCriterion("gender is not null");
return (Criteria) this;
}
public Criteria andGenderEqualTo(String value) {
addCriterion("gender =", value, "gender");
return (Criteria) this;
}
public Criteria andGenderNotEqualTo(String value) {
addCriterion("gender <>", value, "gender");
return (Criteria) this;
}
public Criteria andGenderGreaterThan(String value) {
addCriterion("gender >", value, "gender");
return (Criteria) this;
}
public Criteria andGenderGreaterThanOrEqualTo(String value) {
addCriterion("gender >=", value, "gender");
return (Criteria) this;
}
public Criteria andGenderLessThan(String value) {
addCriterion("gender <", value, "gender");
return (Criteria) this;
}
public Criteria andGenderLessThanOrEqualTo(String value) {
addCriterion("gender <=", value, "gender");
return (Criteria) this;
}
public Criteria andGenderLike(String value) {
addCriterion("gender like", value, "gender");
return (Criteria) this;
}
public Criteria andGenderNotLike(String value) {
addCriterion("gender not like", value, "gender");
return (Criteria) this;
}
public Criteria andGenderIn(List<String> values) {
addCriterion("gender in", values, "gender");
return (Criteria) this;
}
public Criteria andGenderNotIn(List<String> values) {
addCriterion("gender not in", values, "gender");
return (Criteria) this;
}
public Criteria andGenderBetween(String value1, String value2) {
addCriterion("gender between", value1, value2, "gender");
return (Criteria) this;
}
public Criteria andGenderNotBetween(String value1, String value2) {
addCriterion("gender not between", value1, value2, "gender");
return (Criteria) this;
}
public Criteria andAgeIsNull() {
addCriterion("age is null");
return (Criteria) this;
}
public Criteria andAgeIsNotNull() {
addCriterion("age is not null");
return (Criteria) this;
}
public Criteria andAgeEqualTo(String value) {
addCriterion("age =", value, "age");
return (Criteria) this;
}
public Criteria andAgeNotEqualTo(String value) {
addCriterion("age <>", value, "age");
return (Criteria) this;
}
public Criteria andAgeGreaterThan(String value) {
addCriterion("age >", value, "age");
return (Criteria) this;
}
public Criteria andAgeGreaterThanOrEqualTo(String value) {
addCriterion("age >=", value, "age");
return (Criteria) this;
}
public Criteria andAgeLessThan(String value) {
addCriterion("age <", value, "age");
return (Criteria) this;
}
public Criteria andAgeLessThanOrEqualTo(String value) {
addCriterion("age <=", value, "age");
return (Criteria) this;
}
public Criteria andAgeLike(String value) {
addCriterion("age like", value, "age");
return (Criteria) this;
}
public Criteria andAgeNotLike(String value) {
addCriterion("age not like", value, "age");
return (Criteria) this;
}
public Criteria andAgeIn(List<String> values) {
addCriterion("age in", values, "age");
return (Criteria) this;
}
public Criteria andAgeNotIn(List<String> values) {
addCriterion("age not in", values, "age");
return (Criteria) this;
}
public Criteria andAgeBetween(String value1, String value2) {
addCriterion("age between", value1, value2, "age");
return (Criteria) this;
}
public Criteria andAgeNotBetween(String value1, String value2) {
addCriterion("age not between", value1, value2, "age");
return (Criteria) this;
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(String value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(String value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(String value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(String value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(String value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(String value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdLike(String value) {
addCriterion("id like", value, "id");
return (Criteria) this;
}
public Criteria andIdNotLike(String value) {
addCriterion("id not like", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<String> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<String> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(String value1, String value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(String value1, String value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Date value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Date value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Date value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Date value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Date> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Date> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Date value1, Date value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeIsNull() {
addCriterion("last_update_time is null");
return (Criteria) this;
}
public Criteria andLastUpdateTimeIsNotNull() {
addCriterion("last_update_time is not null");
return (Criteria) this;
}
public Criteria andLastUpdateTimeEqualTo(Date value) {
addCriterion("last_update_time =", value, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeNotEqualTo(Date value) {
addCriterion("last_update_time <>", value, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeGreaterThan(Date value) {
addCriterion("last_update_time >", value, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("last_update_time >=", value, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeLessThan(Date value) {
addCriterion("last_update_time <", value, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeLessThanOrEqualTo(Date value) {
addCriterion("last_update_time <=", value, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeIn(List<Date> values) {
addCriterion("last_update_time in", values, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeNotIn(List<Date> values) {
addCriterion("last_update_time not in", values, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeBetween(Date value1, Date value2) {
addCriterion("last_update_time between", value1, value2, "lastUpdateTime");
return (Criteria) this;
}
public Criteria andLastUpdateTimeNotBetween(Date value1, Date value2) {
addCriterion("last_update_time not between", value1, value2, "lastUpdateTime");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}
\ No newline at end of file
package com.haomostudio.delivery.vo;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.haomostudio.delivery.po.Catalog;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class CatalogVO{
@JsonProperty("includes")
private Map<String, Object> includes;
@JsonProperty("refers")
private Map<String, List<Object>> refers;
@JsonProperty("relates")
private Map<String, List<Object>> relates;
private Catalog superior;
public Catalog getSuperior() {
return superior;
}
public CatalogVO(Catalog superior){
this.superior = superior;
this.includes = new HashMap<>();
this.refers = new HashMap<>();
this.relates = new HashMap<>();
}
public void setSuperior(Catalog superior) {
this.superior = superior;
}
public void setIncludes(Map<String, Object>includes){
this.includes = includes;
}
public Map<String, Object> getIncludes(){
return this.includes;
}
public void setRefers(Map<String, List<Object>> refers){
this.refers = refers;
}
public Map<String, List<Object>> getRefers(){
return this.refers;
}
public void setRelates(Map<String, List<Object>> relates){
this.relates = relates;
}
public Map<String, List<Object>> getRelates(){
return this.relates;
}
}
package com.haomostudio.delivery.vo;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.haomostudio.delivery.po.Dept;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class DeptVO{
@JsonProperty("includes")
private Map<String, Object> includes;
@JsonProperty("refers")
private Map<String, List<Object>> refers;
@JsonProperty("relates")
private Map<String, List<Object>> relates;
private Dept superior;
public Dept getSuperior() {
return superior;
}
public DeptVO(Dept superior){
this.superior = superior;
this.includes = new HashMap<>();
this.refers = new HashMap<>();
this.relates = new HashMap<>();
}
public void setSuperior(Dept superior) {
this.superior = superior;
}
public void setIncludes(Map<String, Object>includes){
this.includes = includes;
}
public Map<String, Object> getIncludes(){
return this.includes;
}
public void setRefers(Map<String, List<Object>> refers){
this.refers = refers;
}
public Map<String, List<Object>> getRefers(){
return this.refers;
}
public void setRelates(Map<String, List<Object>> relates){
this.relates = relates;
}
public Map<String, List<Object>> getRelates(){
return this.relates;
}
}
package com.haomostudio.delivery.vo;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.haomostudio.delivery.po.RoleCatalog;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class RoleCatalogVO{
@JsonProperty("includes")
private Map<String, Object> includes;
@JsonProperty("refers")
private Map<String, List<Object>> refers;
@JsonProperty("relates")
private Map<String, List<Object>> relates;
private RoleCatalog superior;
public RoleCatalog getSuperior() {
return superior;
}
public RoleCatalogVO(RoleCatalog superior){
this.superior = superior;
this.includes = new HashMap<>();
this.refers = new HashMap<>();
this.relates = new HashMap<>();
}
public void setSuperior(RoleCatalog superior) {
this.superior = superior;
}
public void setIncludes(Map<String, Object>includes){
this.includes = includes;
}
public Map<String, Object> getIncludes(){
return this.includes;
}
public void setRefers(Map<String, List<Object>> refers){
this.refers = refers;
}
public Map<String, List<Object>> getRefers(){
return this.refers;
}
public void setRelates(Map<String, List<Object>> relates){
this.relates = relates;
}
public Map<String, List<Object>> getRelates(){
return this.relates;
}
}
package com.haomostudio.delivery.vo;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.haomostudio.delivery.po.TRole;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class TRoleVO{
@JsonProperty("includes")
private Map<String, Object> includes;
@JsonProperty("refers")
private Map<String, List<Object>> refers;
@JsonProperty("relates")
private Map<String, List<Object>> relates;
private TRole superior;
public TRole getSuperior() {
return superior;
}
public TRoleVO(TRole superior){
this.superior = superior;
this.includes = new HashMap<>();
this.refers = new HashMap<>();
this.relates = new HashMap<>();
}
public void setSuperior(TRole superior) {
this.superior = superior;
}
public void setIncludes(Map<String, Object>includes){
this.includes = includes;
}
public Map<String, Object> getIncludes(){
return this.includes;
}
public void setRefers(Map<String, List<Object>> refers){
this.refers = refers;
}
public Map<String, List<Object>> getRefers(){
return this.refers;
}
public void setRelates(Map<String, List<Object>> relates){
this.relates = relates;
}
public Map<String, List<Object>> getRelates(){
return this.relates;
}
}
package com.haomostudio.delivery.vo;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.haomostudio.delivery.po.TUserRole;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class TUserRoleVO{
@JsonProperty("includes")
private Map<String, Object> includes;
@JsonProperty("refers")
private Map<String, List<Object>> refers;
@JsonProperty("relates")
private Map<String, List<Object>> relates;
private TUserRole superior;
public TUserRole getSuperior() {
return superior;
}
public TUserRoleVO(TUserRole superior){
this.superior = superior;
this.includes = new HashMap<>();
this.refers = new HashMap<>();
this.relates = new HashMap<>();
}
public void setSuperior(TUserRole superior) {
this.superior = superior;
}
public void setIncludes(Map<String, Object>includes){
this.includes = includes;
}
public Map<String, Object> getIncludes(){
return this.includes;
}
public void setRefers(Map<String, List<Object>> refers){
this.refers = refers;
}
public Map<String, List<Object>> getRefers(){
return this.refers;
}
public void setRelates(Map<String, List<Object>> relates){
this.relates = relates;
}
public Map<String, List<Object>> getRelates(){
return this.relates;
}
}
package com.haomostudio.delivery.vo;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.haomostudio.delivery.po.User;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class UserVO{
@JsonProperty("includes")
private Map<String, Object> includes;
@JsonProperty("refers")
private Map<String, List<Object>> refers;
@JsonProperty("relates")
private Map<String, List<Object>> relates;
private User superior;
public User getSuperior() {
return superior;
}
public UserVO(User superior){
this.superior = superior;
this.includes = new HashMap<>();
this.refers = new HashMap<>();
this.relates = new HashMap<>();
}
public void setSuperior(User superior) {
this.superior = superior;
}
public void setIncludes(Map<String, Object>includes){
this.includes = includes;
}
public Map<String, Object> getIncludes(){
return this.includes;
}
public void setRefers(Map<String, List<Object>> refers){
this.refers = refers;
}
public Map<String, List<Object>> getRefers(){
return this.refers;
}
public void setRelates(Map<String, List<Object>> relates){
this.relates = relates;
}
public Map<String, List<Object>> getRelates(){
return this.relates;
}
}
#!/usr/bin/env bash
mvn mybatis-generator:generate -pl web
...@@ -169,11 +169,11 @@ ...@@ -169,11 +169,11 @@
<!-- 添加mysql jdbc driver --> <!-- 添加mysql jdbc driver -->
<!--<dependency>--> <dependency>
<!--<groupId>mysql</groupId>--> <groupId>mysql</groupId>
<!--<artifactId>mysql-connector-java</artifactId>--> <artifactId>mysql-connector-java</artifactId>
<!--<version>5.1.38</version>--> <version>5.1.38</version>
<!--</dependency>--> </dependency>
<!--<dependency>--> <!--<dependency>-->
<!--<groupId>postgresql</groupId>--> <!--<groupId>postgresql</groupId>-->
...@@ -545,9 +545,9 @@ ...@@ -545,9 +545,9 @@
<artifactId>mybatis-generator-maven-plugin</artifactId> <artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.5</version> <version>1.3.5</version>
<configuration> <configuration>
<!--<configurationFile>${basedir}/src/main/resources/mybatis/mysqlGeneratorConfig.xml</configurationFile>--> <configurationFile>${basedir}/src/main/resources/mybatis/mysqlGeneratorConfig.xml</configurationFile>
<!--<configurationFile>${basedir}/src/main/resources/mybatis/oracleGeneratorConfig.xml</configurationFile>--> <!--<configurationFile>${basedir}/src/main/resources/mybatis/oracleGeneratorConfig.xml</configurationFile>-->
<configurationFile>${basedir}/src/main/resources/mybatis/postgresqlGeneratorConfig.xml</configurationFile> <!--<configurationFile>${basedir}/src/main/resources/mybatis/postgresqlGeneratorConfig.xml</configurationFile>-->
<!--postgresqlGeneratorConfig.xml--> <!--postgresqlGeneratorConfig.xml-->
<verbose>true</verbose> <verbose>true</verbose>
<overwrite>true</overwrite> <overwrite>true</overwrite>
......
#!/bin/bash
cd domain/src/main/java/com/haomostudio/SeekTruthBackend/po/
perl -p -i -e "public Criteria fieldsValuesOr( List<String> fields,List<String> values, String column){
addCriterion(Util.dealFieldsValuesDataBaseOR(fields,values,column));
return (Criteria) this;
}" *Example.java
\ No newline at end of file
#!/bin/bash
read -p "请输入项目名:" -t 60 username #等待60秒
echo $username
perl -p -i -e "s/SeekTruthBackend.domain/$username.po/g" dao/src/main/java/com/haomostudio/SeekTruthBackend/dao/*.java
perl -p -i -e "s/SeekTruthBackend.dao/$username.dao/g" web/src/main/resources/mybatis/com/haomostudio/SeekTruthBackend/*Mapper.xml
perl -p -i -e "s/SeekTruthBackend.domain/$username.po/g" web/src/main/resources/mybatis/com/haomostudio/SeekTruthBackend/*Mapper.xml
perl -p -i -e "s/SeekTruthBackend.po/$username.po/g" dao/src/main/java/com/haomostudio/SeekTruthBackend/dao/*.java
perl -p -i -e "s/SeekTruthBackend.po/$username.po/g" web/src/main/resources/mybatis/com/haomostudio/SeekTruthBackend/*Mapper.xml
package com.haomostudio.SeekTruthBackend.service.HmUtils;
/**
* Created by guanpb on 2018/7/10.
*/
public class Page {
// 分页查询开始记录位置
private int begin;
// 分页查看下结束位置
private int end;
// 每页显示记录数
private int length;
// 查询结果总记录数
private int count;
// 当前页码
private int current;
// 总共页数
private int total;
public Page() {
}
/**
* 构造函数
*
* @param begin
* @param length
*/
public Page(int begin, int length) {
this.begin = begin;
this.length = length;
this.end = this.begin + this.length;
this.current = (int) Math.floor((this.begin * 1.0d) / this.length) + 1;
}
/**
* @param begin
* @param length
* @param count
*/
public Page(int begin, int length, int count) {
this(begin, length);
this.count = count;
}
/**
* @return the begin
*/
public int getBegin() {
return begin;
}
/**
* @return the end
*/
public int getEnd() {
return end;
}
/**
* @param end
* the end to set
*/
public void setEnd(int end) {
this.end = end;
}
/**
* @param begin
* the begin to set
*/
public void setBegin(int begin) {
this.begin = begin;
if (this.length != 0) {
this.current = (int) Math.floor((this.begin * 1.0d) / this.length) + 1;
}
}
/**
* @return the length
*/
public int getLength() {
return length;
}
/**
* @param length
* the length to set
*/
public void setLength(int length) {
this.length = length;
if (this.begin != 0) {
this.current = (int) Math.floor((this.begin * 1.0d) / this.length) + 1;
}
}
/**
* @return the count
*/
public int getCount() {
return count;
}
/**
* @param count
* the count to set
*/
public void setCount(int count) {
this.count = count;
this.total = (int) Math.floor((this.count * 1.0d) / this.length);
if (this.count % this.length != 0) {
this.total++;
}
}
/**
* @return the current
*/
public int getCurrent() {
return current;
}
/**
* @param current
* the current to set
*/
public void setCurrent(int current) {
this.current = current;
}
/**
* @return the total
*/
public int getTotal() {
if (total == 0) {
return 1;
}
return total;
}
/**
* @param total
* the total to set
*/
public void setTotal(int total) {
this.total = total;
}
}
package com.haomostudio.SeekTruthBackend.service.Impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.common.base.CaseFormat;
import com.haomostudio.SeekTruthBackend.service.CatalogService;
import com.haomostudio.SeekTruthBackend.service.HmUtils.MybatisExampleHelper;
import com.haomostudio.Util.Page;
import com.haomostudio.delivery.dao.*;
import com.haomostudio.delivery.po.Catalog;
import com.haomostudio.delivery.po.CatalogExample;
import com.haomostudio.delivery.vo.CatalogVO;
import org.apache.ibatis.binding.MapperProxy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* Created by hxgqh on 2016/1/7.
*/
@Service("catalogService")
public class CatalogServiceImpl implements CatalogService {
protected static final Logger LOG = LoggerFactory.getLogger(CatalogServiceImpl.class);
// 将所有的modelMapper注入
@Autowired
DeptMapper deptMapper;
@Autowired
UserMapper userMapper;
@Autowired
TRoleMapper tRoleMapper;
@Autowired
TUserRoleMapper tUserRoleMapper;
@Autowired
CatalogMapper catalogMapper;
@Autowired
RoleCatalogMapper roleCatalogMapper;
@Override
public int create(Catalog item) {
return catalogMapper.insertSelective(item);
}
@Override
public int delete(String id) {
return catalogMapper.deleteByPrimaryKey(id);
}
@Override
public int update(Catalog item) {
return catalogMapper.updateByPrimaryKeySelective(item);
}
@Override
public Catalog get(String id) {
return catalogMapper.selectByPrimaryKey(id);
}
private void assignRelates(String relates, List<CatalogVO> modelVOList){
JSONObject relatesObj = JSON.parseObject(relates);
for (String table: relatesObj.keySet()) {
for(CatalogVO modelVO: modelVOList){
List<String> joinCols = (List<String>) relatesObj.get(table);
CatalogExample tableExampleObj = new CatalogExample();
Map<String, Map<String, Map<String, Object>>> tableFilters = new HashMap<>();
for(String joinCol: joinCols){
Map<String, Map<String, Object>> column = new HashMap<>();
Method m = MybatisExampleHelper.getMethod(modelVO.getSuperior(),
"get"+ CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, joinCol));
Map<String, Object> condition = new HashMap();
try{
if (m.invoke(modelVO.getSuperior())==null){
return;
}
condition.put("equalTo", (String)JSON.parse(JSON.toJSONString(m.invoke(modelVO.getSuperior()))));
column.put(joinCol, condition);
tableFilters.put(table, column);
}
catch (InvocationTargetException e) {
LOG.error(e.toString());
}
catch (IllegalAccessException e){
LOG.error(e.toString());
}
}
MybatisExampleHelper.assignWhereClause(tableExampleObj, tableExampleObj.or(), table, JSON.toJSONString(tableFilters));
tableExampleObj.setOrderByClause(MybatisExampleHelper.createOrderClause("id", "asc"));
// 获取到关联表的列表
try{
Field mapperFieldDef = this.getClass()
.getDeclaredField(CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, table)+"Mapper");
mapperFieldDef.setAccessible(true);
Object fieldValue = mapperFieldDef.get(this);
MapperProxy proxy = (MapperProxy) Proxy.getInvocationHandler(fieldValue);
Method sbewr = MybatisExampleHelper.getMethod(fieldValue, "selectByExample");
Page page = new Page(0,1000);
tableExampleObj.setPage(page);
Object[] args = new Object[]{tableExampleObj};
modelVO.getRelates().put(table, (List<Object>)(proxy.invoke(proxy, sbewr, args)));
}
catch (Throwable e){
LOG.error(e.toString());
}
}
}
}
@Override
public List<Catalog> getListWithPagingAndFilter(
Integer pageNo, Integer pageSize,
String sortItem, String sortOrder,
String filters){
CatalogExample exampleObj = new CatalogExample();
Page page = new Page((pageNo - 1) * pageSize, pageSize);
exampleObj.setPage(page);
MybatisExampleHelper.assignWhereClause(exampleObj, exampleObj.or(), "Catalog", filters);
exampleObj.setOrderByClause(MybatisExampleHelper.createOrderClause(sortItem, sortOrder));
return catalogMapper.selectByExample(exampleObj);
}
@Override
public Object getListWithPagingAndFilter(
Integer pageNo, Integer pageSize,
String sortItem, String sortOrder,
String filters, String includes, String refers, String relates){
CatalogExample exampleObj = new CatalogExample();
Page page = new Page((pageNo - 1) * pageSize, pageSize);
exampleObj.setPage(page);
MybatisExampleHelper.assignWhereClause(exampleObj, exampleObj.or(), "Catalog", filters);
exampleObj.setOrderByClause(MybatisExampleHelper.createOrderClause(sortItem, sortOrder));
List<Catalog> modelList = catalogMapper.selectByExample(exampleObj);
List<CatalogVO> modelVOList = modelList.stream().map(model -> new CatalogVO(model)).collect(Collectors.toList());
// 处理includes的外链字段 处理refers的关联表
if((includes != null || refers != null)&& modelList.size() > 0){
//对Vo层数据循环处理外链表数据
modelVOList.stream().forEach(status->{
if (includes != null){
this.assignIncludes(includes,status);
}
if (refers != null){
this.assignRefers(refers,status);
}
});
}
// 处理join的关联表
if(relates != null && modelList.size() > 0){
this.assignRelates(relates, modelVOList);
}
if(includes == null && refers == null && relates == null){
return modelList;
}
else{
return modelVOList;
}
}
@Override
public Long countListWithPagingAndFilter(String filters){
CatalogExample exampleObj = new CatalogExample();
MybatisExampleHelper.assignWhereClause(exampleObj, exampleObj.or(), "Catalog", filters);
return catalogMapper.countByExample(exampleObj);
}
private void assignIncludes(String includes, CatalogVO status){
JSONObject includesObj = JSON.parseObject(includes);
//定义容器存储所有外链表数据
Map<String,Object> map = new HashMap();
// 循环解析每一个键值对
if (includesObj!=null && includesObj.keySet().size() >0){
includesObj.keySet().stream().forEach(table->{
//每一个key都是一个po实体类名
Object className = CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, table);
JSONObject jsonObject = includesObj.getJSONObject(
CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, table));
//对内层的includes数据进行解析
JSONArray columnCondition = jsonObject.getJSONArray("includes");
if (columnCondition != null && columnCondition.toArray().length >0){
//循环数组
Arrays.stream(columnCondition.toArray()).forEach(obj -> {
//反射机制将要执行的方法名
String ffName = "get"+CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, obj.toString());
//获取Method的对象
Method m = MybatisExampleHelper.getMethod(status.getSuperior(), ffName);
MybatisExampleHelper.dealSearchIncludes(m,status.getSuperior(),
className,map,table,this.getClass().getPackage().getName());
});
}
});
}
status.setIncludes(map);
}
private void assignRefers(String refers, CatalogVO status){
//解析includes字符串为JSONObject
JSONObject refersObj = JSON.parseObject(refers);
//定义容器存储所有外链表数据
Map<String,List<Object>> map = new HashMap();
if (refersObj!=null && refersObj.keySet().size() > 0){
// 循环解析每一个键值对
refersObj.keySet().stream().forEach(table -> {
//每一个key都是一个po实体类名
JSONObject jsonObject = refersObj.getJSONObject(
CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, table));
//对内层的includes数据进行解析
JSONArray columnCondition = jsonObject.getJSONArray("includes");
if (columnCondition != null && columnCondition.toArray().length > 0){
//循环数组
Arrays.stream(columnCondition.toArray()).forEach(obj -> {
MybatisExampleHelper.dealSearchRefers(status.getSuperior().getId(),
table,map,obj,CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, table),
this.getClass().getPackage().getName());
});
}
});
}
status.setRefers(map);
}
}
package com.haomostudio.SeekTruthBackend.service.Impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.common.base.CaseFormat;
import com.haomostudio.SeekTruthBackend.service.DeptService;
import com.haomostudio.SeekTruthBackend.service.HmUtils.MybatisExampleHelper;
import com.haomostudio.Util.Page;
import com.haomostudio.delivery.dao.*;
import com.haomostudio.delivery.po.Dept;
import com.haomostudio.delivery.po.DeptExample;
import com.haomostudio.delivery.vo.DeptVO;
import org.apache.ibatis.binding.MapperProxy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* Created by hxgqh on 2016/1/7.
*/
@Service("deptService")
public class DeptServiceImpl implements DeptService {
protected static final Logger LOG = LoggerFactory.getLogger(DeptServiceImpl.class);
// 将所有的modelMapper注入
@Autowired
DeptMapper deptMapper;
@Autowired
UserMapper userMapper;
@Autowired
TRoleMapper tRoleMapper;
@Autowired
TUserRoleMapper tUserRoleMapper;
@Autowired
CatalogMapper catalogMapper;
@Autowired
RoleCatalogMapper roleCatalogMapper;
@Override
public int create(Dept item) {
return deptMapper.insertSelective(item);
}
@Override
public int delete(String id) {
return deptMapper.deleteByPrimaryKey(id);
}
@Override
public int update(Dept item) {
return deptMapper.updateByPrimaryKeySelective(item);
}
@Override
public Dept get(String id) {
return deptMapper.selectByPrimaryKey(id);
}
private void assignRelates(String relates, List<DeptVO> modelVOList){
JSONObject relatesObj = JSON.parseObject(relates);
for (String table: relatesObj.keySet()) {
for(DeptVO modelVO: modelVOList){
List<String> joinCols = (List<String>) relatesObj.get(table);
DeptExample tableExampleObj = new DeptExample();
Map<String, Map<String, Map<String, Object>>> tableFilters = new HashMap<>();
for(String joinCol: joinCols){
Map<String, Map<String, Object>> column = new HashMap<>();
Method m = MybatisExampleHelper.getMethod(modelVO.getSuperior(),
"get"+ CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, joinCol));
Map<String, Object> condition = new HashMap();
try{
if (m.invoke(modelVO.getSuperior())==null){
return;
}
condition.put("equalTo", (String)JSON.parse(JSON.toJSONString(m.invoke(modelVO.getSuperior()))));
column.put(joinCol, condition);
tableFilters.put(table, column);
}
catch (InvocationTargetException e) {
LOG.error(e.toString());
}
catch (IllegalAccessException e){
LOG.error(e.toString());
}
}
MybatisExampleHelper.assignWhereClause(tableExampleObj, tableExampleObj.or(), table, JSON.toJSONString(tableFilters));
tableExampleObj.setOrderByClause(MybatisExampleHelper.createOrderClause("id", "asc"));
// 获取到关联表的列表
try{
Field mapperFieldDef = this.getClass()
.getDeclaredField(CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, table)+"Mapper");
mapperFieldDef.setAccessible(true);
Object fieldValue = mapperFieldDef.get(this);
MapperProxy proxy = (MapperProxy) Proxy.getInvocationHandler(fieldValue);
Method sbewr = MybatisExampleHelper.getMethod(fieldValue, "selectByExample");
Page page = new Page(0,1000);
tableExampleObj.setPage(page);
Object[] args = new Object[]{tableExampleObj};
modelVO.getRelates().put(table, (List<Object>)(proxy.invoke(proxy, sbewr, args)));
}
catch (Throwable e){
LOG.error(e.toString());
}
}
}
}
@Override
public List<Dept> getListWithPagingAndFilter(
Integer pageNo, Integer pageSize,
String sortItem, String sortOrder,
String filters){
DeptExample exampleObj = new DeptExample();
Page page = new Page((pageNo - 1) * pageSize, pageSize);
exampleObj.setPage(page);
MybatisExampleHelper.assignWhereClause(exampleObj, exampleObj.or(), "Dept", filters);
exampleObj.setOrderByClause(MybatisExampleHelper.createOrderClause(sortItem, sortOrder));
return deptMapper.selectByExample(exampleObj);
}
@Override
public Object getListWithPagingAndFilter(
Integer pageNo, Integer pageSize,
String sortItem, String sortOrder,
String filters, String includes, String refers, String relates){
DeptExample exampleObj = new DeptExample();
Page page = new Page((pageNo - 1) * pageSize, pageSize);
exampleObj.setPage(page);
MybatisExampleHelper.assignWhereClause(exampleObj, exampleObj.or(), "Dept", filters);
exampleObj.setOrderByClause(MybatisExampleHelper.createOrderClause(sortItem, sortOrder));
List<Dept> modelList = deptMapper.selectByExample(exampleObj);
List<DeptVO> modelVOList = modelList.stream().map(model -> new DeptVO(model)).collect(Collectors.toList());
// 处理includes的外链字段 处理refers的关联表
if((includes != null || refers != null)&& modelList.size() > 0){
//对Vo层数据循环处理外链表数据
modelVOList.stream().forEach(status->{
if (includes != null){
this.assignIncludes(includes,status);
}
if (refers != null){
this.assignRefers(refers,status);
}
});
}
// 处理join的关联表
if(relates != null && modelList.size() > 0){
this.assignRelates(relates, modelVOList);
}
if(includes == null && refers == null && relates == null){
return modelList;
}
else{
return modelVOList;
}
}
@Override
public Long countListWithPagingAndFilter(String filters){
DeptExample exampleObj = new DeptExample();
MybatisExampleHelper.assignWhereClause(exampleObj, exampleObj.or(), "Dept", filters);
return deptMapper.countByExample(exampleObj);
}
private void assignIncludes(String includes, DeptVO status){
JSONObject includesObj = JSON.parseObject(includes);
//定义容器存储所有外链表数据
Map<String,Object> map = new HashMap();
// 循环解析每一个键值对
if (includesObj!=null && includesObj.keySet().size() >0){
includesObj.keySet().stream().forEach(table->{
//每一个key都是一个po实体类名
Object className = CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, table);
JSONObject jsonObject = includesObj.getJSONObject(
CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, table));
//对内层的includes数据进行解析
JSONArray columnCondition = jsonObject.getJSONArray("includes");
if (columnCondition != null && columnCondition.toArray().length >0){
//循环数组
Arrays.stream(columnCondition.toArray()).forEach(obj -> {
//反射机制将要执行的方法名
String ffName = "get"+CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, obj.toString());
//获取Method的对象
Method m = MybatisExampleHelper.getMethod(status.getSuperior(), ffName);
MybatisExampleHelper.dealSearchIncludes(m,status.getSuperior(),
className,map,table,this.getClass().getPackage().getName());
});
}
});
}
status.setIncludes(map);
}
private void assignRefers(String refers, DeptVO status){
//解析includes字符串为JSONObject
JSONObject refersObj = JSON.parseObject(refers);
//定义容器存储所有外链表数据
Map<String,List<Object>> map = new HashMap();
if (refersObj!=null && refersObj.keySet().size() > 0){
// 循环解析每一个键值对
refersObj.keySet().stream().forEach(table -> {
//每一个key都是一个po实体类名
JSONObject jsonObject = refersObj.getJSONObject(
CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, table));
//对内层的includes数据进行解析
JSONArray columnCondition = jsonObject.getJSONArray("includes");
if (columnCondition != null && columnCondition.toArray().length > 0){
//循环数组
Arrays.stream(columnCondition.toArray()).forEach(obj -> {
MybatisExampleHelper.dealSearchRefers(status.getSuperior().getId(),
table,map,obj,CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, table),
this.getClass().getPackage().getName());
});
}
});
}
status.setRefers(map);
}
}
package com.haomostudio.SeekTruthBackend.service.Impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.common.base.CaseFormat;
import com.haomostudio.SeekTruthBackend.service.HmUtils.MybatisExampleHelper;
import com.haomostudio.SeekTruthBackend.service.RoleCatalogService;
import com.haomostudio.Util.Page;
import com.haomostudio.delivery.dao.*;
import com.haomostudio.delivery.po.RoleCatalog;
import com.haomostudio.delivery.po.RoleCatalogExample;
import com.haomostudio.delivery.vo.RoleCatalogVO;
import org.apache.ibatis.binding.MapperProxy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* Created by hxgqh on 2016/1/7.
*/
@Service("roleCatalogService")
public class RoleCatalogServiceImpl implements RoleCatalogService {
protected static final Logger LOG = LoggerFactory.getLogger(RoleCatalogServiceImpl.class);
// 将所有的modelMapper注入
@Autowired
DeptMapper deptMapper;
@Autowired
UserMapper userMapper;
@Autowired
TRoleMapper tRoleMapper;
@Autowired
TUserRoleMapper tUserRoleMapper;
@Autowired
CatalogMapper catalogMapper;
@Autowired
RoleCatalogMapper roleCatalogMapper;
@Override
public int create(RoleCatalog item) {
return roleCatalogMapper.insertSelective(item);
}
@Override
public int delete(String id) {
return roleCatalogMapper.deleteByPrimaryKey(id);
}
@Override
public int update(RoleCatalog item) {
return roleCatalogMapper.updateByPrimaryKeySelective(item);
}
@Override
public RoleCatalog get(String id) {
return roleCatalogMapper.selectByPrimaryKey(id);
}
private void assignRelates(String relates, List<RoleCatalogVO> modelVOList){
JSONObject relatesObj = JSON.parseObject(relates);
for (String table: relatesObj.keySet()) {
for(RoleCatalogVO modelVO: modelVOList){
List<String> joinCols = (List<String>) relatesObj.get(table);
RoleCatalogExample tableExampleObj = new RoleCatalogExample();
Map<String, Map<String, Map<String, Object>>> tableFilters = new HashMap<>();
for(String joinCol: joinCols){
Map<String, Map<String, Object>> column = new HashMap<>();
Method m = MybatisExampleHelper.getMethod(modelVO.getSuperior(),
"get"+ CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, joinCol));
Map<String, Object> condition = new HashMap();
try{
if (m.invoke(modelVO.getSuperior())==null){
return;
}
condition.put("equalTo", (String)JSON.parse(JSON.toJSONString(m.invoke(modelVO.getSuperior()))));
column.put(joinCol, condition);
tableFilters.put(table, column);
}
catch (InvocationTargetException e) {
LOG.error(e.toString());
}
catch (IllegalAccessException e){
LOG.error(e.toString());
}
}
MybatisExampleHelper.assignWhereClause(tableExampleObj, tableExampleObj.or(), table, JSON.toJSONString(tableFilters));
tableExampleObj.setOrderByClause(MybatisExampleHelper.createOrderClause("id", "asc"));
// 获取到关联表的列表
try{
Field mapperFieldDef = this.getClass()
.getDeclaredField(CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, table)+"Mapper");
mapperFieldDef.setAccessible(true);
Object fieldValue = mapperFieldDef.get(this);
MapperProxy proxy = (MapperProxy) Proxy.getInvocationHandler(fieldValue);
Method sbewr = MybatisExampleHelper.getMethod(fieldValue, "selectByExample");
Page page = new Page(0,1000);
tableExampleObj.setPage(page);
Object[] args = new Object[]{tableExampleObj};
modelVO.getRelates().put(table, (List<Object>)(proxy.invoke(proxy, sbewr, args)));
}
catch (Throwable e){
LOG.error(e.toString());
}
}
}
}
@Override
public List<RoleCatalog> getListWithPagingAndFilter(
Integer pageNo, Integer pageSize,
String sortItem, String sortOrder,
String filters){
RoleCatalogExample exampleObj = new RoleCatalogExample();
Page page = new Page((pageNo - 1) * pageSize, pageSize);
exampleObj.setPage(page);
MybatisExampleHelper.assignWhereClause(exampleObj, exampleObj.or(), "RoleCatalog", filters);
exampleObj.setOrderByClause(MybatisExampleHelper.createOrderClause(sortItem, sortOrder));
return roleCatalogMapper.selectByExample(exampleObj);
}
@Override
public Object getListWithPagingAndFilter(
Integer pageNo, Integer pageSize,
String sortItem, String sortOrder,
String filters, String includes, String refers, String relates){
RoleCatalogExample exampleObj = new RoleCatalogExample();
Page page = new Page((pageNo - 1) * pageSize, pageSize);
exampleObj.setPage(page);
MybatisExampleHelper.assignWhereClause(exampleObj, exampleObj.or(), "RoleCatalog", filters);
exampleObj.setOrderByClause(MybatisExampleHelper.createOrderClause(sortItem, sortOrder));
List<RoleCatalog> modelList = roleCatalogMapper.selectByExample(exampleObj);
List<RoleCatalogVO> modelVOList = modelList.stream().map(model -> new RoleCatalogVO(model)).collect(Collectors.toList());
// 处理includes的外链字段 处理refers的关联表
if((includes != null || refers != null)&& modelList.size() > 0){
//对Vo层数据循环处理外链表数据
modelVOList.stream().forEach(status->{
if (includes != null){
this.assignIncludes(includes,status);
}
if (refers != null){
this.assignRefers(refers,status);
}
});
}
// 处理join的关联表
if(relates != null && modelList.size() > 0){
this.assignRelates(relates, modelVOList);
}
if(includes == null && refers == null && relates == null){
return modelList;
}
else{
return modelVOList;
}
}
@Override
public Long countListWithPagingAndFilter(String filters){
RoleCatalogExample exampleObj = new RoleCatalogExample();
MybatisExampleHelper.assignWhereClause(exampleObj, exampleObj.or(), "RoleCatalog", filters);
return roleCatalogMapper.countByExample(exampleObj);
}
private void assignIncludes(String includes, RoleCatalogVO status){
JSONObject includesObj = JSON.parseObject(includes);
//定义容器存储所有外链表数据
Map<String,Object> map = new HashMap();
// 循环解析每一个键值对
if (includesObj!=null && includesObj.keySet().size() >0){
includesObj.keySet().stream().forEach(table->{
//每一个key都是一个po实体类名
Object className = CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, table);
JSONObject jsonObject = includesObj.getJSONObject(
CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, table));
//对内层的includes数据进行解析
JSONArray columnCondition = jsonObject.getJSONArray("includes");
if (columnCondition != null && columnCondition.toArray().length >0){
//循环数组
Arrays.stream(columnCondition.toArray()).forEach(obj -> {
//反射机制将要执行的方法名
String ffName = "get"+CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, obj.toString());
//获取Method的对象
Method m = MybatisExampleHelper.getMethod(status.getSuperior(), ffName);
MybatisExampleHelper.dealSearchIncludes(m,status.getSuperior(),
className,map,table,this.getClass().getPackage().getName());
});
}
});
}
status.setIncludes(map);
}
private void assignRefers(String refers, RoleCatalogVO status){
//解析includes字符串为JSONObject
JSONObject refersObj = JSON.parseObject(refers);
//定义容器存储所有外链表数据
Map<String,List<Object>> map = new HashMap();
if (refersObj!=null && refersObj.keySet().size() > 0){
// 循环解析每一个键值对
refersObj.keySet().stream().forEach(table -> {
//每一个key都是一个po实体类名
JSONObject jsonObject = refersObj.getJSONObject(
CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, table));
//对内层的includes数据进行解析
JSONArray columnCondition = jsonObject.getJSONArray("includes");
if (columnCondition != null && columnCondition.toArray().length > 0){
//循环数组
Arrays.stream(columnCondition.toArray()).forEach(obj -> {
MybatisExampleHelper.dealSearchRefers(status.getSuperior().getId(),
table,map,obj,CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, table),
this.getClass().getPackage().getName());
});
}
});
}
status.setRefers(map);
}
}
package com.haomostudio.SeekTruthBackend.service.Impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.common.base.CaseFormat;
import com.haomostudio.SeekTruthBackend.service.HmUtils.MybatisExampleHelper;
import com.haomostudio.SeekTruthBackend.service.TRoleService;
import com.haomostudio.Util.Page;
import com.haomostudio.delivery.dao.*;
import com.haomostudio.delivery.po.TRole;
import com.haomostudio.delivery.po.TRoleExample;
import com.haomostudio.delivery.vo.TRoleVO;
import org.apache.ibatis.binding.MapperProxy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* Created by hxgqh on 2016/1/7.
*/
@Service("tRoleService")
public class TRoleServiceImpl implements TRoleService {
protected static final Logger LOG = LoggerFactory.getLogger(TRoleServiceImpl.class);
// 将所有的modelMapper注入
@Autowired
DeptMapper deptMapper;
@Autowired
UserMapper userMapper;
@Autowired
TRoleMapper tRoleMapper;
@Autowired
TUserRoleMapper tUserRoleMapper;
@Autowired
CatalogMapper catalogMapper;
@Autowired
RoleCatalogMapper roleCatalogMapper;
@Override
public int create(TRole item) {
return tRoleMapper.insertSelective(item);
}
@Override
public int delete(String id) {
return tRoleMapper.deleteByPrimaryKey(id);
}
@Override
public int update(TRole item) {
return tRoleMapper.updateByPrimaryKeySelective(item);
}
@Override
public TRole get(String id) {
return tRoleMapper.selectByPrimaryKey(id);
}
private void assignRelates(String relates, List<TRoleVO> modelVOList){
JSONObject relatesObj = JSON.parseObject(relates);
for (String table: relatesObj.keySet()) {
for(TRoleVO modelVO: modelVOList){
List<String> joinCols = (List<String>) relatesObj.get(table);
TRoleExample tableExampleObj = new TRoleExample();
Map<String, Map<String, Map<String, Object>>> tableFilters = new HashMap<>();
for(String joinCol: joinCols){
Map<String, Map<String, Object>> column = new HashMap<>();
Method m = MybatisExampleHelper.getMethod(modelVO.getSuperior(),
"get"+ CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, joinCol));
Map<String, Object> condition = new HashMap();
try{
if (m.invoke(modelVO.getSuperior())==null){
return;
}
condition.put("equalTo", (String)JSON.parse(JSON.toJSONString(m.invoke(modelVO.getSuperior()))));
column.put(joinCol, condition);
tableFilters.put(table, column);
}
catch (InvocationTargetException e) {
LOG.error(e.toString());
}
catch (IllegalAccessException e){
LOG.error(e.toString());
}
}
MybatisExampleHelper.assignWhereClause(tableExampleObj, tableExampleObj.or(), table, JSON.toJSONString(tableFilters));
tableExampleObj.setOrderByClause(MybatisExampleHelper.createOrderClause("id", "asc"));
// 获取到关联表的列表
try{
Field mapperFieldDef = this.getClass()
.getDeclaredField(CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, table)+"Mapper");
mapperFieldDef.setAccessible(true);
Object fieldValue = mapperFieldDef.get(this);
MapperProxy proxy = (MapperProxy) Proxy.getInvocationHandler(fieldValue);
Method sbewr = MybatisExampleHelper.getMethod(fieldValue, "selectByExample");
Page page = new Page(0,1000);
tableExampleObj.setPage(page);
Object[] args = new Object[]{tableExampleObj};
modelVO.getRelates().put(table, (List<Object>)(proxy.invoke(proxy, sbewr, args)));
}
catch (Throwable e){
LOG.error(e.toString());
}
}
}
}
@Override
public List<TRole> getListWithPagingAndFilter(
Integer pageNo, Integer pageSize,
String sortItem, String sortOrder,
String filters){
TRoleExample exampleObj = new TRoleExample();
Page page = new Page((pageNo - 1) * pageSize, pageSize);
exampleObj.setPage(page);
MybatisExampleHelper.assignWhereClause(exampleObj, exampleObj.or(), "TRole", filters);
exampleObj.setOrderByClause(MybatisExampleHelper.createOrderClause(sortItem, sortOrder));
return tRoleMapper.selectByExample(exampleObj);
}
@Override
public Object getListWithPagingAndFilter(
Integer pageNo, Integer pageSize,
String sortItem, String sortOrder,
String filters, String includes, String refers, String relates){
TRoleExample exampleObj = new TRoleExample();
Page page = new Page((pageNo - 1) * pageSize, pageSize);
exampleObj.setPage(page);
MybatisExampleHelper.assignWhereClause(exampleObj, exampleObj.or(), "TRole", filters);
exampleObj.setOrderByClause(MybatisExampleHelper.createOrderClause(sortItem, sortOrder));
List<TRole> modelList = tRoleMapper.selectByExample(exampleObj);
List<TRoleVO> modelVOList = modelList.stream().map(model -> new TRoleVO(model)).collect(Collectors.toList());
// 处理includes的外链字段 处理refers的关联表
if((includes != null || refers != null)&& modelList.size() > 0){
//对Vo层数据循环处理外链表数据
modelVOList.stream().forEach(status->{
if (includes != null){
this.assignIncludes(includes,status);
}
if (refers != null){
this.assignRefers(refers,status);
}
});
}
// 处理join的关联表
if(relates != null && modelList.size() > 0){
this.assignRelates(relates, modelVOList);
}
if(includes == null && refers == null && relates == null){
return modelList;
}
else{
return modelVOList;
}
}
@Override
public Long countListWithPagingAndFilter(String filters){
TRoleExample exampleObj = new TRoleExample();
MybatisExampleHelper.assignWhereClause(exampleObj, exampleObj.or(), "TRole", filters);
return tRoleMapper.countByExample(exampleObj);
}
private void assignIncludes(String includes, TRoleVO status){
JSONObject includesObj = JSON.parseObject(includes);
//定义容器存储所有外链表数据
Map<String,Object> map = new HashMap();
// 循环解析每一个键值对
if (includesObj!=null && includesObj.keySet().size() >0){
includesObj.keySet().stream().forEach(table->{
//每一个key都是一个po实体类名
Object className = CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, table);
JSONObject jsonObject = includesObj.getJSONObject(
CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, table));
//对内层的includes数据进行解析
JSONArray columnCondition = jsonObject.getJSONArray("includes");
if (columnCondition != null && columnCondition.toArray().length >0){
//循环数组
Arrays.stream(columnCondition.toArray()).forEach(obj -> {
//反射机制将要执行的方法名
String ffName = "get"+CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, obj.toString());
//获取Method的对象
Method m = MybatisExampleHelper.getMethod(status.getSuperior(), ffName);
MybatisExampleHelper.dealSearchIncludes(m,status.getSuperior(),
className,map,table,this.getClass().getPackage().getName());
});
}
});
}
status.setIncludes(map);
}
private void assignRefers(String refers, TRoleVO status){
//解析includes字符串为JSONObject
JSONObject refersObj = JSON.parseObject(refers);
//定义容器存储所有外链表数据
Map<String,List<Object>> map = new HashMap();
if (refersObj!=null && refersObj.keySet().size() > 0){
// 循环解析每一个键值对
refersObj.keySet().stream().forEach(table -> {
//每一个key都是一个po实体类名
JSONObject jsonObject = refersObj.getJSONObject(
CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, table));
//对内层的includes数据进行解析
JSONArray columnCondition = jsonObject.getJSONArray("includes");
if (columnCondition != null && columnCondition.toArray().length > 0){
//循环数组
Arrays.stream(columnCondition.toArray()).forEach(obj -> {
MybatisExampleHelper.dealSearchRefers(status.getSuperior().getId(),
table,map,obj,CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, table),
this.getClass().getPackage().getName());
});
}
});
}
status.setRefers(map);
}
}
package com.haomostudio.SeekTruthBackend.service.Impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.common.base.CaseFormat;
import com.haomostudio.SeekTruthBackend.service.HmUtils.MybatisExampleHelper;
import com.haomostudio.SeekTruthBackend.service.TUserRoleService;
import com.haomostudio.Util.Page;
import com.haomostudio.delivery.dao.*;
import com.haomostudio.delivery.po.TUserRole;
import com.haomostudio.delivery.po.TUserRoleExample;
import com.haomostudio.delivery.vo.TUserRoleVO;
import org.apache.ibatis.binding.MapperProxy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* Created by hxgqh on 2016/1/7.
*/
@Service("tUserRoleService")
public class TUserRoleServiceImpl implements TUserRoleService {
protected static final Logger LOG = LoggerFactory.getLogger(TUserRoleServiceImpl.class);
// 将所有的modelMapper注入
@Autowired
DeptMapper deptMapper;
@Autowired
UserMapper userMapper;
@Autowired
TRoleMapper tRoleMapper;
@Autowired
TUserRoleMapper tUserRoleMapper;
@Autowired
CatalogMapper catalogMapper;
@Autowired
RoleCatalogMapper roleCatalogMapper;
@Override
public int create(TUserRole item) {
return tUserRoleMapper.insertSelective(item);
}
@Override
public int delete(String id) {
return tUserRoleMapper.deleteByPrimaryKey(id);
}
@Override
public int update(TUserRole item) {
return tUserRoleMapper.updateByPrimaryKeySelective(item);
}
@Override
public TUserRole get(String id) {
return tUserRoleMapper.selectByPrimaryKey(id);
}
private void assignRelates(String relates, List<TUserRoleVO> modelVOList){
JSONObject relatesObj = JSON.parseObject(relates);
for (String table: relatesObj.keySet()) {
for(TUserRoleVO modelVO: modelVOList){
List<String> joinCols = (List<String>) relatesObj.get(table);
TUserRoleExample tableExampleObj = new TUserRoleExample();
Map<String, Map<String, Map<String, Object>>> tableFilters = new HashMap<>();
for(String joinCol: joinCols){
Map<String, Map<String, Object>> column = new HashMap<>();
Method m = MybatisExampleHelper.getMethod(modelVO.getSuperior(),
"get"+ CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, joinCol));
Map<String, Object> condition = new HashMap();
try{
if (m.invoke(modelVO.getSuperior())==null){
return;
}
condition.put("equalTo", (String)JSON.parse(JSON.toJSONString(m.invoke(modelVO.getSuperior()))));
column.put(joinCol, condition);
tableFilters.put(table, column);
}
catch (InvocationTargetException e) {
LOG.error(e.toString());
}
catch (IllegalAccessException e){
LOG.error(e.toString());
}
}
MybatisExampleHelper.assignWhereClause(tableExampleObj, tableExampleObj.or(), table, JSON.toJSONString(tableFilters));
tableExampleObj.setOrderByClause(MybatisExampleHelper.createOrderClause("id", "asc"));
// 获取到关联表的列表
try{
Field mapperFieldDef = this.getClass()
.getDeclaredField(CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, table)+"Mapper");
mapperFieldDef.setAccessible(true);
Object fieldValue = mapperFieldDef.get(this);
MapperProxy proxy = (MapperProxy) Proxy.getInvocationHandler(fieldValue);
Method sbewr = MybatisExampleHelper.getMethod(fieldValue, "selectByExample");
Page page = new Page(0,1000);
tableExampleObj.setPage(page);
Object[] args = new Object[]{tableExampleObj};
modelVO.getRelates().put(table, (List<Object>)(proxy.invoke(proxy, sbewr, args)));
}
catch (Throwable e){
LOG.error(e.toString());
}
}
}
}
@Override
public List<TUserRole> getListWithPagingAndFilter(
Integer pageNo, Integer pageSize,
String sortItem, String sortOrder,
String filters){
TUserRoleExample exampleObj = new TUserRoleExample();
Page page = new Page((pageNo - 1) * pageSize, pageSize);
exampleObj.setPage(page);
MybatisExampleHelper.assignWhereClause(exampleObj, exampleObj.or(), "TUserRole", filters);
exampleObj.setOrderByClause(MybatisExampleHelper.createOrderClause(sortItem, sortOrder));
return tUserRoleMapper.selectByExample(exampleObj);
}
@Override
public Object getListWithPagingAndFilter(
Integer pageNo, Integer pageSize,
String sortItem, String sortOrder,
String filters, String includes, String refers, String relates){
TUserRoleExample exampleObj = new TUserRoleExample();
Page page = new Page((pageNo - 1) * pageSize, pageSize);
exampleObj.setPage(page);
MybatisExampleHelper.assignWhereClause(exampleObj, exampleObj.or(), "TUserRole", filters);
exampleObj.setOrderByClause(MybatisExampleHelper.createOrderClause(sortItem, sortOrder));
List<TUserRole> modelList = tUserRoleMapper.selectByExample(exampleObj);
List<TUserRoleVO> modelVOList = modelList.stream().map(model -> new TUserRoleVO(model)).collect(Collectors.toList());
// 处理includes的外链字段 处理refers的关联表
if((includes != null || refers != null)&& modelList.size() > 0){
//对Vo层数据循环处理外链表数据
modelVOList.stream().forEach(status->{
if (includes != null){
this.assignIncludes(includes,status);
}
if (refers != null){
this.assignRefers(refers,status);
}
});
}
// 处理join的关联表
if(relates != null && modelList.size() > 0){
this.assignRelates(relates, modelVOList);
}
if(includes == null && refers == null && relates == null){
return modelList;
}
else{
return modelVOList;
}
}
@Override
public Long countListWithPagingAndFilter(String filters){
TUserRoleExample exampleObj = new TUserRoleExample();
MybatisExampleHelper.assignWhereClause(exampleObj, exampleObj.or(), "TUserRole", filters);
return tUserRoleMapper.countByExample(exampleObj);
}
private void assignIncludes(String includes, TUserRoleVO status){
JSONObject includesObj = JSON.parseObject(includes);
//定义容器存储所有外链表数据
Map<String,Object> map = new HashMap();
// 循环解析每一个键值对
if (includesObj!=null && includesObj.keySet().size() >0){
includesObj.keySet().stream().forEach(table->{
//每一个key都是一个po实体类名
Object className = CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, table);
JSONObject jsonObject = includesObj.getJSONObject(
CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, table));
//对内层的includes数据进行解析
JSONArray columnCondition = jsonObject.getJSONArray("includes");
if (columnCondition != null && columnCondition.toArray().length >0){
//循环数组
Arrays.stream(columnCondition.toArray()).forEach(obj -> {
//反射机制将要执行的方法名
String ffName = "get"+CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, obj.toString());
//获取Method的对象
Method m = MybatisExampleHelper.getMethod(status.getSuperior(), ffName);
MybatisExampleHelper.dealSearchIncludes(m,status.getSuperior(),
className,map,table,this.getClass().getPackage().getName());
});
}
});
}
status.setIncludes(map);
}
private void assignRefers(String refers, TUserRoleVO status){
//解析includes字符串为JSONObject
JSONObject refersObj = JSON.parseObject(refers);
//定义容器存储所有外链表数据
Map<String,List<Object>> map = new HashMap();
if (refersObj!=null && refersObj.keySet().size() > 0){
// 循环解析每一个键值对
refersObj.keySet().stream().forEach(table -> {
//每一个key都是一个po实体类名
JSONObject jsonObject = refersObj.getJSONObject(
CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, table));
//对内层的includes数据进行解析
JSONArray columnCondition = jsonObject.getJSONArray("includes");
if (columnCondition != null && columnCondition.toArray().length > 0){
//循环数组
Arrays.stream(columnCondition.toArray()).forEach(obj -> {
MybatisExampleHelper.dealSearchRefers(status.getSuperior().getId(),
table,map,obj,CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, table),
this.getClass().getPackage().getName());
});
}
});
}
status.setRefers(map);
}
}
package com.haomostudio.SeekTruthBackend.service.Impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.common.base.CaseFormat;
import com.haomostudio.SeekTruthBackend.service.HmUtils.MybatisExampleHelper;
import com.haomostudio.SeekTruthBackend.service.UserService;
import com.haomostudio.Util.Page;
import com.haomostudio.delivery.dao.*;
import com.haomostudio.delivery.po.User;
import com.haomostudio.delivery.po.UserExample;
import com.haomostudio.delivery.vo.UserVO;
import org.apache.ibatis.binding.MapperProxy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* Created by hxgqh on 2016/1/7.
*/
@Service("userService")
public class UserServiceImpl implements UserService {
protected static final Logger LOG = LoggerFactory.getLogger(UserServiceImpl.class);
// 将所有的modelMapper注入
@Autowired
DeptMapper deptMapper;
@Autowired
UserMapper userMapper;
@Autowired
TRoleMapper tRoleMapper;
@Autowired
TUserRoleMapper tUserRoleMapper;
@Autowired
CatalogMapper catalogMapper;
@Autowired
RoleCatalogMapper roleCatalogMapper;
@Override
public int create(User item) {
return userMapper.insertSelective(item);
}
@Override
public int delete(String id) {
return userMapper.deleteByPrimaryKey(id);
}
@Override
public int update(User item) {
return userMapper.updateByPrimaryKeySelective(item);
}
@Override
public User get(String id) {
return userMapper.selectByPrimaryKey(id);
}
private void assignRelates(String relates, List<UserVO> modelVOList){
JSONObject relatesObj = JSON.parseObject(relates);
for (String table: relatesObj.keySet()) {
for(UserVO modelVO: modelVOList){
List<String> joinCols = (List<String>) relatesObj.get(table);
UserExample tableExampleObj = new UserExample();
Map<String, Map<String, Map<String, Object>>> tableFilters = new HashMap<>();
for(String joinCol: joinCols){
Map<String, Map<String, Object>> column = new HashMap<>();
Method m = MybatisExampleHelper.getMethod(modelVO.getSuperior(),
"get"+ CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, joinCol));
Map<String, Object> condition = new HashMap();
try{
if (m.invoke(modelVO.getSuperior())==null){
return;
}
condition.put("equalTo", (String)JSON.parse(JSON.toJSONString(m.invoke(modelVO.getSuperior()))));
column.put(joinCol, condition);
tableFilters.put(table, column);
}
catch (InvocationTargetException e) {
LOG.error(e.toString());
}
catch (IllegalAccessException e){
LOG.error(e.toString());
}
}
MybatisExampleHelper.assignWhereClause(tableExampleObj, tableExampleObj.or(), table, JSON.toJSONString(tableFilters));
tableExampleObj.setOrderByClause(MybatisExampleHelper.createOrderClause("id", "asc"));
// 获取到关联表的列表
try{
Field mapperFieldDef = this.getClass()
.getDeclaredField(CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, table)+"Mapper");
mapperFieldDef.setAccessible(true);
Object fieldValue = mapperFieldDef.get(this);
MapperProxy proxy = (MapperProxy) Proxy.getInvocationHandler(fieldValue);
Method sbewr = MybatisExampleHelper.getMethod(fieldValue, "selectByExample");
Page page = new Page(0,1000);
tableExampleObj.setPage(page);
Object[] args = new Object[]{tableExampleObj};
modelVO.getRelates().put(table, (List<Object>)(proxy.invoke(proxy, sbewr, args)));
}
catch (Throwable e){
LOG.error(e.toString());
}
}
}
}
@Override
public List<User> getListWithPagingAndFilter(
Integer pageNo, Integer pageSize,
String sortItem, String sortOrder,
String filters){
UserExample exampleObj = new UserExample();
Page page = new Page((pageNo - 1) * pageSize, pageSize);
exampleObj.setPage(page);
MybatisExampleHelper.assignWhereClause(exampleObj, exampleObj.or(), "User", filters);
exampleObj.setOrderByClause(MybatisExampleHelper.createOrderClause(sortItem, sortOrder));
return userMapper.selectByExample(exampleObj);
}
@Override
public Object getListWithPagingAndFilter(
Integer pageNo, Integer pageSize,
String sortItem, String sortOrder,
String filters, String includes, String refers, String relates){
UserExample exampleObj = new UserExample();
Page page = new Page((pageNo - 1) * pageSize, pageSize);
exampleObj.setPage(page);
MybatisExampleHelper.assignWhereClause(exampleObj, exampleObj.or(), "User", filters);
exampleObj.setOrderByClause(MybatisExampleHelper.createOrderClause(sortItem, sortOrder));
List<User> modelList = userMapper.selectByExample(exampleObj);
List<UserVO> modelVOList = modelList.stream().map(model -> new UserVO(model)).collect(Collectors.toList());
// 处理includes的外链字段 处理refers的关联表
if((includes != null || refers != null)&& modelList.size() > 0){
//对Vo层数据循环处理外链表数据
modelVOList.stream().forEach(status->{
if (includes != null){
this.assignIncludes(includes,status);
}
if (refers != null){
this.assignRefers(refers,status);
}
});
}
// 处理join的关联表
if(relates != null && modelList.size() > 0){
this.assignRelates(relates, modelVOList);
}
if(includes == null && refers == null && relates == null){
return modelList;
}
else{
return modelVOList;
}
}
@Override
public Long countListWithPagingAndFilter(String filters){
UserExample exampleObj = new UserExample();
MybatisExampleHelper.assignWhereClause(exampleObj, exampleObj.or(), "User", filters);
return userMapper.countByExample(exampleObj);
}
private void assignIncludes(String includes, UserVO status){
JSONObject includesObj = JSON.parseObject(includes);
//定义容器存储所有外链表数据
Map<String,Object> map = new HashMap();
// 循环解析每一个键值对
if (includesObj!=null && includesObj.keySet().size() >0){
includesObj.keySet().stream().forEach(table->{
//每一个key都是一个po实体类名
Object className = CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, table);
JSONObject jsonObject = includesObj.getJSONObject(
CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, table));
//对内层的includes数据进行解析
JSONArray columnCondition = jsonObject.getJSONArray("includes");
if (columnCondition != null && columnCondition.toArray().length >0){
//循环数组
Arrays.stream(columnCondition.toArray()).forEach(obj -> {
//反射机制将要执行的方法名
String ffName = "get"+CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, obj.toString());
//获取Method的对象
Method m = MybatisExampleHelper.getMethod(status.getSuperior(), ffName);
MybatisExampleHelper.dealSearchIncludes(m,status.getSuperior(),
className,map,table,this.getClass().getPackage().getName());
});
}
});
}
status.setIncludes(map);
}
private void assignRefers(String refers, UserVO status){
//解析includes字符串为JSONObject
JSONObject refersObj = JSON.parseObject(refers);
//定义容器存储所有外链表数据
Map<String,List<Object>> map = new HashMap();
if (refersObj!=null && refersObj.keySet().size() > 0){
// 循环解析每一个键值对
refersObj.keySet().stream().forEach(table -> {
//每一个key都是一个po实体类名
JSONObject jsonObject = refersObj.getJSONObject(
CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, table));
//对内层的includes数据进行解析
JSONArray columnCondition = jsonObject.getJSONArray("includes");
if (columnCondition != null && columnCondition.toArray().length > 0){
//循环数组
Arrays.stream(columnCondition.toArray()).forEach(obj -> {
MybatisExampleHelper.dealSearchRefers(status.getSuperior().getId(),
table,map,obj,CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, table),
this.getClass().getPackage().getName());
});
}
});
}
status.setRefers(map);
}
}
#jdbc.driverClassName=com.mysql.jdbc.Driver jdbc.driverClassName=com.mysql.jdbc.Driver
#jdbc.url=jdbc:mysql://127.0.0.1:3306/crm_dev?useUnicode=true&amp;characterEncoding=utf-8&amp;zeroDateTimeBehavior=convertToNull jdbc.url=jdbc:mysql://127.0.0.1:3306/permissiontest?useUnicode=true&amp;characterEncoding=utf-8&amp;zeroDateTimeBehavior=convertToNull
#jdbc.username=root jdbc.username=root
#jdbc.password=123456 jdbc.password=root
\ No newline at end of file \ No newline at end of file
package com.haomostudio.SeekTruthBackend.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.haomostudio.SeekTruthBackend.common.Resp;
import com.haomostudio.SeekTruthBackend.service.CatalogService;
import com.haomostudio.SeekTruthBackend.service.HmUtils.Tools;
import com.haomostudio.delivery.po.Catalog;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.lang.reflect.InvocationTargetException;
import java.util.*;
/**
* Created by hxg on 2016/10/06.
*/
@Api(description = "菜单表")
@Controller
public class CatalogController {
@Autowired
CatalogService catalogService;
@Autowired
HttpServletResponse response;
@ApiOperation(value = "创建'菜单表'表中一条信息", notes = "通过post方法请求,传入表中字段的对应信息,创建一条数据。并返回给View层")
@RequestMapping(value = "/catalogs/new",
method = RequestMethod.POST,
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object createCatalog(
HttpServletRequest request,
@RequestHeader(value = "X-Auth-Token") String token,
@RequestParam(value = "cid", required = false) String cid,
@RequestParam(value = "cname", required = false) String cname,
@RequestParam(value = "resource", required = false) String resource,
@RequestParam(value = "createTime", required = false) String createTime,
@RequestParam(value = "lastUpdateTime", required = false) String lastUpdateTime
) {
Catalog item = new Catalog();
String id = Tools.getUUID();
item.setId(id);
if( cid != null ){
item.setCid(cid);
}
if( cname != null ){
item.setCname(cname);
}
if( resource != null ){
item.setResource(resource);
}
item.setCreateTime(new Date());
item.setLastUpdateTime(new Date());
catalogService.create(item);
//若request param为null,但字段定义有默认值,则需从数据库中返回结果
return catalogService.get(id);
//return item;
}
@ApiOperation(value = "删除'菜单表'表中的某条记录", notes = "根据url传入的数据id,删除整条记录。")
@RequestMapping(value = "/catalogs/{catalog_id}/delete",
method = RequestMethod.POST,
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object deleteCatalog(
@RequestHeader(value = "X-Auth-Token") String token,
@PathVariable(value = "catalog_id") String id
) {
Catalog item = catalogService.get(id);
if (null == item) {
response.setStatus(404);
return Resp.fail("the asset to be deleted doesn't exist");
}
catalogService.delete(id);
return Resp.succ("delete success");
}
@ApiOperation(value = "修改'菜单表'表中的某条记录", notes = "根据url传入的数据id,确定修改表中的某条记录,传入表中字段要修改的信息,不传代表不修改。并返回给View层")
@RequestMapping(value = "/catalogs/{catalog_id}/edit",
method = RequestMethod.POST,
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object editCatalog(
HttpServletRequest request,
@RequestHeader(value = "X-Auth-Token") String token,
@PathVariable(value = "catalog_id") String id,
@RequestParam(value = "cid", required = false) String cid,
@RequestParam(value = "cname", required = false) String cname,
@RequestParam(value = "resource", required = false) String resource
) {
Catalog item = catalogService.get(id);
if (null == item) {
response.setStatus(404);
return Resp.fail("the asset to be edited doesn't exist");
}
if( cid != null ){
item.setCid(cid);
}
if( cname != null ){
item.setCname(cname);
}
if( resource != null ){
item.setResource(resource);
}
item.setLastUpdateTime(new Date());
catalogService.update(item);
return catalogService.get(id);
}
@ApiOperation(value = "查询'菜单表'表中的某条记录", notes = "根据url传入的数据id,查询对应的一条数据。")
@RequestMapping(value = "/catalogs/{catalog_id}",
method = {RequestMethod.GET, RequestMethod.DELETE, RequestMethod.PUT},
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object getCatalog(
HttpServletRequest request,
@RequestHeader(value = "X-Auth-Token") String token,
@PathVariable(value = "catalog_id") String id,
@RequestParam(value = "cid", required = false) String cid,
@RequestParam(value = "cname", required = false) String cname,
@RequestParam(value = "resource", required = false) String resource
) {
if(request.getMethod().equals("GET")){
Catalog item = catalogService.get(id);
if (null == item) {
response.setStatus(404);
return Resp.fail("the asset to be edited doesn't exist");
}
return item;
}
else if(request.getMethod().equals("PUT")){
Catalog item = catalogService.get(id);
if (null == item) {
response.setStatus(404);
return Resp.fail("the asset to be edited doesn't exist");
}
if( cid != null ){
item.setCid(cid);
}
if( cname != null ){
item.setCname(cname);
}
if( resource != null ){
item.setResource(resource);
}
item.setLastUpdateTime(new Date());
catalogService.update(item);
return catalogService.get(id);
}
else if(request.getMethod().equals("DELETE")){
Catalog item = catalogService.get(id);
if (null == item) {
response.setStatus(404);
return Resp.fail("the asset to be deleted doesn't exist");
}
catalogService.delete(id);
return Resp.succ("delete success");
}
return Resp.fail("Unknown http method");
}
@ApiOperation(value = "查询'菜单表'表中的多条记录或者新增某条记录", notes = "get传参:根据url传入的filters(过滤条件),查询对应的多条数据。数据数量取决于pageNo和pageSize;数据的先后顺序取决于sortItem,sortOrder; post请求:新增某条记录,传入表字段对应的值")
@RequestMapping(value = "/catalogs",
method = { RequestMethod.GET, RequestMethod.POST },
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object getCatalogs(
HttpServletRequest request,
@RequestHeader(value = "X-Auth-Token", required = false) String token,
@RequestParam(value = "pageNo", required = false) Integer pageNo,
@RequestParam(value = "pageSize", required = false) Integer pageSize,
@RequestParam(value = "sortItem", required = false) String sortItem,
@RequestParam(value = "sortOrder", required = false) String sortOrder,
@RequestParam(value = "filters", required = false) String filters,
@RequestParam(value = "includes", required = false) String includes,
@RequestParam(value = "refers", required = false) String refers,
@RequestParam(value = "relates", required = false) String relates
) {
if(pageNo == null){
pageNo = 1;
}
if(pageSize == null){
pageSize = 10;
}
if(sortItem == null){
sortItem = "id";
}
if(sortOrder == null){
sortOrder = "asc";
}
if(filters == null){
filters = "{}";
}
Long total = catalogService.countListWithPagingAndFilter(filters);
response.addHeader("total", String.valueOf(total));
return catalogService.getListWithPagingAndFilter(
pageNo, pageSize, sortItem, sortOrder, filters, includes, refers, relates);
}
@ApiOperation(value = "出入字段数组返回对应字段数据", notes = "get传参:根据url传入的filters(过滤条件),查询对应的多条数据。只返回你传进来的字段对应的数据")
@RequestMapping(value = "/catalogs/columns",
method = { RequestMethod.GET },
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object getCatalogsId(
HttpServletRequest request,
@RequestHeader(value = "X-Auth-Token", required = false) String token,
@RequestParam(value = "filters", required = true) String filters,
@RequestParam(value = "columns", required = true) String columns,
@RequestParam(value = "sortOrder", required = false) String sortOrder,
@RequestParam(value = "sortItem", required = false) String sortItem,
@RequestParam(value = "pageNo", required = false) Integer pageNo,
@RequestParam(value = "pageSize", required = false) Integer pageSize
) {
if(pageNo == null){
pageNo = 1;
}
if(pageSize == null){
pageSize = 10;
}
if(sortOrder==null){
sortOrder = "asc";
}
if(sortItem==null){
sortItem = "id";
}
JSONArray jsonArray = JSON.parseArray(columns);
List<Map<String,Object>> lists = new ArrayList<>();
List<Catalog> list = catalogService.getListWithPagingAndFilter(
pageNo, pageSize, sortItem, sortOrder, filters);
//反射调取get方法
Class clz = Catalog.class;
list.stream().forEach(lot->{
Map<String,Object> map = new HashMap<>();
for (Object j : jsonArray){
String s = (String) j;
s = s.replaceFirst(s.substring(0,1),s.substring(0,1).toUpperCase());
try {
if (clz.getMethod("get"+s).invoke(lot) !=null){
map.put((String) j,clz.getMethod("get"+s).invoke(lot));
}
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
lists.add(map);
});
return lists;
}
@ApiOperation(value = "批量创建'菜单表'表中一条信息", notes = "通过post方法请求,传入表中字段的对应信息,创建一条数据。并返回给View层")
@RequestMapping(value = "/catalogs/create/batch",
method = RequestMethod.POST,
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object createsCatalogs(
HttpServletRequest request,
@RequestHeader(value = "X-Auth-Token", required = false) String token,
@RequestParam(value = "params", required = false) String params
) {
JSONArray jsonArray = JSON.parseArray(params);
List<Catalog> lists = new ArrayList<>();
jsonArray.stream().forEach((Object object) -> {
JSONObject jsonObject = JSONObject.parseObject(object.toString());
Catalog item = new Catalog();
String id = Tools.getUUID();
item.setId(id);
if(jsonObject.containsKey("cid") ){
item.setCid(jsonObject.get("cid").toString());
}
if(jsonObject.containsKey("cname") ){
item.setCname(jsonObject.get("cname").toString());
}
if(jsonObject.containsKey("resource") ){
item.setResource(jsonObject.get("resource").toString());
}
item.setCreateTime(new Date());
item.setLastUpdateTime(new Date());
catalogService.create(item);
lists.add(catalogService.get(id));
});
return lists;
}
@ApiOperation(value = "批量修改'菜单表'表中多条信息", notes = "通过post方法请求,传入表中字段的对应信息,数组中每个对象必须有id属性!")
@RequestMapping(value = "/catalogs/edit/batch",
method = RequestMethod.POST,
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object editsCatalogs(
HttpServletRequest request,
@RequestHeader(value = "X-Auth-Token", required = false) String token,
@RequestParam(value = "params", required = false) String params
) {
JSONArray jsonArray = JSON.parseArray(params);
List<Catalog> lists = new ArrayList<>();
jsonArray.stream().forEach((Object object) -> {
JSONObject jsonObject = JSONObject.parseObject(object.toString());
Catalog item = new Catalog();
if(jsonObject.containsKey("cid") ){
item.setCid(jsonObject.get("cid").toString());
}
if(jsonObject.containsKey("cname") ){
item.setCname(jsonObject.get("cname").toString());
}
if(jsonObject.containsKey("resource") ){
item.setResource(jsonObject.get("resource").toString());
}
if(jsonObject.containsKey("id") ){
item.setId(jsonObject.get("id").toString());
}
item.setLastUpdateTime(new Date());
catalogService.update(item);
lists.add(catalogService.get(jsonObject.get("id").toString()));
});
return lists;
}
@ApiOperation(value = "批量删除'菜单表'表中一条信息", notes = "通过post方法请求,传入表中字段的对应信息,创建一条数据。并返回给View层")
@RequestMapping(value = "/catalogs/delete/batch",
method = RequestMethod.POST,
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object deletesCatalog(
HttpServletRequest request,
@RequestHeader(value = "X-Auth-Token", required = false) String token,
@RequestParam(value = "ids", required = true) String ids
) {
JSONArray jsonArray = JSON.parseArray(ids);
jsonArray.stream().forEach(id->{
Catalog item = catalogService.get(id.toString());
if (null != item) {
catalogService.delete(id.toString());
}
});
return Resp.succ("delete success");
}
}
package com.haomostudio.SeekTruthBackend.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.haomostudio.SeekTruthBackend.common.Resp;
import com.haomostudio.SeekTruthBackend.service.DeptService;
import com.haomostudio.SeekTruthBackend.service.HmUtils.Tools;
import com.haomostudio.delivery.po.Dept;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.lang.reflect.InvocationTargetException;
import java.util.*;
/**
* Created by hxg on 2016/10/06.
*/
@Api(description = "部门表")
@Controller
public class DeptController {
@Autowired
DeptService deptService;
@Autowired
HttpServletResponse response;
@ApiOperation(value = "创建'部门表'表中一条信息", notes = "通过post方法请求,传入表中字段的对应信息,创建一条数据。并返回给View层")
@RequestMapping(value = "/depts/new",
method = RequestMethod.POST,
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object createDept(
HttpServletRequest request,
@RequestHeader(value = "X-Auth-Token") String token,
@RequestParam(value = "did", required = false) String did,
@RequestParam(value = "dname", required = false) String dname,
@RequestParam(value = "createTime", required = false) String createTime,
@RequestParam(value = "lastUpdateTime", required = false) String lastUpdateTime
) {
Dept item = new Dept();
String id = Tools.getUUID();
item.setId(id);
if( did != null ){
item.setDid(did);
}
if( dname != null ){
item.setDname(dname);
}
item.setCreateTime(new Date());
item.setLastUpdateTime(new Date());
deptService.create(item);
//若request param为null,但字段定义有默认值,则需从数据库中返回结果
return deptService.get(id);
//return item;
}
@ApiOperation(value = "删除'部门表'表中的某条记录", notes = "根据url传入的数据id,删除整条记录。")
@RequestMapping(value = "/depts/{dept_id}/delete",
method = RequestMethod.POST,
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object deleteDept(
@RequestHeader(value = "X-Auth-Token") String token,
@PathVariable(value = "dept_id") String id
) {
Dept item = deptService.get(id);
if (null == item) {
response.setStatus(404);
return Resp.fail("the asset to be deleted doesn't exist");
}
deptService.delete(id);
return Resp.succ("delete success");
}
@ApiOperation(value = "修改'部门表'表中的某条记录", notes = "根据url传入的数据id,确定修改表中的某条记录,传入表中字段要修改的信息,不传代表不修改。并返回给View层")
@RequestMapping(value = "/depts/{dept_id}/edit",
method = RequestMethod.POST,
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object editDept(
HttpServletRequest request,
@RequestHeader(value = "X-Auth-Token") String token,
@PathVariable(value = "dept_id") String id,
@RequestParam(value = "did", required = false) String did,
@RequestParam(value = "dname", required = false) String dname
) {
Dept item = deptService.get(id);
if (null == item) {
response.setStatus(404);
return Resp.fail("the asset to be edited doesn't exist");
}
if( did != null ){
item.setDid(did);
}
if( dname != null ){
item.setDname(dname);
}
item.setLastUpdateTime(new Date());
deptService.update(item);
return deptService.get(id);
}
@ApiOperation(value = "查询'部门表'表中的某条记录", notes = "根据url传入的数据id,查询对应的一条数据。")
@RequestMapping(value = "/depts/{dept_id}",
method = {RequestMethod.GET, RequestMethod.DELETE, RequestMethod.PUT},
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object getDept(
HttpServletRequest request,
@RequestHeader(value = "X-Auth-Token") String token,
@PathVariable(value = "dept_id") String id,
@RequestParam(value = "did", required = false) String did,
@RequestParam(value = "dname", required = false) String dname
) {
if(request.getMethod().equals("GET")){
Dept item = deptService.get(id);
if (null == item) {
response.setStatus(404);
return Resp.fail("the asset to be edited doesn't exist");
}
return item;
}
else if(request.getMethod().equals("PUT")){
Dept item = deptService.get(id);
if (null == item) {
response.setStatus(404);
return Resp.fail("the asset to be edited doesn't exist");
}
if( did != null ){
item.setDid(did);
}
if( dname != null ){
item.setDname(dname);
}
item.setLastUpdateTime(new Date());
deptService.update(item);
return deptService.get(id);
}
else if(request.getMethod().equals("DELETE")){
Dept item = deptService.get(id);
if (null == item) {
response.setStatus(404);
return Resp.fail("the asset to be deleted doesn't exist");
}
deptService.delete(id);
return Resp.succ("delete success");
}
return Resp.fail("Unknown http method");
}
@ApiOperation(value = "查询'部门表'表中的多条记录或者新增某条记录", notes = "get传参:根据url传入的filters(过滤条件),查询对应的多条数据。数据数量取决于pageNo和pageSize;数据的先后顺序取决于sortItem,sortOrder; post请求:新增某条记录,传入表字段对应的值")
@RequestMapping(value = "/depts",
method = { RequestMethod.GET, RequestMethod.POST },
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object getDepts(
HttpServletRequest request,
@RequestHeader(value = "X-Auth-Token", required = false) String token,
@RequestParam(value = "pageNo", required = false) Integer pageNo,
@RequestParam(value = "pageSize", required = false) Integer pageSize,
@RequestParam(value = "sortItem", required = false) String sortItem,
@RequestParam(value = "sortOrder", required = false) String sortOrder,
@RequestParam(value = "filters", required = false) String filters,
@RequestParam(value = "includes", required = false) String includes,
@RequestParam(value = "refers", required = false) String refers,
@RequestParam(value = "relates", required = false) String relates
) {
if(pageNo == null){
pageNo = 1;
}
if(pageSize == null){
pageSize = 10;
}
if(sortItem == null){
sortItem = "id";
}
if(sortOrder == null){
sortOrder = "asc";
}
if(filters == null){
filters = "{}";
}
Long total = deptService.countListWithPagingAndFilter(filters);
response.addHeader("total", String.valueOf(total));
return deptService.getListWithPagingAndFilter(
pageNo, pageSize, sortItem, sortOrder, filters, includes, refers, relates);
}
@ApiOperation(value = "出入字段数组返回对应字段数据", notes = "get传参:根据url传入的filters(过滤条件),查询对应的多条数据。只返回你传进来的字段对应的数据")
@RequestMapping(value = "/depts/columns",
method = { RequestMethod.GET },
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object getDeptsId(
HttpServletRequest request,
@RequestHeader(value = "X-Auth-Token", required = false) String token,
@RequestParam(value = "filters", required = true) String filters,
@RequestParam(value = "columns", required = true) String columns,
@RequestParam(value = "sortOrder", required = false) String sortOrder,
@RequestParam(value = "sortItem", required = false) String sortItem,
@RequestParam(value = "pageNo", required = false) Integer pageNo,
@RequestParam(value = "pageSize", required = false) Integer pageSize
) {
if(pageNo == null){
pageNo = 1;
}
if(pageSize == null){
pageSize = 10;
}
if(sortOrder==null){
sortOrder = "asc";
}
if(sortItem==null){
sortItem = "id";
}
JSONArray jsonArray = JSON.parseArray(columns);
List<Map<String,Object>> lists = new ArrayList<>();
List<Dept> list = deptService.getListWithPagingAndFilter(
pageNo, pageSize, sortItem, sortOrder, filters);
//反射调取get方法
Class clz = Dept.class;
list.stream().forEach(lot->{
Map<String,Object> map = new HashMap<>();
for (Object j : jsonArray){
String s = (String) j;
s = s.replaceFirst(s.substring(0,1),s.substring(0,1).toUpperCase());
try {
if (clz.getMethod("get"+s).invoke(lot) !=null){
map.put((String) j,clz.getMethod("get"+s).invoke(lot));
}
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
lists.add(map);
});
return lists;
}
@ApiOperation(value = "批量创建'部门表'表中一条信息", notes = "通过post方法请求,传入表中字段的对应信息,创建一条数据。并返回给View层")
@RequestMapping(value = "/depts/create/batch",
method = RequestMethod.POST,
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object createsDepts(
HttpServletRequest request,
@RequestHeader(value = "X-Auth-Token", required = false) String token,
@RequestParam(value = "params", required = false) String params
) {
JSONArray jsonArray = JSON.parseArray(params);
List<Dept> lists = new ArrayList<>();
jsonArray.stream().forEach((Object object) -> {
JSONObject jsonObject = JSONObject.parseObject(object.toString());
Dept item = new Dept();
String id = Tools.getUUID();
item.setId(id);
if(jsonObject.containsKey("did") ){
item.setDid(jsonObject.get("did").toString());
}
if(jsonObject.containsKey("dname") ){
item.setDname(jsonObject.get("dname").toString());
}
item.setCreateTime(new Date());
item.setLastUpdateTime(new Date());
deptService.create(item);
lists.add(deptService.get(id));
});
return lists;
}
@ApiOperation(value = "批量修改'部门表'表中多条信息", notes = "通过post方法请求,传入表中字段的对应信息,数组中每个对象必须有id属性!")
@RequestMapping(value = "/depts/edit/batch",
method = RequestMethod.POST,
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object editsDepts(
HttpServletRequest request,
@RequestHeader(value = "X-Auth-Token", required = false) String token,
@RequestParam(value = "params", required = false) String params
) {
JSONArray jsonArray = JSON.parseArray(params);
List<Dept> lists = new ArrayList<>();
jsonArray.stream().forEach((Object object) -> {
JSONObject jsonObject = JSONObject.parseObject(object.toString());
Dept item = new Dept();
if(jsonObject.containsKey("id") ){
item.setId(jsonObject.get("id").toString());
}
if(jsonObject.containsKey("did") ){
item.setDid(jsonObject.get("did").toString());
}
if(jsonObject.containsKey("dname") ){
item.setDname(jsonObject.get("dname").toString());
}
item.setLastUpdateTime(new Date());
deptService.update(item);
lists.add(deptService.get(jsonObject.get("id").toString()));
});
return lists;
}
@ApiOperation(value = "批量删除'部门表'表中一条信息", notes = "通过post方法请求,传入表中字段的对应信息,创建一条数据。并返回给View层")
@RequestMapping(value = "/depts/delete/batch",
method = RequestMethod.POST,
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object deletesDept(
HttpServletRequest request,
@RequestHeader(value = "X-Auth-Token", required = false) String token,
@RequestParam(value = "ids", required = true) String ids
) {
JSONArray jsonArray = JSON.parseArray(ids);
jsonArray.stream().forEach(id->{
Dept item = deptService.get(id.toString());
if (null != item) {
deptService.delete(id.toString());
}
});
return Resp.succ("delete success");
}
}
package com.haomostudio.SeekTruthBackend.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.haomostudio.SeekTruthBackend.common.Resp;
import com.haomostudio.SeekTruthBackend.service.HmUtils.Tools;
import com.haomostudio.SeekTruthBackend.service.RoleCatalogService;
import com.haomostudio.delivery.po.RoleCatalog;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.lang.reflect.InvocationTargetException;
import java.util.*;
/**
* Created by hxg on 2016/10/06.
*/
@Api(description = "角色菜单表")
@Controller
public class RoleCatalogController {
@Autowired
RoleCatalogService roleCatalogService;
@Autowired
HttpServletResponse response;
@ApiOperation(value = "创建'角色菜单表'表中一条信息", notes = "通过post方法请求,传入表中字段的对应信息,创建一条数据。并返回给View层")
@RequestMapping(value = "/role_catalogs/new",
method = RequestMethod.POST,
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object createRoleCatalog(
HttpServletRequest request,
@RequestHeader(value = "X-Auth-Token") String token,
@RequestParam(value = "roleCatalogid", required = false) String roleCatalogid,
@RequestParam(value = "rid", required = false) String rid,
@RequestParam(value = "cid", required = false) String cid,
@RequestParam(value = "createTime", required = false) String createTime,
@RequestParam(value = "lastUpdateTime", required = false) String lastUpdateTime
) {
RoleCatalog item = new RoleCatalog();
String id = Tools.getUUID();
item.setId(id);
if( roleCatalogid != null ){
item.setRoleCatalogid(roleCatalogid);
}
if( rid != null ){
item.setRid(rid);
}
if( cid != null ){
item.setCid(cid);
}
item.setCreateTime(new Date());
item.setLastUpdateTime(new Date());
roleCatalogService.create(item);
//若request param为null,但字段定义有默认值,则需从数据库中返回结果
return roleCatalogService.get(id);
//return item;
}
@ApiOperation(value = "删除'角色菜单表'表中的某条记录", notes = "根据url传入的数据id,删除整条记录。")
@RequestMapping(value = "/role_catalogs/{role_catalog_id}/delete",
method = RequestMethod.POST,
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object deleteRoleCatalog(
@RequestHeader(value = "X-Auth-Token") String token,
@PathVariable(value = "role_catalog_id") String id
) {
RoleCatalog item = roleCatalogService.get(id);
if (null == item) {
response.setStatus(404);
return Resp.fail("the asset to be deleted doesn't exist");
}
roleCatalogService.delete(id);
return Resp.succ("delete success");
}
@ApiOperation(value = "修改'角色菜单表'表中的某条记录", notes = "根据url传入的数据id,确定修改表中的某条记录,传入表中字段要修改的信息,不传代表不修改。并返回给View层")
@RequestMapping(value = "/role_catalogs/{role_catalog_id}/edit",
method = RequestMethod.POST,
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object editRoleCatalog(
HttpServletRequest request,
@RequestHeader(value = "X-Auth-Token") String token,
@PathVariable(value = "role_catalog_id") String id,
@RequestParam(value = "roleCatalogid", required = false) String roleCatalogid,
@RequestParam(value = "rid", required = false) String rid,
@RequestParam(value = "cid", required = false) String cid
) {
RoleCatalog item = roleCatalogService.get(id);
if (null == item) {
response.setStatus(404);
return Resp.fail("the asset to be edited doesn't exist");
}
if( roleCatalogid != null ){
item.setRoleCatalogid(roleCatalogid);
}
if( rid != null ){
item.setRid(rid);
}
if( cid != null ){
item.setCid(cid);
}
item.setLastUpdateTime(new Date());
roleCatalogService.update(item);
return roleCatalogService.get(id);
}
@ApiOperation(value = "查询'角色菜单表'表中的某条记录", notes = "根据url传入的数据id,查询对应的一条数据。")
@RequestMapping(value = "/role_catalogs/{role_catalog_id}",
method = {RequestMethod.GET, RequestMethod.DELETE, RequestMethod.PUT},
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object getRoleCatalog(
HttpServletRequest request,
@RequestHeader(value = "X-Auth-Token") String token,
@PathVariable(value = "role_catalog_id") String id,
@RequestParam(value = "roleCatalogid", required = false) String roleCatalogid,
@RequestParam(value = "rid", required = false) String rid,
@RequestParam(value = "cid", required = false) String cid
) {
if(request.getMethod().equals("GET")){
RoleCatalog item = roleCatalogService.get(id);
if (null == item) {
response.setStatus(404);
return Resp.fail("the asset to be edited doesn't exist");
}
return item;
}
else if(request.getMethod().equals("PUT")){
RoleCatalog item = roleCatalogService.get(id);
if (null == item) {
response.setStatus(404);
return Resp.fail("the asset to be edited doesn't exist");
}
if( roleCatalogid != null ){
item.setRoleCatalogid(roleCatalogid);
}
if( rid != null ){
item.setRid(rid);
}
if( cid != null ){
item.setCid(cid);
}
item.setLastUpdateTime(new Date());
roleCatalogService.update(item);
return roleCatalogService.get(id);
}
else if(request.getMethod().equals("DELETE")){
RoleCatalog item = roleCatalogService.get(id);
if (null == item) {
response.setStatus(404);
return Resp.fail("the asset to be deleted doesn't exist");
}
roleCatalogService.delete(id);
return Resp.succ("delete success");
}
return Resp.fail("Unknown http method");
}
@ApiOperation(value = "查询'角色菜单表'表中的多条记录或者新增某条记录", notes = "get传参:根据url传入的filters(过滤条件),查询对应的多条数据。数据数量取决于pageNo和pageSize;数据的先后顺序取决于sortItem,sortOrder; post请求:新增某条记录,传入表字段对应的值")
@RequestMapping(value = "/role_catalogs",
method = { RequestMethod.GET, RequestMethod.POST },
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object getRoleCatalogs(
HttpServletRequest request,
@RequestHeader(value = "X-Auth-Token", required = false) String token,
@RequestParam(value = "pageNo", required = false) Integer pageNo,
@RequestParam(value = "pageSize", required = false) Integer pageSize,
@RequestParam(value = "sortItem", required = false) String sortItem,
@RequestParam(value = "sortOrder", required = false) String sortOrder,
@RequestParam(value = "filters", required = false) String filters,
@RequestParam(value = "includes", required = false) String includes,
@RequestParam(value = "refers", required = false) String refers,
@RequestParam(value = "relates", required = false) String relates
) {
if(pageNo == null){
pageNo = 1;
}
if(pageSize == null){
pageSize = 10;
}
if(sortItem == null){
sortItem = "id";
}
if(sortOrder == null){
sortOrder = "asc";
}
if(filters == null){
filters = "{}";
}
Long total = roleCatalogService.countListWithPagingAndFilter(filters);
response.addHeader("total", String.valueOf(total));
return roleCatalogService.getListWithPagingAndFilter(
pageNo, pageSize, sortItem, sortOrder, filters, includes, refers, relates);
}
@ApiOperation(value = "出入字段数组返回对应字段数据", notes = "get传参:根据url传入的filters(过滤条件),查询对应的多条数据。只返回你传进来的字段对应的数据")
@RequestMapping(value = "/role_catalogs/columns",
method = { RequestMethod.GET },
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object getRoleCatalogsId(
HttpServletRequest request,
@RequestHeader(value = "X-Auth-Token", required = false) String token,
@RequestParam(value = "filters", required = true) String filters,
@RequestParam(value = "columns", required = true) String columns,
@RequestParam(value = "sortOrder", required = false) String sortOrder,
@RequestParam(value = "sortItem", required = false) String sortItem,
@RequestParam(value = "pageNo", required = false) Integer pageNo,
@RequestParam(value = "pageSize", required = false) Integer pageSize
) {
if(pageNo == null){
pageNo = 1;
}
if(pageSize == null){
pageSize = 10;
}
if(sortOrder==null){
sortOrder = "asc";
}
if(sortItem==null){
sortItem = "id";
}
JSONArray jsonArray = JSON.parseArray(columns);
List<Map<String,Object>> lists = new ArrayList<>();
List<RoleCatalog> list = roleCatalogService.getListWithPagingAndFilter(
pageNo, pageSize, sortItem, sortOrder, filters);
//反射调取get方法
Class clz = RoleCatalog.class;
list.stream().forEach(lot->{
Map<String,Object> map = new HashMap<>();
for (Object j : jsonArray){
String s = (String) j;
s = s.replaceFirst(s.substring(0,1),s.substring(0,1).toUpperCase());
try {
if (clz.getMethod("get"+s).invoke(lot) !=null){
map.put((String) j,clz.getMethod("get"+s).invoke(lot));
}
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
lists.add(map);
});
return lists;
}
@ApiOperation(value = "批量创建'角色菜单表'表中一条信息", notes = "通过post方法请求,传入表中字段的对应信息,创建一条数据。并返回给View层")
@RequestMapping(value = "/role_catalogs/create/batch",
method = RequestMethod.POST,
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object createsRoleCatalogs(
HttpServletRequest request,
@RequestHeader(value = "X-Auth-Token", required = false) String token,
@RequestParam(value = "params", required = false) String params
) {
JSONArray jsonArray = JSON.parseArray(params);
List<RoleCatalog> lists = new ArrayList<>();
jsonArray.stream().forEach((Object object) -> {
JSONObject jsonObject = JSONObject.parseObject(object.toString());
RoleCatalog item = new RoleCatalog();
String id = Tools.getUUID();
item.setId(id);
if(jsonObject.containsKey("roleCatalogid") ){
item.setRoleCatalogid(jsonObject.get("roleCatalogid").toString());
}
if(jsonObject.containsKey("rid") ){
item.setRid(jsonObject.get("rid").toString());
}
if(jsonObject.containsKey("cid") ){
item.setCid(jsonObject.get("cid").toString());
}
item.setCreateTime(new Date());
item.setLastUpdateTime(new Date());
roleCatalogService.create(item);
lists.add(roleCatalogService.get(id));
});
return lists;
}
@ApiOperation(value = "批量修改'角色菜单表'表中多条信息", notes = "通过post方法请求,传入表中字段的对应信息,数组中每个对象必须有id属性!")
@RequestMapping(value = "/role_catalogs/edit/batch",
method = RequestMethod.POST,
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object editsRoleCatalogs(
HttpServletRequest request,
@RequestHeader(value = "X-Auth-Token", required = false) String token,
@RequestParam(value = "params", required = false) String params
) {
JSONArray jsonArray = JSON.parseArray(params);
List<RoleCatalog> lists = new ArrayList<>();
jsonArray.stream().forEach((Object object) -> {
JSONObject jsonObject = JSONObject.parseObject(object.toString());
RoleCatalog item = new RoleCatalog();
if(jsonObject.containsKey("roleCatalogid") ){
item.setRoleCatalogid(jsonObject.get("roleCatalogid").toString());
}
if(jsonObject.containsKey("rid") ){
item.setRid(jsonObject.get("rid").toString());
}
if(jsonObject.containsKey("cid") ){
item.setCid(jsonObject.get("cid").toString());
}
if(jsonObject.containsKey("id") ){
item.setId(jsonObject.get("id").toString());
}
item.setLastUpdateTime(new Date());
roleCatalogService.update(item);
lists.add(roleCatalogService.get(jsonObject.get("id").toString()));
});
return lists;
}
@ApiOperation(value = "批量删除'角色菜单表'表中一条信息", notes = "通过post方法请求,传入表中字段的对应信息,创建一条数据。并返回给View层")
@RequestMapping(value = "/role_catalogs/delete/batch",
method = RequestMethod.POST,
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object deletesRoleCatalog(
HttpServletRequest request,
@RequestHeader(value = "X-Auth-Token", required = false) String token,
@RequestParam(value = "ids", required = true) String ids
) {
JSONArray jsonArray = JSON.parseArray(ids);
jsonArray.stream().forEach(id->{
RoleCatalog item = roleCatalogService.get(id.toString());
if (null != item) {
roleCatalogService.delete(id.toString());
}
});
return Resp.succ("delete success");
}
}
package com.haomostudio.SeekTruthBackend.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.haomostudio.SeekTruthBackend.common.Resp;
import com.haomostudio.SeekTruthBackend.service.HmUtils.Tools;
import com.haomostudio.SeekTruthBackend.service.TRoleService;
import com.haomostudio.delivery.po.TRole;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.lang.reflect.InvocationTargetException;
import java.util.*;
/**
* Created by hxg on 2016/10/06.
*/
@Api(description = "角色表")
@Controller
public class TRoleController {
@Autowired
TRoleService tRoleService;
@Autowired
HttpServletResponse response;
@ApiOperation(value = "创建'角色表'表中一条信息", notes = "通过post方法请求,传入表中字段的对应信息,创建一条数据。并返回给View层")
@RequestMapping(value = "/t_roles/new",
method = RequestMethod.POST,
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object createTRole(
HttpServletRequest request,
@RequestHeader(value = "X-Auth-Token") String token,
@RequestParam(value = "rid", required = false) String rid,
@RequestParam(value = "rname", required = false) String rname,
@RequestParam(value = "createTime", required = false) String createTime,
@RequestParam(value = "lastUpdateTime", required = false) String lastUpdateTime
) {
TRole item = new TRole();
String id = Tools.getUUID();
item.setId(id);
if( rid != null ){
item.setRid(rid);
}
if( rname != null ){
item.setRname(rname);
}
item.setCreateTime(new Date());
item.setLastUpdateTime(new Date());
tRoleService.create(item);
//若request param为null,但字段定义有默认值,则需从数据库中返回结果
return tRoleService.get(id);
//return item;
}
@ApiOperation(value = "删除'角色表'表中的某条记录", notes = "根据url传入的数据id,删除整条记录。")
@RequestMapping(value = "/t_roles/{t_role_id}/delete",
method = RequestMethod.POST,
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object deleteTRole(
@RequestHeader(value = "X-Auth-Token") String token,
@PathVariable(value = "t_role_id") String id
) {
TRole item = tRoleService.get(id);
if (null == item) {
response.setStatus(404);
return Resp.fail("the asset to be deleted doesn't exist");
}
tRoleService.delete(id);
return Resp.succ("delete success");
}
@ApiOperation(value = "修改'角色表'表中的某条记录", notes = "根据url传入的数据id,确定修改表中的某条记录,传入表中字段要修改的信息,不传代表不修改。并返回给View层")
@RequestMapping(value = "/t_roles/{t_role_id}/edit",
method = RequestMethod.POST,
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object editTRole(
HttpServletRequest request,
@RequestHeader(value = "X-Auth-Token") String token,
@PathVariable(value = "t_role_id") String id,
@RequestParam(value = "rid", required = false) String rid,
@RequestParam(value = "rname", required = false) String rname
) {
TRole item = tRoleService.get(id);
if (null == item) {
response.setStatus(404);
return Resp.fail("the asset to be edited doesn't exist");
}
if( rid != null ){
item.setRid(rid);
}
if( rname != null ){
item.setRname(rname);
}
item.setLastUpdateTime(new Date());
tRoleService.update(item);
return tRoleService.get(id);
}
@ApiOperation(value = "查询'角色表'表中的某条记录", notes = "根据url传入的数据id,查询对应的一条数据。")
@RequestMapping(value = "/t_roles/{t_role_id}",
method = {RequestMethod.GET, RequestMethod.DELETE, RequestMethod.PUT},
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object getTRole(
HttpServletRequest request,
@RequestHeader(value = "X-Auth-Token") String token,
@PathVariable(value = "t_role_id") String id,
@RequestParam(value = "rid", required = false) String rid,
@RequestParam(value = "rname", required = false) String rname
) {
if(request.getMethod().equals("GET")){
TRole item = tRoleService.get(id);
if (null == item) {
response.setStatus(404);
return Resp.fail("the asset to be edited doesn't exist");
}
return item;
}
else if(request.getMethod().equals("PUT")){
TRole item = tRoleService.get(id);
if (null == item) {
response.setStatus(404);
return Resp.fail("the asset to be edited doesn't exist");
}
if( rid != null ){
item.setRid(rid);
}
if( rname != null ){
item.setRname(rname);
}
item.setLastUpdateTime(new Date());
tRoleService.update(item);
return tRoleService.get(id);
}
else if(request.getMethod().equals("DELETE")){
TRole item = tRoleService.get(id);
if (null == item) {
response.setStatus(404);
return Resp.fail("the asset to be deleted doesn't exist");
}
tRoleService.delete(id);
return Resp.succ("delete success");
}
return Resp.fail("Unknown http method");
}
@ApiOperation(value = "查询'角色表'表中的多条记录或者新增某条记录", notes = "get传参:根据url传入的filters(过滤条件),查询对应的多条数据。数据数量取决于pageNo和pageSize;数据的先后顺序取决于sortItem,sortOrder; post请求:新增某条记录,传入表字段对应的值")
@RequestMapping(value = "/t_roles",
method = { RequestMethod.GET, RequestMethod.POST },
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object getTRoles(
HttpServletRequest request,
@RequestHeader(value = "X-Auth-Token", required = false) String token,
@RequestParam(value = "pageNo", required = false) Integer pageNo,
@RequestParam(value = "pageSize", required = false) Integer pageSize,
@RequestParam(value = "sortItem", required = false) String sortItem,
@RequestParam(value = "sortOrder", required = false) String sortOrder,
@RequestParam(value = "filters", required = false) String filters,
@RequestParam(value = "includes", required = false) String includes,
@RequestParam(value = "refers", required = false) String refers,
@RequestParam(value = "relates", required = false) String relates
) {
if(pageNo == null){
pageNo = 1;
}
if(pageSize == null){
pageSize = 10;
}
if(sortItem == null){
sortItem = "id";
}
if(sortOrder == null){
sortOrder = "asc";
}
if(filters == null){
filters = "{}";
}
Long total = tRoleService.countListWithPagingAndFilter(filters);
response.addHeader("total", String.valueOf(total));
return tRoleService.getListWithPagingAndFilter(
pageNo, pageSize, sortItem, sortOrder, filters, includes, refers, relates);
}
@ApiOperation(value = "出入字段数组返回对应字段数据", notes = "get传参:根据url传入的filters(过滤条件),查询对应的多条数据。只返回你传进来的字段对应的数据")
@RequestMapping(value = "/t_roles/columns",
method = { RequestMethod.GET },
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object getTRolesId(
HttpServletRequest request,
@RequestHeader(value = "X-Auth-Token", required = false) String token,
@RequestParam(value = "filters", required = true) String filters,
@RequestParam(value = "columns", required = true) String columns,
@RequestParam(value = "sortOrder", required = false) String sortOrder,
@RequestParam(value = "sortItem", required = false) String sortItem,
@RequestParam(value = "pageNo", required = false) Integer pageNo,
@RequestParam(value = "pageSize", required = false) Integer pageSize
) {
if(pageNo == null){
pageNo = 1;
}
if(pageSize == null){
pageSize = 10;
}
if(sortOrder==null){
sortOrder = "asc";
}
if(sortItem==null){
sortItem = "id";
}
JSONArray jsonArray = JSON.parseArray(columns);
List<Map<String,Object>> lists = new ArrayList<>();
List<TRole> list = tRoleService.getListWithPagingAndFilter(
pageNo, pageSize, sortItem, sortOrder, filters);
//反射调取get方法
Class clz = TRole.class;
list.stream().forEach(lot->{
Map<String,Object> map = new HashMap<>();
for (Object j : jsonArray){
String s = (String) j;
s = s.replaceFirst(s.substring(0,1),s.substring(0,1).toUpperCase());
try {
if (clz.getMethod("get"+s).invoke(lot) !=null){
map.put((String) j,clz.getMethod("get"+s).invoke(lot));
}
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
lists.add(map);
});
return lists;
}
@ApiOperation(value = "批量创建'角色表'表中一条信息", notes = "通过post方法请求,传入表中字段的对应信息,创建一条数据。并返回给View层")
@RequestMapping(value = "/t_roles/create/batch",
method = RequestMethod.POST,
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object createsTRoles(
HttpServletRequest request,
@RequestHeader(value = "X-Auth-Token", required = false) String token,
@RequestParam(value = "params", required = false) String params
) {
JSONArray jsonArray = JSON.parseArray(params);
List<TRole> lists = new ArrayList<>();
jsonArray.stream().forEach((Object object) -> {
JSONObject jsonObject = JSONObject.parseObject(object.toString());
TRole item = new TRole();
String id = Tools.getUUID();
item.setId(id);
if(jsonObject.containsKey("rid") ){
item.setRid(jsonObject.get("rid").toString());
}
if(jsonObject.containsKey("rname") ){
item.setRname(jsonObject.get("rname").toString());
}
item.setCreateTime(new Date());
item.setLastUpdateTime(new Date());
tRoleService.create(item);
lists.add(tRoleService.get(id));
});
return lists;
}
@ApiOperation(value = "批量修改'角色表'表中多条信息", notes = "通过post方法请求,传入表中字段的对应信息,数组中每个对象必须有id属性!")
@RequestMapping(value = "/t_roles/edit/batch",
method = RequestMethod.POST,
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object editsTRoles(
HttpServletRequest request,
@RequestHeader(value = "X-Auth-Token", required = false) String token,
@RequestParam(value = "params", required = false) String params
) {
JSONArray jsonArray = JSON.parseArray(params);
List<TRole> lists = new ArrayList<>();
jsonArray.stream().forEach((Object object) -> {
JSONObject jsonObject = JSONObject.parseObject(object.toString());
TRole item = new TRole();
if(jsonObject.containsKey("rid") ){
item.setRid(jsonObject.get("rid").toString());
}
if(jsonObject.containsKey("rname") ){
item.setRname(jsonObject.get("rname").toString());
}
if(jsonObject.containsKey("id") ){
item.setId(jsonObject.get("id").toString());
}
item.setLastUpdateTime(new Date());
tRoleService.update(item);
lists.add(tRoleService.get(jsonObject.get("id").toString()));
});
return lists;
}
@ApiOperation(value = "批量删除'角色表'表中一条信息", notes = "通过post方法请求,传入表中字段的对应信息,创建一条数据。并返回给View层")
@RequestMapping(value = "/t_roles/delete/batch",
method = RequestMethod.POST,
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object deletesTRole(
HttpServletRequest request,
@RequestHeader(value = "X-Auth-Token", required = false) String token,
@RequestParam(value = "ids", required = true) String ids
) {
JSONArray jsonArray = JSON.parseArray(ids);
jsonArray.stream().forEach(id->{
TRole item = tRoleService.get(id.toString());
if (null != item) {
tRoleService.delete(id.toString());
}
});
return Resp.succ("delete success");
}
}
package com.haomostudio.SeekTruthBackend.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.haomostudio.SeekTruthBackend.common.Resp;
import com.haomostudio.SeekTruthBackend.service.HmUtils.Tools;
import com.haomostudio.SeekTruthBackend.service.TUserRoleService;
import com.haomostudio.delivery.po.TUserRole;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.lang.reflect.InvocationTargetException;
import java.util.*;
/**
* Created by hxg on 2016/10/06.
*/
@Api(description = "用户角色关系表")
@Controller
public class TUserRoleController {
@Autowired
TUserRoleService tUserRoleService;
@Autowired
HttpServletResponse response;
@ApiOperation(value = "创建'用户角色关系表'表中一条信息", notes = "通过post方法请求,传入表中字段的对应信息,创建一条数据。并返回给View层")
@RequestMapping(value = "/t_user_roles/new",
method = RequestMethod.POST,
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object createTUserRole(
HttpServletRequest request,
@RequestHeader(value = "X-Auth-Token") String token,
@RequestParam(value = "userRoleid", required = false) String userRoleid,
@RequestParam(value = "uid", required = false) String uid,
@RequestParam(value = "rid", required = false) String rid,
@RequestParam(value = "createTime", required = false) String createTime,
@RequestParam(value = "lastUpdateTime", required = false) String lastUpdateTime
) {
TUserRole item = new TUserRole();
String id = Tools.getUUID();
item.setId(id);
if( userRoleid != null ){
item.setUserRoleid(userRoleid);
}
if( uid != null ){
item.setUid(uid);
}
if( rid != null ){
item.setRid(rid);
}
item.setCreateTime(new Date());
item.setLastUpdateTime(new Date());
tUserRoleService.create(item);
//若request param为null,但字段定义有默认值,则需从数据库中返回结果
return tUserRoleService.get(id);
//return item;
}
@ApiOperation(value = "删除'用户角色关系表'表中的某条记录", notes = "根据url传入的数据id,删除整条记录。")
@RequestMapping(value = "/t_user_roles/{t_user_role_id}/delete",
method = RequestMethod.POST,
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object deleteTUserRole(
@RequestHeader(value = "X-Auth-Token") String token,
@PathVariable(value = "t_user_role_id") String id
) {
TUserRole item = tUserRoleService.get(id);
if (null == item) {
response.setStatus(404);
return Resp.fail("the asset to be deleted doesn't exist");
}
tUserRoleService.delete(id);
return Resp.succ("delete success");
}
@ApiOperation(value = "修改'用户角色关系表'表中的某条记录", notes = "根据url传入的数据id,确定修改表中的某条记录,传入表中字段要修改的信息,不传代表不修改。并返回给View层")
@RequestMapping(value = "/t_user_roles/{t_user_role_id}/edit",
method = RequestMethod.POST,
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object editTUserRole(
HttpServletRequest request,
@RequestHeader(value = "X-Auth-Token") String token,
@PathVariable(value = "t_user_role_id") String id,
@RequestParam(value = "userRoleid", required = false) String userRoleid,
@RequestParam(value = "uid", required = false) String uid,
@RequestParam(value = "rid", required = false) String rid
) {
TUserRole item = tUserRoleService.get(id);
if (null == item) {
response.setStatus(404);
return Resp.fail("the asset to be edited doesn't exist");
}
if( userRoleid != null ){
item.setUserRoleid(userRoleid);
}
if( uid != null ){
item.setUid(uid);
}
if( rid != null ){
item.setRid(rid);
}
item.setLastUpdateTime(new Date());
tUserRoleService.update(item);
return tUserRoleService.get(id);
}
@ApiOperation(value = "查询'用户角色关系表'表中的某条记录", notes = "根据url传入的数据id,查询对应的一条数据。")
@RequestMapping(value = "/t_user_roles/{t_user_role_id}",
method = {RequestMethod.GET, RequestMethod.DELETE, RequestMethod.PUT},
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object getTUserRole(
HttpServletRequest request,
@RequestHeader(value = "X-Auth-Token") String token,
@PathVariable(value = "t_user_role_id") String id,
@RequestParam(value = "userRoleid", required = false) String userRoleid,
@RequestParam(value = "uid", required = false) String uid,
@RequestParam(value = "rid", required = false) String rid
) {
if(request.getMethod().equals("GET")){
TUserRole item = tUserRoleService.get(id);
if (null == item) {
response.setStatus(404);
return Resp.fail("the asset to be edited doesn't exist");
}
return item;
}
else if(request.getMethod().equals("PUT")){
TUserRole item = tUserRoleService.get(id);
if (null == item) {
response.setStatus(404);
return Resp.fail("the asset to be edited doesn't exist");
}
if( userRoleid != null ){
item.setUserRoleid(userRoleid);
}
if( uid != null ){
item.setUid(uid);
}
if( rid != null ){
item.setRid(rid);
}
item.setLastUpdateTime(new Date());
tUserRoleService.update(item);
return tUserRoleService.get(id);
}
else if(request.getMethod().equals("DELETE")){
TUserRole item = tUserRoleService.get(id);
if (null == item) {
response.setStatus(404);
return Resp.fail("the asset to be deleted doesn't exist");
}
tUserRoleService.delete(id);
return Resp.succ("delete success");
}
return Resp.fail("Unknown http method");
}
@ApiOperation(value = "查询'用户角色关系表'表中的多条记录或者新增某条记录", notes = "get传参:根据url传入的filters(过滤条件),查询对应的多条数据。数据数量取决于pageNo和pageSize;数据的先后顺序取决于sortItem,sortOrder; post请求:新增某条记录,传入表字段对应的值")
@RequestMapping(value = "/t_user_roles",
method = { RequestMethod.GET, RequestMethod.POST },
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object getTUserRoles(
HttpServletRequest request,
@RequestHeader(value = "X-Auth-Token", required = false) String token,
@RequestParam(value = "pageNo", required = false) Integer pageNo,
@RequestParam(value = "pageSize", required = false) Integer pageSize,
@RequestParam(value = "sortItem", required = false) String sortItem,
@RequestParam(value = "sortOrder", required = false) String sortOrder,
@RequestParam(value = "filters", required = false) String filters,
@RequestParam(value = "includes", required = false) String includes,
@RequestParam(value = "refers", required = false) String refers,
@RequestParam(value = "relates", required = false) String relates
) {
if(pageNo == null){
pageNo = 1;
}
if(pageSize == null){
pageSize = 10;
}
if(sortItem == null){
sortItem = "id";
}
if(sortOrder == null){
sortOrder = "asc";
}
if(filters == null){
filters = "{}";
}
Long total = tUserRoleService.countListWithPagingAndFilter(filters);
response.addHeader("total", String.valueOf(total));
return tUserRoleService.getListWithPagingAndFilter(
pageNo, pageSize, sortItem, sortOrder, filters, includes, refers, relates);
}
@ApiOperation(value = "出入字段数组返回对应字段数据", notes = "get传参:根据url传入的filters(过滤条件),查询对应的多条数据。只返回你传进来的字段对应的数据")
@RequestMapping(value = "/t_user_roles/columns",
method = { RequestMethod.GET },
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object getTUserRolesId(
HttpServletRequest request,
@RequestHeader(value = "X-Auth-Token", required = false) String token,
@RequestParam(value = "filters", required = true) String filters,
@RequestParam(value = "columns", required = true) String columns,
@RequestParam(value = "sortOrder", required = false) String sortOrder,
@RequestParam(value = "sortItem", required = false) String sortItem,
@RequestParam(value = "pageNo", required = false) Integer pageNo,
@RequestParam(value = "pageSize", required = false) Integer pageSize
) {
if(pageNo == null){
pageNo = 1;
}
if(pageSize == null){
pageSize = 10;
}
if(sortOrder==null){
sortOrder = "asc";
}
if(sortItem==null){
sortItem = "id";
}
JSONArray jsonArray = JSON.parseArray(columns);
List<Map<String,Object>> lists = new ArrayList<>();
List<TUserRole> list = tUserRoleService.getListWithPagingAndFilter(
pageNo, pageSize, sortItem, sortOrder, filters);
//反射调取get方法
Class clz = TUserRole.class;
list.stream().forEach(lot->{
Map<String,Object> map = new HashMap<>();
for (Object j : jsonArray){
String s = (String) j;
s = s.replaceFirst(s.substring(0,1),s.substring(0,1).toUpperCase());
try {
if (clz.getMethod("get"+s).invoke(lot) !=null){
map.put((String) j,clz.getMethod("get"+s).invoke(lot));
}
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
lists.add(map);
});
return lists;
}
@ApiOperation(value = "批量创建'用户角色关系表'表中一条信息", notes = "通过post方法请求,传入表中字段的对应信息,创建一条数据。并返回给View层")
@RequestMapping(value = "/t_user_roles/create/batch",
method = RequestMethod.POST,
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object createsTUserRoles(
HttpServletRequest request,
@RequestHeader(value = "X-Auth-Token", required = false) String token,
@RequestParam(value = "params", required = false) String params
) {
JSONArray jsonArray = JSON.parseArray(params);
List<TUserRole> lists = new ArrayList<>();
jsonArray.stream().forEach((Object object) -> {
JSONObject jsonObject = JSONObject.parseObject(object.toString());
TUserRole item = new TUserRole();
String id = Tools.getUUID();
item.setId(id);
if(jsonObject.containsKey("userRoleid") ){
item.setUserRoleid(jsonObject.get("userRoleid").toString());
}
if(jsonObject.containsKey("uid") ){
item.setUid(jsonObject.get("uid").toString());
}
if(jsonObject.containsKey("rid") ){
item.setRid(jsonObject.get("rid").toString());
}
item.setCreateTime(new Date());
item.setLastUpdateTime(new Date());
tUserRoleService.create(item);
lists.add(tUserRoleService.get(id));
});
return lists;
}
@ApiOperation(value = "批量修改'用户角色关系表'表中多条信息", notes = "通过post方法请求,传入表中字段的对应信息,数组中每个对象必须有id属性!")
@RequestMapping(value = "/t_user_roles/edit/batch",
method = RequestMethod.POST,
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object editsTUserRoles(
HttpServletRequest request,
@RequestHeader(value = "X-Auth-Token", required = false) String token,
@RequestParam(value = "params", required = false) String params
) {
JSONArray jsonArray = JSON.parseArray(params);
List<TUserRole> lists = new ArrayList<>();
jsonArray.stream().forEach((Object object) -> {
JSONObject jsonObject = JSONObject.parseObject(object.toString());
TUserRole item = new TUserRole();
if(jsonObject.containsKey("userRoleid") ){
item.setUserRoleid(jsonObject.get("userRoleid").toString());
}
if(jsonObject.containsKey("uid") ){
item.setUid(jsonObject.get("uid").toString());
}
if(jsonObject.containsKey("rid") ){
item.setRid(jsonObject.get("rid").toString());
}
if(jsonObject.containsKey("id") ){
item.setId(jsonObject.get("id").toString());
}
item.setLastUpdateTime(new Date());
tUserRoleService.update(item);
lists.add(tUserRoleService.get(jsonObject.get("id").toString()));
});
return lists;
}
@ApiOperation(value = "批量删除'用户角色关系表'表中一条信息", notes = "通过post方法请求,传入表中字段的对应信息,创建一条数据。并返回给View层")
@RequestMapping(value = "/t_user_roles/delete/batch",
method = RequestMethod.POST,
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object deletesTUserRole(
HttpServletRequest request,
@RequestHeader(value = "X-Auth-Token", required = false) String token,
@RequestParam(value = "ids", required = true) String ids
) {
JSONArray jsonArray = JSON.parseArray(ids);
jsonArray.stream().forEach(id->{
TUserRole item = tUserRoleService.get(id.toString());
if (null != item) {
tUserRoleService.delete(id.toString());
}
});
return Resp.succ("delete success");
}
}
package com.haomostudio.SeekTruthBackend.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.haomostudio.SeekTruthBackend.common.Resp;
import com.haomostudio.SeekTruthBackend.service.HmUtils.Tools;
import com.haomostudio.SeekTruthBackend.service.UserService;
import com.haomostudio.delivery.po.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.lang.reflect.InvocationTargetException;
import java.util.*;
/**
* Created by hxg on 2016/10/06.
*/
@Api(description = "用户表")
@Controller
public class UserController {
@Autowired
UserService userService;
@Autowired
HttpServletResponse response;
@ApiOperation(value = "创建'用户表'表中一条信息", notes = "通过post方法请求,传入表中字段的对应信息,创建一条数据。并返回给View层")
@RequestMapping(value = "/users/new",
method = RequestMethod.POST,
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object createUser(
HttpServletRequest request,
@RequestHeader(value = "X-Auth-Token") String token,
@RequestParam(value = "uid", required = false) String uid,
@RequestParam(value = "username", required = false) String username,
@RequestParam(value = "did", required = false) String did,
@RequestParam(value = "password", required = false) String password,
@RequestParam(value = "gender", required = false) String gender,
@RequestParam(value = "age", required = false) String age,
@RequestParam(value = "createTime", required = false) String createTime,
@RequestParam(value = "lastUpdateTime", required = false) String lastUpdateTime
) {
User item = new User();
String id = Tools.getUUID();
item.setId(id);
if( uid != null ){
item.setUid(uid);
}
if( username != null ){
item.setUsername(username);
}
if( did != null ){
item.setDid(did);
}
if( password != null ){
item.setPassword(password);
}
if( gender != null ){
item.setGender(gender);
}
if( age != null ){
item.setAge(age);
}
item.setCreateTime(new Date());
item.setLastUpdateTime(new Date());
userService.create(item);
//若request param为null,但字段定义有默认值,则需从数据库中返回结果
return userService.get(id);
//return item;
}
@ApiOperation(value = "删除'用户表'表中的某条记录", notes = "根据url传入的数据id,删除整条记录。")
@RequestMapping(value = "/users/{user_id}/delete",
method = RequestMethod.POST,
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object deleteUser(
@RequestHeader(value = "X-Auth-Token") String token,
@PathVariable(value = "user_id") String id
) {
User item = userService.get(id);
if (null == item) {
response.setStatus(404);
return Resp.fail("the asset to be deleted doesn't exist");
}
userService.delete(id);
return Resp.succ("delete success");
}
@ApiOperation(value = "修改'用户表'表中的某条记录", notes = "根据url传入的数据id,确定修改表中的某条记录,传入表中字段要修改的信息,不传代表不修改。并返回给View层")
@RequestMapping(value = "/users/{user_id}/edit",
method = RequestMethod.POST,
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object editUser(
HttpServletRequest request,
@RequestHeader(value = "X-Auth-Token") String token,
@PathVariable(value = "user_id") String id,
@RequestParam(value = "uid", required = false) String uid,
@RequestParam(value = "username", required = false) String username,
@RequestParam(value = "did", required = false) String did,
@RequestParam(value = "password", required = false) String password,
@RequestParam(value = "gender", required = false) String gender,
@RequestParam(value = "age", required = false) String age
) {
User item = userService.get(id);
if (null == item) {
response.setStatus(404);
return Resp.fail("the asset to be edited doesn't exist");
}
if( uid != null ){
item.setUid(uid);
}
if( username != null ){
item.setUsername(username);
}
if( did != null ){
item.setDid(did);
}
if( password != null ){
item.setPassword(password);
}
if( gender != null ){
item.setGender(gender);
}
if( age != null ){
item.setAge(age);
}
item.setLastUpdateTime(new Date());
userService.update(item);
return userService.get(id);
}
@ApiOperation(value = "查询'用户表'表中的某条记录", notes = "根据url传入的数据id,查询对应的一条数据。")
@RequestMapping(value = "/users/{user_id}",
method = {RequestMethod.GET, RequestMethod.DELETE, RequestMethod.PUT},
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object getUser(
HttpServletRequest request,
@RequestHeader(value = "X-Auth-Token") String token,
@PathVariable(value = "user_id") String id,
@RequestParam(value = "uid", required = false) String uid,
@RequestParam(value = "username", required = false) String username,
@RequestParam(value = "did", required = false) String did,
@RequestParam(value = "password", required = false) String password,
@RequestParam(value = "gender", required = false) String gender,
@RequestParam(value = "age", required = false) String age
) {
if(request.getMethod().equals("GET")){
User item = userService.get(id);
if (null == item) {
response.setStatus(404);
return Resp.fail("the asset to be edited doesn't exist");
}
return item;
}
else if(request.getMethod().equals("PUT")){
User item = userService.get(id);
if (null == item) {
response.setStatus(404);
return Resp.fail("the asset to be edited doesn't exist");
}
if( uid != null ){
item.setUid(uid);
}
if( username != null ){
item.setUsername(username);
}
if( did != null ){
item.setDid(did);
}
if( password != null ){
item.setPassword(password);
}
if( gender != null ){
item.setGender(gender);
}
if( age != null ){
item.setAge(age);
}
item.setLastUpdateTime(new Date());
userService.update(item);
return userService.get(id);
}
else if(request.getMethod().equals("DELETE")){
User item = userService.get(id);
if (null == item) {
response.setStatus(404);
return Resp.fail("the asset to be deleted doesn't exist");
}
userService.delete(id);
return Resp.succ("delete success");
}
return Resp.fail("Unknown http method");
}
@ApiOperation(value = "查询'用户表'表中的多条记录或者新增某条记录", notes = "get传参:根据url传入的filters(过滤条件),查询对应的多条数据。数据数量取决于pageNo和pageSize;数据的先后顺序取决于sortItem,sortOrder; post请求:新增某条记录,传入表字段对应的值")
@RequestMapping(value = "/users",
method = { RequestMethod.GET, RequestMethod.POST },
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object getUsers(
HttpServletRequest request,
@RequestHeader(value = "X-Auth-Token", required = false) String token,
@RequestParam(value = "pageNo", required = false) Integer pageNo,
@RequestParam(value = "pageSize", required = false) Integer pageSize,
@RequestParam(value = "sortItem", required = false) String sortItem,
@RequestParam(value = "sortOrder", required = false) String sortOrder,
@RequestParam(value = "filters", required = false) String filters,
@RequestParam(value = "includes", required = false) String includes,
@RequestParam(value = "refers", required = false) String refers,
@RequestParam(value = "relates", required = false) String relates
) {
if(pageNo == null){
pageNo = 1;
}
if(pageSize == null){
pageSize = 10;
}
if(sortItem == null){
sortItem = "id";
}
if(sortOrder == null){
sortOrder = "asc";
}
if(filters == null){
filters = "{}";
}
Long total = userService.countListWithPagingAndFilter(filters);
response.addHeader("total", String.valueOf(total));
return userService.getListWithPagingAndFilter(
pageNo, pageSize, sortItem, sortOrder, filters, includes, refers, relates);
}
@ApiOperation(value = "出入字段数组返回对应字段数据", notes = "get传参:根据url传入的filters(过滤条件),查询对应的多条数据。只返回你传进来的字段对应的数据")
@RequestMapping(value = "/users/columns",
method = { RequestMethod.GET },
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object getUsersId(
HttpServletRequest request,
@RequestHeader(value = "X-Auth-Token", required = false) String token,
@RequestParam(value = "filters", required = true) String filters,
@RequestParam(value = "columns", required = true) String columns,
@RequestParam(value = "sortOrder", required = false) String sortOrder,
@RequestParam(value = "sortItem", required = false) String sortItem,
@RequestParam(value = "pageNo", required = false) Integer pageNo,
@RequestParam(value = "pageSize", required = false) Integer pageSize
) {
if(pageNo == null){
pageNo = 1;
}
if(pageSize == null){
pageSize = 10;
}
if(sortOrder==null){
sortOrder = "asc";
}
if(sortItem==null){
sortItem = "id";
}
JSONArray jsonArray = JSON.parseArray(columns);
List<Map<String,Object>> lists = new ArrayList<>();
List<User> list = userService.getListWithPagingAndFilter(
pageNo, pageSize, sortItem, sortOrder, filters);
//反射调取get方法
Class clz = User.class;
list.stream().forEach(lot->{
Map<String,Object> map = new HashMap<>();
for (Object j : jsonArray){
String s = (String) j;
s = s.replaceFirst(s.substring(0,1),s.substring(0,1).toUpperCase());
try {
if (clz.getMethod("get"+s).invoke(lot) !=null){
map.put((String) j,clz.getMethod("get"+s).invoke(lot));
}
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
lists.add(map);
});
return lists;
}
@ApiOperation(value = "批量创建'用户表'表中一条信息", notes = "通过post方法请求,传入表中字段的对应信息,创建一条数据。并返回给View层")
@RequestMapping(value = "/users/create/batch",
method = RequestMethod.POST,
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object createsUsers(
HttpServletRequest request,
@RequestHeader(value = "X-Auth-Token", required = false) String token,
@RequestParam(value = "params", required = false) String params
) {
JSONArray jsonArray = JSON.parseArray(params);
List<User> lists = new ArrayList<>();
jsonArray.stream().forEach((Object object) -> {
JSONObject jsonObject = JSONObject.parseObject(object.toString());
User item = new User();
String id = Tools.getUUID();
item.setId(id);
if(jsonObject.containsKey("uid") ){
item.setUid(jsonObject.get("uid").toString());
}
if(jsonObject.containsKey("username") ){
item.setUsername(jsonObject.get("username").toString());
}
if(jsonObject.containsKey("did") ){
item.setDid(jsonObject.get("did").toString());
}
if(jsonObject.containsKey("password") ){
item.setPassword(jsonObject.get("password").toString());
}
if(jsonObject.containsKey("gender") ){
item.setGender(jsonObject.get("gender").toString());
}
if(jsonObject.containsKey("age") ){
item.setAge(jsonObject.get("age").toString());
}
item.setCreateTime(new Date());
item.setLastUpdateTime(new Date());
userService.create(item);
lists.add(userService.get(id));
});
return lists;
}
@ApiOperation(value = "批量修改'用户表'表中多条信息", notes = "通过post方法请求,传入表中字段的对应信息,数组中每个对象必须有id属性!")
@RequestMapping(value = "/users/edit/batch",
method = RequestMethod.POST,
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object editsUsers(
HttpServletRequest request,
@RequestHeader(value = "X-Auth-Token", required = false) String token,
@RequestParam(value = "params", required = false) String params
) {
JSONArray jsonArray = JSON.parseArray(params);
List<User> lists = new ArrayList<>();
jsonArray.stream().forEach((Object object) -> {
JSONObject jsonObject = JSONObject.parseObject(object.toString());
User item = new User();
if(jsonObject.containsKey("uid") ){
item.setUid(jsonObject.get("uid").toString());
}
if(jsonObject.containsKey("username") ){
item.setUsername(jsonObject.get("username").toString());
}
if(jsonObject.containsKey("did") ){
item.setDid(jsonObject.get("did").toString());
}
if(jsonObject.containsKey("password") ){
item.setPassword(jsonObject.get("password").toString());
}
if(jsonObject.containsKey("gender") ){
item.setGender(jsonObject.get("gender").toString());
}
if(jsonObject.containsKey("age") ){
item.setAge(jsonObject.get("age").toString());
}
if(jsonObject.containsKey("id") ){
item.setId(jsonObject.get("id").toString());
}
item.setLastUpdateTime(new Date());
userService.update(item);
lists.add(userService.get(jsonObject.get("id").toString()));
});
return lists;
}
@ApiOperation(value = "批量删除'用户表'表中一条信息", notes = "通过post方法请求,传入表中字段的对应信息,创建一条数据。并返回给View层")
@RequestMapping(value = "/users/delete/batch",
method = RequestMethod.POST,
produces = "application/json;charset=UTF-8")
@ResponseBody
public Object deletesUser(
HttpServletRequest request,
@RequestHeader(value = "X-Auth-Token", required = false) String token,
@RequestParam(value = "ids", required = true) String ids
) {
JSONArray jsonArray = JSON.parseArray(ids);
jsonArray.stream().forEach(id->{
User item = userService.get(id.toString());
if (null != item) {
userService.delete(id.toString());
}
});
return Resp.succ("delete success");
}
}
#mysql database setting #mysql database setting
#jdbc.driver=com.mysql.jdbc.Driver jdbc.driver=com.mysql.jdbc.Driver
#jdbc.url=jdbc:mysql://10.28.163.192:3306/smartchatNew?useUnicode=true&amp;characterEncoding=UTF-8 jdbc.url=jdbc:mysql://localhost:3306/permissiontest?useUnicode=true&amp;characterEncoding=UTF-8
#jdbc.username=knowledge jdbc.username=root
#jdbc.password=knowledge jdbc.password=root
#connection pool settings #connection pool settings
jdbc.pool.maxIdle=10 jdbc.pool.maxIdle=10
......
...@@ -4,6 +4,6 @@ ...@@ -4,6 +4,6 @@
jdbc.driverClassName=oracle.jdbc.driver.OracleDriver jdbc.driverClassName=oracle.jdbc.driver.OracleDriver
jdbc.url=jdbc:oracle:thin:@localhost:1521:orcl jdbc.url=jdbc:oracle:thin:@localhost:1521:orcl
jdbc.username=root jdbc.username=root
jdbc.password=123456 jdbc.password=root
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.haomostudio.delivery.dao.CatalogMapper">
<resultMap id="BaseResultMap" type="com.haomostudio.delivery.po.Catalog">
<id column="cid" jdbcType="VARCHAR" property="cid" />
<result column="cname" jdbcType="VARCHAR" property="cname" />
<result column="resource" jdbcType="VARCHAR" property="resource" />
<result column="id" jdbcType="VARCHAR" property="id" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="last_update_time" jdbcType="TIMESTAMP" property="lastUpdateTime" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
cid, cname, resource, id, create_time, last_update_time
</sql>
<select id="selectByExample" parameterType="com.haomostudio.delivery.po.CatalogExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from catalog
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="page != null">
limit #{page.begin} , #{page.length}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from catalog
where cid = #{cid,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from catalog
where cid = #{cid,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="com.haomostudio.delivery.po.CatalogExample">
delete from catalog
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.haomostudio.delivery.po.Catalog">
insert into catalog (cid, cname, resource,
id, create_time, last_update_time
)
values (#{cid,jdbcType=VARCHAR}, #{cname,jdbcType=VARCHAR}, #{resource,jdbcType=VARCHAR},
#{id,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{lastUpdateTime,jdbcType=TIMESTAMP}
)
</insert>
<insert id="insertSelective" parameterType="com.haomostudio.delivery.po.Catalog">
insert into catalog
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="cid != null">
cid,
</if>
<if test="cname != null">
cname,
</if>
<if test="resource != null">
resource,
</if>
<if test="id != null">
id,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="lastUpdateTime != null">
last_update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="cid != null">
#{cid,jdbcType=VARCHAR},
</if>
<if test="cname != null">
#{cname,jdbcType=VARCHAR},
</if>
<if test="resource != null">
#{resource,jdbcType=VARCHAR},
</if>
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="lastUpdateTime != null">
#{lastUpdateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.haomostudio.delivery.po.CatalogExample" resultType="java.lang.Long">
select count(*) from catalog
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update catalog
<set>
<if test="record.cid != null">
cid = #{record.cid,jdbcType=VARCHAR},
</if>
<if test="record.cname != null">
cname = #{record.cname,jdbcType=VARCHAR},
</if>
<if test="record.resource != null">
resource = #{record.resource,jdbcType=VARCHAR},
</if>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.lastUpdateTime != null">
last_update_time = #{record.lastUpdateTime,jdbcType=TIMESTAMP},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update catalog
set cid = #{record.cid,jdbcType=VARCHAR},
cname = #{record.cname,jdbcType=VARCHAR},
resource = #{record.resource,jdbcType=VARCHAR},
id = #{record.id,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
last_update_time = #{record.lastUpdateTime,jdbcType=TIMESTAMP}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.haomostudio.delivery.po.Catalog">
update catalog
<set>
<if test="cname != null">
cname = #{cname,jdbcType=VARCHAR},
</if>
<if test="resource != null">
resource = #{resource,jdbcType=VARCHAR},
</if>
<if test="id != null">
id = #{id,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="lastUpdateTime != null">
last_update_time = #{lastUpdateTime,jdbcType=TIMESTAMP},
</if>
</set>
where cid = #{cid,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.haomostudio.delivery.po.Catalog">
update catalog
set cname = #{cname,jdbcType=VARCHAR},
resource = #{resource,jdbcType=VARCHAR},
id = #{id,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
last_update_time = #{lastUpdateTime,jdbcType=TIMESTAMP}
where cid = #{cid,jdbcType=VARCHAR}
</update>
<select id="selectByExampleWithRowbounds" parameterType="com.haomostudio.delivery.po.CatalogExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from catalog
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.haomostudio.delivery.dao.DeptMapper">
<resultMap id="BaseResultMap" type="com.haomostudio.delivery.po.Dept">
<id column="did" jdbcType="VARCHAR" property="did" />
<result column="id" jdbcType="VARCHAR" property="id" />
<result column="dname" jdbcType="VARCHAR" property="dname" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="last_update_time" jdbcType="TIMESTAMP" property="lastUpdateTime" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
did, id, dname, create_time, last_update_time
</sql>
<select id="selectByExample" parameterType="com.haomostudio.delivery.po.DeptExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from dept
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="page != null">
limit #{page.begin} , #{page.length}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from dept
where did = #{did,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from dept
where did = #{did,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="com.haomostudio.delivery.po.DeptExample">
delete from dept
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.haomostudio.delivery.po.Dept">
insert into dept (did, id, dname,
create_time, last_update_time)
values (#{did,jdbcType=VARCHAR}, #{id,jdbcType=VARCHAR}, #{dname,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{lastUpdateTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.haomostudio.delivery.po.Dept">
insert into dept
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="did != null">
did,
</if>
<if test="id != null">
id,
</if>
<if test="dname != null">
dname,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="lastUpdateTime != null">
last_update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="did != null">
#{did,jdbcType=VARCHAR},
</if>
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="dname != null">
#{dname,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="lastUpdateTime != null">
#{lastUpdateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.haomostudio.delivery.po.DeptExample" resultType="java.lang.Long">
select count(*) from dept
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update dept
<set>
<if test="record.did != null">
did = #{record.did,jdbcType=VARCHAR},
</if>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.dname != null">
dname = #{record.dname,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.lastUpdateTime != null">
last_update_time = #{record.lastUpdateTime,jdbcType=TIMESTAMP},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update dept
set did = #{record.did,jdbcType=VARCHAR},
id = #{record.id,jdbcType=VARCHAR},
dname = #{record.dname,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
last_update_time = #{record.lastUpdateTime,jdbcType=TIMESTAMP}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.haomostudio.delivery.po.Dept">
update dept
<set>
<if test="id != null">
id = #{id,jdbcType=VARCHAR},
</if>
<if test="dname != null">
dname = #{dname,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="lastUpdateTime != null">
last_update_time = #{lastUpdateTime,jdbcType=TIMESTAMP},
</if>
</set>
where did = #{did,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.haomostudio.delivery.po.Dept">
update dept
set id = #{id,jdbcType=VARCHAR},
dname = #{dname,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
last_update_time = #{lastUpdateTime,jdbcType=TIMESTAMP}
where did = #{did,jdbcType=VARCHAR}
</update>
<select id="selectByExampleWithRowbounds" parameterType="com.haomostudio.delivery.po.DeptExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from dept
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.haomostudio.delivery.dao.RoleCatalogMapper">
<resultMap id="BaseResultMap" type="com.haomostudio.delivery.po.RoleCatalog">
<id column="role_catalogid" jdbcType="VARCHAR" property="roleCatalogid" />
<result column="rid" jdbcType="VARCHAR" property="rid" />
<result column="cid" jdbcType="VARCHAR" property="cid" />
<result column="id" jdbcType="VARCHAR" property="id" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="last_update_time" jdbcType="TIMESTAMP" property="lastUpdateTime" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
role_catalogid, rid, cid, id, create_time, last_update_time
</sql>
<select id="selectByExample" parameterType="com.haomostudio.delivery.po.RoleCatalogExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from role_catalog
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="page != null">
limit #{page.begin} , #{page.length}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from role_catalog
where role_catalogid = #{roleCatalogid,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from role_catalog
where role_catalogid = #{roleCatalogid,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="com.haomostudio.delivery.po.RoleCatalogExample">
delete from role_catalog
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.haomostudio.delivery.po.RoleCatalog">
insert into role_catalog (role_catalogid, rid, cid,
id, create_time, last_update_time
)
values (#{roleCatalogid,jdbcType=VARCHAR}, #{rid,jdbcType=VARCHAR}, #{cid,jdbcType=VARCHAR},
#{id,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{lastUpdateTime,jdbcType=TIMESTAMP}
)
</insert>
<insert id="insertSelective" parameterType="com.haomostudio.delivery.po.RoleCatalog">
insert into role_catalog
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="roleCatalogid != null">
role_catalogid,
</if>
<if test="rid != null">
rid,
</if>
<if test="cid != null">
cid,
</if>
<if test="id != null">
id,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="lastUpdateTime != null">
last_update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="roleCatalogid != null">
#{roleCatalogid,jdbcType=VARCHAR},
</if>
<if test="rid != null">
#{rid,jdbcType=VARCHAR},
</if>
<if test="cid != null">
#{cid,jdbcType=VARCHAR},
</if>
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="lastUpdateTime != null">
#{lastUpdateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.haomostudio.delivery.po.RoleCatalogExample" resultType="java.lang.Long">
select count(*) from role_catalog
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update role_catalog
<set>
<if test="record.roleCatalogid != null">
role_catalogid = #{record.roleCatalogid,jdbcType=VARCHAR},
</if>
<if test="record.rid != null">
rid = #{record.rid,jdbcType=VARCHAR},
</if>
<if test="record.cid != null">
cid = #{record.cid,jdbcType=VARCHAR},
</if>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.lastUpdateTime != null">
last_update_time = #{record.lastUpdateTime,jdbcType=TIMESTAMP},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update role_catalog
set role_catalogid = #{record.roleCatalogid,jdbcType=VARCHAR},
rid = #{record.rid,jdbcType=VARCHAR},
cid = #{record.cid,jdbcType=VARCHAR},
id = #{record.id,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
last_update_time = #{record.lastUpdateTime,jdbcType=TIMESTAMP}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.haomostudio.delivery.po.RoleCatalog">
update role_catalog
<set>
<if test="rid != null">
rid = #{rid,jdbcType=VARCHAR},
</if>
<if test="cid != null">
cid = #{cid,jdbcType=VARCHAR},
</if>
<if test="id != null">
id = #{id,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="lastUpdateTime != null">
last_update_time = #{lastUpdateTime,jdbcType=TIMESTAMP},
</if>
</set>
where role_catalogid = #{roleCatalogid,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.haomostudio.delivery.po.RoleCatalog">
update role_catalog
set rid = #{rid,jdbcType=VARCHAR},
cid = #{cid,jdbcType=VARCHAR},
id = #{id,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
last_update_time = #{lastUpdateTime,jdbcType=TIMESTAMP}
where role_catalogid = #{roleCatalogid,jdbcType=VARCHAR}
</update>
<select id="selectByExampleWithRowbounds" parameterType="com.haomostudio.delivery.po.RoleCatalogExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from role_catalog
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.haomostudio.delivery.dao.TRoleMapper">
<resultMap id="BaseResultMap" type="com.haomostudio.delivery.po.TRole">
<id column="rid" jdbcType="VARCHAR" property="rid" />
<result column="rname" jdbcType="VARCHAR" property="rname" />
<result column="id" jdbcType="VARCHAR" property="id" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="last_update_time" jdbcType="TIMESTAMP" property="lastUpdateTime" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
rid, rname, id, create_time, last_update_time
</sql>
<select id="selectByExample" parameterType="com.haomostudio.delivery.po.TRoleExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from t_role
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="page != null">
limit #{page.begin} , #{page.length}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from t_role
where rid = #{rid,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from t_role
where rid = #{rid,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="com.haomostudio.delivery.po.TRoleExample">
delete from t_role
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.haomostudio.delivery.po.TRole">
insert into t_role (rid, rname, id,
create_time, last_update_time)
values (#{rid,jdbcType=VARCHAR}, #{rname,jdbcType=VARCHAR}, #{id,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{lastUpdateTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.haomostudio.delivery.po.TRole">
insert into t_role
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="rid != null">
rid,
</if>
<if test="rname != null">
rname,
</if>
<if test="id != null">
id,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="lastUpdateTime != null">
last_update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="rid != null">
#{rid,jdbcType=VARCHAR},
</if>
<if test="rname != null">
#{rname,jdbcType=VARCHAR},
</if>
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="lastUpdateTime != null">
#{lastUpdateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.haomostudio.delivery.po.TRoleExample" resultType="java.lang.Long">
select count(*) from t_role
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update t_role
<set>
<if test="record.rid != null">
rid = #{record.rid,jdbcType=VARCHAR},
</if>
<if test="record.rname != null">
rname = #{record.rname,jdbcType=VARCHAR},
</if>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.lastUpdateTime != null">
last_update_time = #{record.lastUpdateTime,jdbcType=TIMESTAMP},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update t_role
set rid = #{record.rid,jdbcType=VARCHAR},
rname = #{record.rname,jdbcType=VARCHAR},
id = #{record.id,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
last_update_time = #{record.lastUpdateTime,jdbcType=TIMESTAMP}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.haomostudio.delivery.po.TRole">
update t_role
<set>
<if test="rname != null">
rname = #{rname,jdbcType=VARCHAR},
</if>
<if test="id != null">
id = #{id,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="lastUpdateTime != null">
last_update_time = #{lastUpdateTime,jdbcType=TIMESTAMP},
</if>
</set>
where rid = #{rid,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.haomostudio.delivery.po.TRole">
update t_role
set rname = #{rname,jdbcType=VARCHAR},
id = #{id,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
last_update_time = #{lastUpdateTime,jdbcType=TIMESTAMP}
where rid = #{rid,jdbcType=VARCHAR}
</update>
<select id="selectByExampleWithRowbounds" parameterType="com.haomostudio.delivery.po.TRoleExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from t_role
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.haomostudio.delivery.dao.TUserRoleMapper">
<resultMap id="BaseResultMap" type="com.haomostudio.delivery.po.TUserRole">
<id column="user_roleid" jdbcType="VARCHAR" property="userRoleid" />
<result column="uid" jdbcType="VARCHAR" property="uid" />
<result column="rid" jdbcType="VARCHAR" property="rid" />
<result column="id" jdbcType="VARCHAR" property="id" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="last_update_time" jdbcType="TIMESTAMP" property="lastUpdateTime" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
user_roleid, uid, rid, id, create_time, last_update_time
</sql>
<select id="selectByExample" parameterType="com.haomostudio.delivery.po.TUserRoleExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from t_user_role
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="page != null">
limit #{page.begin} , #{page.length}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from t_user_role
where user_roleid = #{userRoleid,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from t_user_role
where user_roleid = #{userRoleid,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="com.haomostudio.delivery.po.TUserRoleExample">
delete from t_user_role
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.haomostudio.delivery.po.TUserRole">
insert into t_user_role (user_roleid, uid, rid,
id, create_time, last_update_time
)
values (#{userRoleid,jdbcType=VARCHAR}, #{uid,jdbcType=VARCHAR}, #{rid,jdbcType=VARCHAR},
#{id,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{lastUpdateTime,jdbcType=TIMESTAMP}
)
</insert>
<insert id="insertSelective" parameterType="com.haomostudio.delivery.po.TUserRole">
insert into t_user_role
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userRoleid != null">
user_roleid,
</if>
<if test="uid != null">
uid,
</if>
<if test="rid != null">
rid,
</if>
<if test="id != null">
id,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="lastUpdateTime != null">
last_update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userRoleid != null">
#{userRoleid,jdbcType=VARCHAR},
</if>
<if test="uid != null">
#{uid,jdbcType=VARCHAR},
</if>
<if test="rid != null">
#{rid,jdbcType=VARCHAR},
</if>
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="lastUpdateTime != null">
#{lastUpdateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.haomostudio.delivery.po.TUserRoleExample" resultType="java.lang.Long">
select count(*) from t_user_role
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update t_user_role
<set>
<if test="record.userRoleid != null">
user_roleid = #{record.userRoleid,jdbcType=VARCHAR},
</if>
<if test="record.uid != null">
uid = #{record.uid,jdbcType=VARCHAR},
</if>
<if test="record.rid != null">
rid = #{record.rid,jdbcType=VARCHAR},
</if>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.lastUpdateTime != null">
last_update_time = #{record.lastUpdateTime,jdbcType=TIMESTAMP},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update t_user_role
set user_roleid = #{record.userRoleid,jdbcType=VARCHAR},
uid = #{record.uid,jdbcType=VARCHAR},
rid = #{record.rid,jdbcType=VARCHAR},
id = #{record.id,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
last_update_time = #{record.lastUpdateTime,jdbcType=TIMESTAMP}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.haomostudio.delivery.po.TUserRole">
update t_user_role
<set>
<if test="uid != null">
uid = #{uid,jdbcType=VARCHAR},
</if>
<if test="rid != null">
rid = #{rid,jdbcType=VARCHAR},
</if>
<if test="id != null">
id = #{id,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="lastUpdateTime != null">
last_update_time = #{lastUpdateTime,jdbcType=TIMESTAMP},
</if>
</set>
where user_roleid = #{userRoleid,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.haomostudio.delivery.po.TUserRole">
update t_user_role
set uid = #{uid,jdbcType=VARCHAR},
rid = #{rid,jdbcType=VARCHAR},
id = #{id,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
last_update_time = #{lastUpdateTime,jdbcType=TIMESTAMP}
where user_roleid = #{userRoleid,jdbcType=VARCHAR}
</update>
<select id="selectByExampleWithRowbounds" parameterType="com.haomostudio.delivery.po.TUserRoleExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from t_user_role
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.haomostudio.delivery.dao.UserMapper">
<resultMap id="BaseResultMap" type="com.haomostudio.delivery.po.User">
<id column="uid" jdbcType="VARCHAR" property="uid" />
<result column="username" jdbcType="VARCHAR" property="username" />
<result column="did" jdbcType="VARCHAR" property="did" />
<result column="password" jdbcType="VARCHAR" property="password" />
<result column="gender" jdbcType="VARCHAR" property="gender" />
<result column="age" jdbcType="VARCHAR" property="age" />
<result column="id" jdbcType="VARCHAR" property="id" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="last_update_time" jdbcType="TIMESTAMP" property="lastUpdateTime" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
uid, username, did, password, gender, age, id, create_time, last_update_time
</sql>
<select id="selectByExample" parameterType="com.haomostudio.delivery.po.UserExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from user
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="page != null">
limit #{page.begin} , #{page.length}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from user
where uid = #{uid,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from user
where uid = #{uid,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="com.haomostudio.delivery.po.UserExample">
delete from user
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.haomostudio.delivery.po.User">
insert into user (uid, username, did,
password, gender, age,
id, create_time, last_update_time
)
values (#{uid,jdbcType=VARCHAR}, #{username,jdbcType=VARCHAR}, #{did,jdbcType=VARCHAR},
#{password,jdbcType=VARCHAR}, #{gender,jdbcType=VARCHAR}, #{age,jdbcType=VARCHAR},
#{id,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{lastUpdateTime,jdbcType=TIMESTAMP}
)
</insert>
<insert id="insertSelective" parameterType="com.haomostudio.delivery.po.User">
insert into user
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="uid != null">
uid,
</if>
<if test="username != null">
username,
</if>
<if test="did != null">
did,
</if>
<if test="password != null">
password,
</if>
<if test="gender != null">
gender,
</if>
<if test="age != null">
age,
</if>
<if test="id != null">
id,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="lastUpdateTime != null">
last_update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="uid != null">
#{uid,jdbcType=VARCHAR},
</if>
<if test="username != null">
#{username,jdbcType=VARCHAR},
</if>
<if test="did != null">
#{did,jdbcType=VARCHAR},
</if>
<if test="password != null">
#{password,jdbcType=VARCHAR},
</if>
<if test="gender != null">
#{gender,jdbcType=VARCHAR},
</if>
<if test="age != null">
#{age,jdbcType=VARCHAR},
</if>
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="lastUpdateTime != null">
#{lastUpdateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.haomostudio.delivery.po.UserExample" resultType="java.lang.Long">
select count(*) from user
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update user
<set>
<if test="record.uid != null">
uid = #{record.uid,jdbcType=VARCHAR},
</if>
<if test="record.username != null">
username = #{record.username,jdbcType=VARCHAR},
</if>
<if test="record.did != null">
did = #{record.did,jdbcType=VARCHAR},
</if>
<if test="record.password != null">
password = #{record.password,jdbcType=VARCHAR},
</if>
<if test="record.gender != null">
gender = #{record.gender,jdbcType=VARCHAR},
</if>
<if test="record.age != null">
age = #{record.age,jdbcType=VARCHAR},
</if>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.lastUpdateTime != null">
last_update_time = #{record.lastUpdateTime,jdbcType=TIMESTAMP},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update user
set uid = #{record.uid,jdbcType=VARCHAR},
username = #{record.username,jdbcType=VARCHAR},
did = #{record.did,jdbcType=VARCHAR},
password = #{record.password,jdbcType=VARCHAR},
gender = #{record.gender,jdbcType=VARCHAR},
age = #{record.age,jdbcType=VARCHAR},
id = #{record.id,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
last_update_time = #{record.lastUpdateTime,jdbcType=TIMESTAMP}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.haomostudio.delivery.po.User">
update user
<set>
<if test="username != null">
username = #{username,jdbcType=VARCHAR},
</if>
<if test="did != null">
did = #{did,jdbcType=VARCHAR},
</if>
<if test="password != null">
password = #{password,jdbcType=VARCHAR},
</if>
<if test="gender != null">
gender = #{gender,jdbcType=VARCHAR},
</if>
<if test="age != null">
age = #{age,jdbcType=VARCHAR},
</if>
<if test="id != null">
id = #{id,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="lastUpdateTime != null">
last_update_time = #{lastUpdateTime,jdbcType=TIMESTAMP},
</if>
</set>
where uid = #{uid,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.haomostudio.delivery.po.User">
update user
set username = #{username,jdbcType=VARCHAR},
did = #{did,jdbcType=VARCHAR},
password = #{password,jdbcType=VARCHAR},
gender = #{gender,jdbcType=VARCHAR},
age = #{age,jdbcType=VARCHAR},
id = #{id,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
last_update_time = #{lastUpdateTime,jdbcType=TIMESTAMP}
where uid = #{uid,jdbcType=VARCHAR}
</update>
<select id="selectByExampleWithRowbounds" parameterType="com.haomostudio.delivery.po.UserExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from user
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
</mapper>
\ No newline at end of file
...@@ -5,13 +5,13 @@ ...@@ -5,13 +5,13 @@
<generatorConfiguration> <generatorConfiguration>
<!--<classPathEntry location="/Users/hxgqh/.m2/repository/mysql/mysql-connector-java/5.1.38/mysql-connector-java-5.1.38.jar" />--> <!--<classPathEntry location="/Users/hxgqh/.m2/repository/mysql/mysql-connector-java/5.1.38/mysql-connector-java-5.1.38.jar" />-->
<classPathEntry location="/Users/zl/.m2/repository/mysql/mysql-connector-java/5.1.38/mysql-connector-java-5.1.38.jar" /> <classPathEntry location="/Users/liuranran/maven/repository/mysql/mysql-connector-java/5.1.38/mysql-connector-java-5.1.38.jar" />
<context id="mysqlTables" targetRuntime="MyBatis3"> <context id="mysqlTables" targetRuntime="MyBatis3">
<plugin type="org.mybatis.generator.plugins.RowBoundsPlugin"/> <plugin type="org.mybatis.generator.plugins.RowBoundsPlugin"/>
<plugin type="org.mybatis.generator.plugins.ToStringPlugin"/> <plugin type="org.mybatis.generator.plugins.ToStringPlugin"/>
<!-- Pagination --> <!-- Pagination -->
<plugin type="com.haomo.plugin.OraclePaginationPlugin" /> <plugin type="com.haomostudio.plugin.OraclePaginationPlugin" />
<commentGenerator> <commentGenerator>
<property name="suppressDate" value="true" /> <property name="suppressDate" value="true" />
...@@ -19,9 +19,9 @@ ...@@ -19,9 +19,9 @@
</commentGenerator> </commentGenerator>
<jdbcConnection driverClass="com.mysql.jdbc.Driver" <jdbcConnection driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://haomo-tech.com:3326/test" connectionURL="jdbc:mysql://localhost:3306/permissiontest"
userId="root" userId="root"
password="0x00NF200"/> password="root"/>
<!-- 指定生成的类型为java类型,避免数据库中number等类型字段 --> <!-- 指定生成的类型为java类型,避免数据库中number等类型字段 -->
<javaTypeResolver> <javaTypeResolver>
...@@ -30,21 +30,21 @@ ...@@ -30,21 +30,21 @@
</javaTypeResolver> </javaTypeResolver>
<!-- 生成model模型,对应的包,存放位置可以指定具体的路径,如/ProjectName/src,也可以使用MAVEN来自动生成 --> <!-- 生成model模型,对应的包,存放位置可以指定具体的路径,如/ProjectName/src,也可以使用MAVEN来自动生成 -->
<javaModelGenerator targetPackage="com.haomo.delivery.po" <javaModelGenerator targetPackage="com.haomostudio.delivery.po"
targetProject="domain/src/main/java/"> targetProject="domain/src/main/java/">
<property name="enableSubPackages" <property name="enableSubPackages"
value="true"/> value="true"/>
</javaModelGenerator> </javaModelGenerator>
<!--对应的xml mapper文件 --> <!--对应的xml mapper文件 -->
<sqlMapGenerator targetPackage="com.com.haomo.delivery" <sqlMapGenerator targetPackage="com.com.haomostudio.delivery"
targetProject="web/src/main/resources/mybatis/"> targetProject="web/src/main/resources/mybatis/">
<property name="enableSubPackages" value="true"/> <property name="enableSubPackages" value="true"/>
</sqlMapGenerator> </sqlMapGenerator>
<!-- 对应的dao接口 --> <!-- 对应的dao接口 -->
<javaClientGenerator type="XMLMAPPER" <javaClientGenerator type="XMLMAPPER"
targetPackage="com.haomo.delivery.dao" targetPackage="com.haomostudio.delivery.dao"
targetProject="dao/src/main/java/"> targetProject="dao/src/main/java/">
<property name="enableSubPackages" <property name="enableSubPackages"
value="true"/> value="true"/>
......
...@@ -9,9 +9,13 @@ ...@@ -9,9 +9,13 @@
http://www.springframework.org/schema/context/spring-context.xsd"> http://www.springframework.org/schema/context/spring-context.xsd">
<!-- 数据源配置 --> <!-- 数据源配置 -->
<!--p:driverClassName="${jdbc.driverClassName}" p:url="${jdbc.url}"-->
<!--p:username="${jdbc.username}" p:password="${jdbc.password}"-->
<bean id="crmDataSource" class="org.apache.tomcat.jdbc.pool.DataSource" <bean id="crmDataSource" class="org.apache.tomcat.jdbc.pool.DataSource"
p:driverClassName="${jdbc.driverClassName}" p:url="${jdbc.url}"
p:username="${jdbc.username}" p:password="${jdbc.password}" p:driverClassName="com.mysql.jdbc.Driver" p:url="jdbc:mysql://127.0.0.1:3306/permissiontest?useUnicode=true&amp;characterEncoding=utf-8&amp;zeroDateTimeBehavior=convertToNull"
p:username="root" p:password="root"
p:validationQuery="select 1" p:testWhileIdle="true" p:validationQuery="select 1" p:testWhileIdle="true"
p:timeBetweenEvictionRunsMillis="3600000" p:timeBetweenEvictionRunsMillis="3600000"
p:maxActive="300" p:maxActive="300"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment