添加公司管理员
This commit is contained in:
parent
700e6274f0
commit
16946294a1
3
sql/20201201.sql
Normal file
3
sql/20201201.sql
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
alter table company
|
||||||
|
add managers varchar(32) null comment '公司管理者';
|
||||||
|
|
@ -1,6 +1,7 @@
|
|||||||
package club.joylink.rtss.controller;
|
package club.joylink.rtss.controller;
|
||||||
|
|
||||||
import club.joylink.rtss.services.ICompanyService;
|
import club.joylink.rtss.services.ICompanyService;
|
||||||
|
import club.joylink.rtss.vo.UserVO;
|
||||||
import club.joylink.rtss.vo.client.CompanyQueryVO;
|
import club.joylink.rtss.vo.client.CompanyQueryVO;
|
||||||
import club.joylink.rtss.vo.client.CompanyVO;
|
import club.joylink.rtss.vo.client.CompanyVO;
|
||||||
import club.joylink.rtss.vo.client.PageVO;
|
import club.joylink.rtss.vo.client.PageVO;
|
||||||
@ -9,6 +10,7 @@ import io.swagger.annotations.ApiOperation;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import springfox.documentation.annotations.ApiIgnore;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -58,4 +60,10 @@ public class CompanyController {
|
|||||||
public CompanyVO get(@PathVariable Integer id, @RequestBody @Validated CompanyVO company) {
|
public CompanyVO get(@PathVariable Integer id, @RequestBody @Validated CompanyVO company) {
|
||||||
return this.iCompanyService.update(id, company);
|
return this.iCompanyService.update(id, company);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("添加公司管理者")
|
||||||
|
@PutMapping("/{id}/addManager")
|
||||||
|
public void addManager(@PathVariable Integer id, @RequestBody List<Long> userIds, @RequestAttribute @ApiIgnore UserVO user) {
|
||||||
|
iCompanyService.addManager(id, userIds, user);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,4 +9,4 @@ import org.springframework.stereotype.Repository;
|
|||||||
*/
|
*/
|
||||||
@Repository
|
@Repository
|
||||||
public interface CompanyDAO extends MyBatisBaseDao<Company, Integer, CompanyExample> {
|
public interface CompanyDAO extends MyBatisBaseDao<Company, Integer, CompanyExample> {
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,11 @@ public class Company implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String phone;
|
private String phone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公司管理者
|
||||||
|
*/
|
||||||
|
private String managers;
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public Integer getId() {
|
public Integer getId() {
|
||||||
@ -58,6 +63,14 @@ public class Company implements Serializable {
|
|||||||
this.phone = phone;
|
this.phone = phone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getManagers() {
|
||||||
|
return managers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setManagers(String managers) {
|
||||||
|
this.managers = managers;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object that) {
|
public boolean equals(Object that) {
|
||||||
if (this == that) {
|
if (this == that) {
|
||||||
@ -73,7 +86,8 @@ public class Company implements Serializable {
|
|||||||
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
|
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
|
||||||
&& (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
|
&& (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
|
||||||
&& (this.getAddress() == null ? other.getAddress() == null : this.getAddress().equals(other.getAddress()))
|
&& (this.getAddress() == null ? other.getAddress() == null : this.getAddress().equals(other.getAddress()))
|
||||||
&& (this.getPhone() == null ? other.getPhone() == null : this.getPhone().equals(other.getPhone()));
|
&& (this.getPhone() == null ? other.getPhone() == null : this.getPhone().equals(other.getPhone()))
|
||||||
|
&& (this.getManagers() == null ? other.getManagers() == null : this.getManagers().equals(other.getManagers()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -84,6 +98,7 @@ public class Company implements Serializable {
|
|||||||
result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
|
result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
|
||||||
result = prime * result + ((getAddress() == null) ? 0 : getAddress().hashCode());
|
result = prime * result + ((getAddress() == null) ? 0 : getAddress().hashCode());
|
||||||
result = prime * result + ((getPhone() == null) ? 0 : getPhone().hashCode());
|
result = prime * result + ((getPhone() == null) ? 0 : getPhone().hashCode());
|
||||||
|
result = prime * result + ((getManagers() == null) ? 0 : getManagers().hashCode());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,8 +112,9 @@ public class Company implements Serializable {
|
|||||||
sb.append(", name=").append(name);
|
sb.append(", name=").append(name);
|
||||||
sb.append(", address=").append(address);
|
sb.append(", address=").append(address);
|
||||||
sb.append(", phone=").append(phone);
|
sb.append(", phone=").append(phone);
|
||||||
|
sb.append(", managers=").append(managers);
|
||||||
sb.append(", serialVersionUID=").append(serialVersionUID);
|
sb.append(", serialVersionUID=").append(serialVersionUID);
|
||||||
sb.append("]");
|
sb.append("]");
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -393,6 +393,76 @@ public class CompanyExample {
|
|||||||
addCriterion("phone not between", value1, value2, "phone");
|
addCriterion("phone not between", value1, value2, "phone");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Criteria andManagersIsNull() {
|
||||||
|
addCriterion("managers is null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andManagersIsNotNull() {
|
||||||
|
addCriterion("managers is not null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andManagersEqualTo(String value) {
|
||||||
|
addCriterion("managers =", value, "managers");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andManagersNotEqualTo(String value) {
|
||||||
|
addCriterion("managers <>", value, "managers");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andManagersGreaterThan(String value) {
|
||||||
|
addCriterion("managers >", value, "managers");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andManagersGreaterThanOrEqualTo(String value) {
|
||||||
|
addCriterion("managers >=", value, "managers");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andManagersLessThan(String value) {
|
||||||
|
addCriterion("managers <", value, "managers");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andManagersLessThanOrEqualTo(String value) {
|
||||||
|
addCriterion("managers <=", value, "managers");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andManagersLike(String value) {
|
||||||
|
addCriterion("managers like", value, "managers");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andManagersNotLike(String value) {
|
||||||
|
addCriterion("managers not like", value, "managers");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andManagersIn(List<String> values) {
|
||||||
|
addCriterion("managers in", values, "managers");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andManagersNotIn(List<String> values) {
|
||||||
|
addCriterion("managers not in", values, "managers");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andManagersBetween(String value1, String value2) {
|
||||||
|
addCriterion("managers between", value1, value2, "managers");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andManagersNotBetween(String value1, String value2) {
|
||||||
|
addCriterion("managers not between", value1, value2, "managers");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -489,4 +559,4 @@ public class CompanyExample {
|
|||||||
this(condition, value, secondValue, null);
|
this(condition, value, secondValue, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,8 +3,11 @@ package club.joylink.rtss.services;
|
|||||||
import club.joylink.rtss.dao.CompanyDAO;
|
import club.joylink.rtss.dao.CompanyDAO;
|
||||||
import club.joylink.rtss.entity.Company;
|
import club.joylink.rtss.entity.Company;
|
||||||
import club.joylink.rtss.entity.CompanyExample;
|
import club.joylink.rtss.entity.CompanyExample;
|
||||||
|
import club.joylink.rtss.entity.SysUser;
|
||||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||||
import club.joylink.rtss.services.completition.IRaceQuestionsRuleService;
|
import club.joylink.rtss.services.completition.IRaceQuestionsRuleService;
|
||||||
|
import club.joylink.rtss.util.JsonUtils;
|
||||||
|
import club.joylink.rtss.vo.UserVO;
|
||||||
import club.joylink.rtss.vo.client.CompanyQueryVO;
|
import club.joylink.rtss.vo.client.CompanyQueryVO;
|
||||||
import club.joylink.rtss.vo.client.CompanyVO;
|
import club.joylink.rtss.vo.client.CompanyVO;
|
||||||
import club.joylink.rtss.vo.client.PageVO;
|
import club.joylink.rtss.vo.client.PageVO;
|
||||||
@ -16,15 +19,20 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class CompanyService implements ICompanyService {
|
public class CompanyService implements ICompanyService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private CompanyDAO companyDAO;
|
private CompanyDAO companyDAO;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IRaceQuestionsRuleService IRaceQuestionsRuleService;
|
private IRaceQuestionsRuleService IRaceQuestionsRuleService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysUserService iSysUserService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<CompanyVO> queryOrganizations() {
|
public List<CompanyVO> queryOrganizations() {
|
||||||
CompanyExample example = new CompanyExample();
|
CompanyExample example = new CompanyExample();
|
||||||
@ -42,7 +50,24 @@ public class CompanyService implements ICompanyService {
|
|||||||
criteria.andNameLike(String.format("%%%s%%", queryVO.getName()));
|
criteria.andNameLike(String.format("%%%s%%", queryVO.getName()));
|
||||||
}
|
}
|
||||||
Page<Company> page = (Page<Company>) companyDAO.selectByExample(example);
|
Page<Company> page = (Page<Company>) companyDAO.selectByExample(example);
|
||||||
return PageVO.convert(page, CompanyVO.convert2VOList(page.getResult()));
|
List<CompanyVO> voList = page.getResult().stream().filter(company -> StringUtils.hasText(company.getManagers()))
|
||||||
|
.map(company -> {
|
||||||
|
List<Long> managerIds = JsonUtils.readCollection(company.getManagers(), List.class, Long.class);
|
||||||
|
List<SysUser> managers = iSysUserService.findEntity(managerIds);
|
||||||
|
List<String> managerNames = managers.stream().map(SysUser::getNickname).collect(Collectors.toList());
|
||||||
|
return CompanyVO.convertFromDB(company, managerNames);
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
return PageVO.convert(page, voList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addManager(Integer id, List<Long> userIds, UserVO user) {
|
||||||
|
Company entity = getEntity(id);
|
||||||
|
List<Long> managerIds = JsonUtils.readCollection(entity.getManagers(), List.class, Long.class);
|
||||||
|
managerIds.addAll(userIds);
|
||||||
|
managerIds = managerIds.stream().distinct().collect(Collectors.toList());
|
||||||
|
entity.setManagers(JsonUtils.writeValueAsString(managerIds));
|
||||||
|
companyDAO.updateByPrimaryKey(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -84,4 +109,10 @@ public class CompanyService implements ICompanyService {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Company getEntity(Integer id) {
|
||||||
|
Company company = companyDAO.selectByPrimaryKey(id);
|
||||||
|
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(company);
|
||||||
|
return company;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package club.joylink.rtss.services;
|
package club.joylink.rtss.services;
|
||||||
|
|
||||||
|
import club.joylink.rtss.vo.UserVO;
|
||||||
import club.joylink.rtss.vo.client.CompanyQueryVO;
|
import club.joylink.rtss.vo.client.CompanyQueryVO;
|
||||||
import club.joylink.rtss.vo.client.CompanyVO;
|
import club.joylink.rtss.vo.client.CompanyVO;
|
||||||
import club.joylink.rtss.vo.client.PageVO;
|
import club.joylink.rtss.vo.client.PageVO;
|
||||||
@ -21,4 +22,9 @@ public interface ICompanyService {
|
|||||||
boolean isExist(Integer companyId);
|
boolean isExist(Integer companyId);
|
||||||
|
|
||||||
PageVO<CompanyVO> queryPageOrganizations(CompanyQueryVO queryVO);
|
PageVO<CompanyVO> queryPageOrganizations(CompanyQueryVO queryVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加公司管理者
|
||||||
|
*/
|
||||||
|
void addManager(Integer id, List<Long> userIds, UserVO user);
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,6 @@ import club.joylink.rtss.vo.UserQueryVO;
|
|||||||
import club.joylink.rtss.vo.UserVO;
|
import club.joylink.rtss.vo.UserVO;
|
||||||
import club.joylink.rtss.vo.client.PageVO;
|
import club.joylink.rtss.vo.client.PageVO;
|
||||||
import club.joylink.rtss.vo.client.UserConfigVO;
|
import club.joylink.rtss.vo.client.UserConfigVO;
|
||||||
import club.joylink.rtss.vo.client.UserSubscribeVO;
|
|
||||||
import club.joylink.rtss.vo.client.map.MapVO;
|
|
||||||
import club.joylink.rtss.vo.client.user.*;
|
import club.joylink.rtss.vo.client.user.*;
|
||||||
import club.joylink.rtss.vo.wx.WmUserSession;
|
import club.joylink.rtss.vo.wx.WmUserSession;
|
||||||
|
|
||||||
@ -278,4 +276,6 @@ public interface ISysUserService {
|
|||||||
List<UserVO> getUsersWithMobile();
|
List<UserVO> getUsersWithMobile();
|
||||||
|
|
||||||
List<UserVO> getPlatformUsers();
|
List<UserVO> getPlatformUsers();
|
||||||
|
|
||||||
|
List<SysUser> findEntity(List<Long> ids);
|
||||||
}
|
}
|
||||||
|
@ -730,4 +730,11 @@ public class SysUserService implements ISysUserService {
|
|||||||
List<UserVO> users = sysUsers.stream().map(UserVO::new).collect(Collectors.toList());
|
List<UserVO> users = sysUsers.stream().map(UserVO::new).collect(Collectors.toList());
|
||||||
return users;
|
return users;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SysUser> findEntity(List<Long> ids) {
|
||||||
|
SysUserExample example = new SysUserExample();
|
||||||
|
example.createCriteria().andIdIn(ids);
|
||||||
|
return sysUserDAO.selectByExample(example);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package club.joylink.rtss.vo.client;
|
package club.joylink.rtss.vo.client;
|
||||||
|
|
||||||
|
import club.joylink.rtss.entity.Company;
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
import club.joylink.rtss.entity.Company;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
@ -29,6 +29,8 @@ public class CompanyVO {
|
|||||||
/**联系方式*/
|
/**联系方式*/
|
||||||
private String phone = "";
|
private String phone = "";
|
||||||
|
|
||||||
|
private List<String> managerNames;
|
||||||
|
|
||||||
public CompanyVO(Company entity) {
|
public CompanyVO(Company entity) {
|
||||||
this.id = entity.getId();
|
this.id = entity.getId();
|
||||||
this.name = entity.getName();
|
this.name = entity.getName();
|
||||||
@ -44,7 +46,13 @@ public class CompanyVO {
|
|||||||
return voList;
|
return voList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Company toDB() {
|
public static CompanyVO convertFromDB(Company company, List<String> managerNames) {
|
||||||
|
CompanyVO vo = new CompanyVO(company);
|
||||||
|
vo.setManagerNames(managerNames);
|
||||||
|
return vo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Company toDB() {
|
||||||
Company entity = new Company();
|
Company entity = new Company();
|
||||||
entity.setId(this.id);
|
entity.setId(this.id);
|
||||||
entity.setName(this.name);
|
entity.setName(this.name);
|
||||||
|
@ -1,198 +1,217 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="club.joylink.rtss.dao.CompanyDAO">
|
<mapper namespace="club.joylink.rtss.dao.CompanyDAO">
|
||||||
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.Company">
|
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.Company">
|
||||||
<id column="id" jdbcType="INTEGER" property="id" />
|
<id column="id" jdbcType="INTEGER" property="id"/>
|
||||||
<result column="name" jdbcType="VARCHAR" property="name" />
|
<result column="name" jdbcType="VARCHAR" property="name"/>
|
||||||
<result column="address" jdbcType="VARCHAR" property="address" />
|
<result column="address" jdbcType="VARCHAR" property="address"/>
|
||||||
<result column="phone" jdbcType="VARCHAR" property="phone" />
|
<result column="phone" jdbcType="VARCHAR" property="phone"/>
|
||||||
</resultMap>
|
<result column="managers" jdbcType="VARCHAR" property="managers"/>
|
||||||
<sql id="Example_Where_Clause">
|
</resultMap>
|
||||||
<where>
|
<sql id="Example_Where_Clause">
|
||||||
<foreach collection="oredCriteria" item="criteria" separator="or">
|
<where>
|
||||||
<if test="criteria.valid">
|
<foreach collection="oredCriteria" item="criteria" separator="or">
|
||||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
<if test="criteria.valid">
|
||||||
<foreach collection="criteria.criteria" item="criterion">
|
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||||
<choose>
|
<foreach collection="criteria.criteria" item="criterion">
|
||||||
<when test="criterion.noValue">
|
<choose>
|
||||||
and ${criterion.condition}
|
<when test="criterion.noValue">
|
||||||
</when>
|
and ${criterion.condition}
|
||||||
<when test="criterion.singleValue">
|
</when>
|
||||||
and ${criterion.condition} #{criterion.value}
|
<when test="criterion.singleValue">
|
||||||
</when>
|
and ${criterion.condition} #{criterion.value}
|
||||||
<when test="criterion.betweenValue">
|
</when>
|
||||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
<when test="criterion.betweenValue">
|
||||||
</when>
|
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||||
<when test="criterion.listValue">
|
</when>
|
||||||
and ${criterion.condition}
|
<when test="criterion.listValue">
|
||||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
and ${criterion.condition}
|
||||||
#{listItem}
|
<foreach close=")" collection="criterion.value" item="listItem" open="("
|
||||||
</foreach>
|
separator=",">
|
||||||
</when>
|
#{listItem}
|
||||||
</choose>
|
</foreach>
|
||||||
|
</when>
|
||||||
|
</choose>
|
||||||
|
</foreach>
|
||||||
|
</trim>
|
||||||
|
</if>
|
||||||
</foreach>
|
</foreach>
|
||||||
</trim>
|
</where>
|
||||||
</if>
|
</sql>
|
||||||
</foreach>
|
<sql id="Update_By_Example_Where_Clause">
|
||||||
</where>
|
<where>
|
||||||
</sql>
|
<foreach collection="example.oredCriteria" item="criteria" separator="or">
|
||||||
<sql id="Update_By_Example_Where_Clause">
|
<if test="criteria.valid">
|
||||||
<where>
|
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||||
<foreach collection="example.oredCriteria" item="criteria" separator="or">
|
<foreach collection="criteria.criteria" item="criterion">
|
||||||
<if test="criteria.valid">
|
<choose>
|
||||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
<when test="criterion.noValue">
|
||||||
<foreach collection="criteria.criteria" item="criterion">
|
and ${criterion.condition}
|
||||||
<choose>
|
</when>
|
||||||
<when test="criterion.noValue">
|
<when test="criterion.singleValue">
|
||||||
and ${criterion.condition}
|
and ${criterion.condition} #{criterion.value}
|
||||||
</when>
|
</when>
|
||||||
<when test="criterion.singleValue">
|
<when test="criterion.betweenValue">
|
||||||
and ${criterion.condition} #{criterion.value}
|
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||||
</when>
|
</when>
|
||||||
<when test="criterion.betweenValue">
|
<when test="criterion.listValue">
|
||||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
and ${criterion.condition}
|
||||||
</when>
|
<foreach close=")" collection="criterion.value" item="listItem" open="("
|
||||||
<when test="criterion.listValue">
|
separator=",">
|
||||||
and ${criterion.condition}
|
#{listItem}
|
||||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
</foreach>
|
||||||
#{listItem}
|
</when>
|
||||||
</foreach>
|
</choose>
|
||||||
</when>
|
</foreach>
|
||||||
</choose>
|
</trim>
|
||||||
|
</if>
|
||||||
</foreach>
|
</foreach>
|
||||||
</trim>
|
</where>
|
||||||
|
</sql>
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id, `name`, address, phone, managers
|
||||||
|
</sql>
|
||||||
|
<select id="selectByExample" parameterType="club.joylink.rtss.entity.CompanyExample" resultMap="BaseResultMap">
|
||||||
|
select
|
||||||
|
<if test="distinct">
|
||||||
|
distinct
|
||||||
</if>
|
</if>
|
||||||
</foreach>
|
<include refid="Base_Column_List"/>
|
||||||
</where>
|
from company
|
||||||
</sql>
|
<if test="_parameter != null">
|
||||||
<sql id="Base_Column_List">
|
<include refid="Example_Where_Clause"/>
|
||||||
id, `name`, address, phone
|
</if>
|
||||||
</sql>
|
<if test="orderByClause != null">
|
||||||
<select id="selectByExample" parameterType="club.joylink.rtss.entity.CompanyExample" resultMap="BaseResultMap">
|
order by ${orderByClause}
|
||||||
select
|
</if>
|
||||||
<if test="distinct">
|
<if test="limit != null">
|
||||||
distinct
|
<if test="offset != null">
|
||||||
</if>
|
limit ${offset}, ${limit}
|
||||||
<include refid="Base_Column_List" />
|
</if>
|
||||||
from company
|
<if test="offset == null">
|
||||||
<if test="_parameter != null">
|
limit ${limit}
|
||||||
<include refid="Example_Where_Clause" />
|
</if>
|
||||||
</if>
|
</if>
|
||||||
<if test="orderByClause != null">
|
</select>
|
||||||
order by ${orderByClause}
|
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||||
</if>
|
select
|
||||||
<if test="limit != null">
|
<include refid="Base_Column_List"/>
|
||||||
<if test="offset != null">
|
from company
|
||||||
limit ${offset}, ${limit}
|
where id = #{id,jdbcType=INTEGER}
|
||||||
</if>
|
</select>
|
||||||
<if test="offset == null">
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||||
limit ${limit}
|
|
||||||
</if>
|
|
||||||
</if>
|
|
||||||
</select>
|
|
||||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
|
||||||
select
|
|
||||||
<include refid="Base_Column_List" />
|
|
||||||
from company
|
|
||||||
where id = #{id,jdbcType=INTEGER}
|
|
||||||
</select>
|
|
||||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
|
||||||
delete from company
|
delete from company
|
||||||
where id = #{id,jdbcType=INTEGER}
|
where id = #{id,jdbcType=INTEGER}
|
||||||
</delete>
|
</delete>
|
||||||
<delete id="deleteByExample" parameterType="club.joylink.rtss.entity.CompanyExample">
|
<delete id="deleteByExample" parameterType="club.joylink.rtss.entity.CompanyExample">
|
||||||
delete from company
|
delete from company
|
||||||
<if test="_parameter != null">
|
<if test="_parameter != null">
|
||||||
<include refid="Example_Where_Clause" />
|
<include refid="Example_Where_Clause"/>
|
||||||
</if>
|
</if>
|
||||||
</delete>
|
</delete>
|
||||||
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.Company" useGeneratedKeys="true">
|
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.Company"
|
||||||
insert into company (`name`, address, phone
|
useGeneratedKeys="true">
|
||||||
)
|
insert into company (`name`, address, phone,
|
||||||
values (#{name,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}
|
managers)
|
||||||
)
|
values (#{name,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR},
|
||||||
|
#{managers,jdbcType=VARCHAR})
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.Company" useGeneratedKeys="true">
|
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.Company"
|
||||||
insert into company
|
useGeneratedKeys="true">
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
insert into company
|
||||||
<if test="name != null">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
`name`,
|
<if test="name != null">
|
||||||
</if>
|
`name`,
|
||||||
<if test="address != null">
|
</if>
|
||||||
address,
|
<if test="address != null">
|
||||||
</if>
|
address,
|
||||||
<if test="phone != null">
|
</if>
|
||||||
phone,
|
<if test="phone != null">
|
||||||
</if>
|
phone,
|
||||||
</trim>
|
</if>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="managers != null">
|
||||||
<if test="name != null">
|
managers,
|
||||||
#{name,jdbcType=VARCHAR},
|
</if>
|
||||||
</if>
|
</trim>
|
||||||
<if test="address != null">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
#{address,jdbcType=VARCHAR},
|
<if test="name != null">
|
||||||
</if>
|
#{name,jdbcType=VARCHAR},
|
||||||
<if test="phone != null">
|
</if>
|
||||||
#{phone,jdbcType=VARCHAR},
|
<if test="address != null">
|
||||||
</if>
|
#{address,jdbcType=VARCHAR},
|
||||||
</trim>
|
</if>
|
||||||
</insert>
|
<if test="phone != null">
|
||||||
<select id="countByExample" parameterType="club.joylink.rtss.entity.CompanyExample" resultType="java.lang.Long">
|
#{phone,jdbcType=VARCHAR},
|
||||||
select count(*) from company
|
</if>
|
||||||
<if test="_parameter != null">
|
<if test="managers != null">
|
||||||
<include refid="Example_Where_Clause" />
|
#{managers,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</trim>
|
||||||
<update id="updateByExampleSelective" parameterType="map">
|
</insert>
|
||||||
update company
|
<select id="countByExample" parameterType="club.joylink.rtss.entity.CompanyExample" resultType="java.lang.Long">
|
||||||
<set>
|
select count(*) from company
|
||||||
<if test="record.id != null">
|
<if test="_parameter != null">
|
||||||
id = #{record.id,jdbcType=INTEGER},
|
<include refid="Example_Where_Clause"/>
|
||||||
</if>
|
</if>
|
||||||
<if test="record.name != null">
|
</select>
|
||||||
|
<update id="updateByExampleSelective" parameterType="map">
|
||||||
|
update company
|
||||||
|
<set>
|
||||||
|
<if test="record.id != null">
|
||||||
|
id = #{record.id,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="record.name != null">
|
||||||
|
`name` = #{record.name,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="record.address != null">
|
||||||
|
address = #{record.address,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="record.phone != null">
|
||||||
|
phone = #{record.phone,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="record.managers != null">
|
||||||
|
managers = #{record.managers,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
</set>
|
||||||
|
<if test="_parameter != null">
|
||||||
|
<include refid="Update_By_Example_Where_Clause"/>
|
||||||
|
</if>
|
||||||
|
</update>
|
||||||
|
<update id="updateByExample" parameterType="map">
|
||||||
|
update company
|
||||||
|
set id = #{record.id,jdbcType=INTEGER},
|
||||||
`name` = #{record.name,jdbcType=VARCHAR},
|
`name` = #{record.name,jdbcType=VARCHAR},
|
||||||
</if>
|
|
||||||
<if test="record.address != null">
|
|
||||||
address = #{record.address,jdbcType=VARCHAR},
|
address = #{record.address,jdbcType=VARCHAR},
|
||||||
</if>
|
|
||||||
<if test="record.phone != null">
|
|
||||||
phone = #{record.phone,jdbcType=VARCHAR},
|
phone = #{record.phone,jdbcType=VARCHAR},
|
||||||
</if>
|
managers = #{record.managers,jdbcType=VARCHAR}
|
||||||
</set>
|
<if test="_parameter != null">
|
||||||
<if test="_parameter != null">
|
<include refid="Update_By_Example_Where_Clause"/>
|
||||||
<include refid="Update_By_Example_Where_Clause" />
|
</if>
|
||||||
</if>
|
</update>
|
||||||
</update>
|
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.Company">
|
||||||
<update id="updateByExample" parameterType="map">
|
update company
|
||||||
update company
|
<set>
|
||||||
set id = #{record.id,jdbcType=INTEGER},
|
<if test="name != null">
|
||||||
`name` = #{record.name,jdbcType=VARCHAR},
|
`name` = #{name,jdbcType=VARCHAR},
|
||||||
address = #{record.address,jdbcType=VARCHAR},
|
</if>
|
||||||
phone = #{record.phone,jdbcType=VARCHAR}
|
<if test="address != null">
|
||||||
<if test="_parameter != null">
|
address = #{address,jdbcType=VARCHAR},
|
||||||
<include refid="Update_By_Example_Where_Clause" />
|
</if>
|
||||||
</if>
|
<if test="phone != null">
|
||||||
</update>
|
phone = #{phone,jdbcType=VARCHAR},
|
||||||
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.Company">
|
</if>
|
||||||
update company
|
<if test="managers != null">
|
||||||
<set>
|
managers = #{managers,jdbcType=VARCHAR},
|
||||||
<if test="name != null">
|
</if>
|
||||||
`name` = #{name,jdbcType=VARCHAR},
|
</set>
|
||||||
</if>
|
where id = #{id,jdbcType=INTEGER}
|
||||||
<if test="address != null">
|
</update>
|
||||||
address = #{address,jdbcType=VARCHAR},
|
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.Company">
|
||||||
</if>
|
|
||||||
<if test="phone != null">
|
|
||||||
phone = #{phone,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
</set>
|
|
||||||
where id = #{id,jdbcType=INTEGER}
|
|
||||||
</update>
|
|
||||||
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.Company">
|
|
||||||
update company
|
update company
|
||||||
set `name` = #{name,jdbcType=VARCHAR},
|
set `name` = #{name,jdbcType=VARCHAR},
|
||||||
address = #{address,jdbcType=VARCHAR},
|
address = #{address,jdbcType=VARCHAR},
|
||||||
phone = #{phone,jdbcType=VARCHAR}
|
phone = #{phone,jdbcType=VARCHAR},
|
||||||
|
managers = #{managers,jdbcType=VARCHAR}
|
||||||
where id = #{id,jdbcType=INTEGER}
|
where id = #{id,jdbcType=INTEGER}
|
||||||
</update>
|
</update>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
Loading…
Reference in New Issue
Block a user