添加公司管理员
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;
|
||||
|
||||
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.CompanyVO;
|
||||
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.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -58,4 +60,10 @@ public class CompanyController {
|
||||
public CompanyVO get(@PathVariable Integer id, @RequestBody @Validated CompanyVO 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
|
||||
public interface CompanyDAO extends MyBatisBaseDao<Company, Integer, CompanyExample> {
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,11 @@ public class Company implements Serializable {
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 公司管理者
|
||||
*/
|
||||
private String managers;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public Integer getId() {
|
||||
@ -58,6 +63,14 @@ public class Company implements Serializable {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
public String getManagers() {
|
||||
return managers;
|
||||
}
|
||||
|
||||
public void setManagers(String managers) {
|
||||
this.managers = managers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object 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()))
|
||||
&& (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
|
||||
&& (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
|
||||
@ -84,6 +98,7 @@ public class Company implements Serializable {
|
||||
result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
|
||||
result = prime * result + ((getAddress() == null) ? 0 : getAddress().hashCode());
|
||||
result = prime * result + ((getPhone() == null) ? 0 : getPhone().hashCode());
|
||||
result = prime * result + ((getManagers() == null) ? 0 : getManagers().hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -97,8 +112,9 @@ public class Company implements Serializable {
|
||||
sb.append(", name=").append(name);
|
||||
sb.append(", address=").append(address);
|
||||
sb.append(", phone=").append(phone);
|
||||
sb.append(", managers=").append(managers);
|
||||
sb.append(", serialVersionUID=").append(serialVersionUID);
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -393,6 +393,76 @@ public class CompanyExample {
|
||||
addCriterion("phone not between", value1, value2, "phone");
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,8 +3,11 @@ package club.joylink.rtss.services;
|
||||
import club.joylink.rtss.dao.CompanyDAO;
|
||||
import club.joylink.rtss.entity.Company;
|
||||
import club.joylink.rtss.entity.CompanyExample;
|
||||
import club.joylink.rtss.entity.SysUser;
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
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.CompanyVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
@ -16,15 +19,20 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class CompanyService implements ICompanyService {
|
||||
|
||||
@Autowired
|
||||
private CompanyDAO companyDAO;
|
||||
|
||||
@Autowired
|
||||
private IRaceQuestionsRuleService IRaceQuestionsRuleService;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService iSysUserService;
|
||||
|
||||
@Override
|
||||
public List<CompanyVO> queryOrganizations() {
|
||||
CompanyExample example = new CompanyExample();
|
||||
@ -42,7 +50,24 @@ public class CompanyService implements ICompanyService {
|
||||
criteria.andNameLike(String.format("%%%s%%", queryVO.getName()));
|
||||
}
|
||||
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
|
||||
@ -84,4 +109,10 @@ public class CompanyService implements ICompanyService {
|
||||
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;
|
||||
|
||||
import club.joylink.rtss.vo.UserVO;
|
||||
import club.joylink.rtss.vo.client.CompanyQueryVO;
|
||||
import club.joylink.rtss.vo.client.CompanyVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
@ -21,4 +22,9 @@ public interface ICompanyService {
|
||||
boolean isExist(Integer companyId);
|
||||
|
||||
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.client.PageVO;
|
||||
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.wx.WmUserSession;
|
||||
|
||||
@ -278,4 +276,6 @@ public interface ISysUserService {
|
||||
List<UserVO> getUsersWithMobile();
|
||||
|
||||
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());
|
||||
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;
|
||||
|
||||
import club.joylink.rtss.entity.Company;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import club.joylink.rtss.entity.Company;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
@ -29,6 +29,8 @@ public class CompanyVO {
|
||||
/**联系方式*/
|
||||
private String phone = "";
|
||||
|
||||
private List<String> managerNames;
|
||||
|
||||
public CompanyVO(Company entity) {
|
||||
this.id = entity.getId();
|
||||
this.name = entity.getName();
|
||||
@ -44,7 +46,13 @@ public class CompanyVO {
|
||||
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();
|
||||
entity.setId(this.id);
|
||||
entity.setName(this.name);
|
||||
|
@ -1,198 +1,217 @@
|
||||
<?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="club.joylink.rtss.dao.CompanyDAO">
|
||||
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.Company">
|
||||
<id column="id" jdbcType="INTEGER" property="id" />
|
||||
<result column="name" jdbcType="VARCHAR" property="name" />
|
||||
<result column="address" jdbcType="VARCHAR" property="address" />
|
||||
<result column="phone" jdbcType="VARCHAR" property="phone" />
|
||||
</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>
|
||||
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.Company">
|
||||
<id column="id" jdbcType="INTEGER" property="id"/>
|
||||
<result column="name" jdbcType="VARCHAR" property="name"/>
|
||||
<result column="address" jdbcType="VARCHAR" property="address"/>
|
||||
<result column="phone" jdbcType="VARCHAR" property="phone"/>
|
||||
<result column="managers" jdbcType="VARCHAR" property="managers"/>
|
||||
</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>
|
||||
</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>
|
||||
</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>
|
||||
</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>
|
||||
</foreach>
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, `name`, address, phone
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="club.joylink.rtss.entity.CompanyExample" resultMap="BaseResultMap">
|
||||
select
|
||||
<if test="distinct">
|
||||
distinct
|
||||
</if>
|
||||
<include refid="Base_Column_List" />
|
||||
from company
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
<if test="orderByClause != null">
|
||||
order by ${orderByClause}
|
||||
</if>
|
||||
<if test="limit != null">
|
||||
<if test="offset != null">
|
||||
limit ${offset}, ${limit}
|
||||
</if>
|
||||
<if test="offset == null">
|
||||
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">
|
||||
<include refid="Base_Column_List"/>
|
||||
from company
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause"/>
|
||||
</if>
|
||||
<if test="orderByClause != null">
|
||||
order by ${orderByClause}
|
||||
</if>
|
||||
<if test="limit != null">
|
||||
<if test="offset != null">
|
||||
limit ${offset}, ${limit}
|
||||
</if>
|
||||
<if test="offset == null">
|
||||
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
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</delete>
|
||||
<delete id="deleteByExample" parameterType="club.joylink.rtss.entity.CompanyExample">
|
||||
delete from company
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</delete>
|
||||
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.Company" useGeneratedKeys="true">
|
||||
insert into company (`name`, address, phone
|
||||
)
|
||||
values (#{name,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}
|
||||
)
|
||||
<delete id="deleteByExample" parameterType="club.joylink.rtss.entity.CompanyExample">
|
||||
delete from company
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause"/>
|
||||
</if>
|
||||
</delete>
|
||||
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.Company"
|
||||
useGeneratedKeys="true">
|
||||
insert into company (`name`, address, phone,
|
||||
managers)
|
||||
values (#{name,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR},
|
||||
#{managers,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.Company" useGeneratedKeys="true">
|
||||
insert into company
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null">
|
||||
`name`,
|
||||
</if>
|
||||
<if test="address != null">
|
||||
address,
|
||||
</if>
|
||||
<if test="phone != null">
|
||||
phone,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null">
|
||||
#{name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="address != null">
|
||||
#{address,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="phone != null">
|
||||
#{phone,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="club.joylink.rtss.entity.CompanyExample" resultType="java.lang.Long">
|
||||
select count(*) from company
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</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">
|
||||
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.Company"
|
||||
useGeneratedKeys="true">
|
||||
insert into company
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null">
|
||||
`name`,
|
||||
</if>
|
||||
<if test="address != null">
|
||||
address,
|
||||
</if>
|
||||
<if test="phone != null">
|
||||
phone,
|
||||
</if>
|
||||
<if test="managers != null">
|
||||
managers,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null">
|
||||
#{name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="address != null">
|
||||
#{address,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="phone != null">
|
||||
#{phone,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="managers != null">
|
||||
#{managers,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="club.joylink.rtss.entity.CompanyExample" resultType="java.lang.Long">
|
||||
select count(*) from company
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause"/>
|
||||
</if>
|
||||
</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},
|
||||
</if>
|
||||
<if test="record.address != null">
|
||||
address = #{record.address,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.phone != null">
|
||||
phone = #{record.phone,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},
|
||||
address = #{record.address,jdbcType=VARCHAR},
|
||||
phone = #{record.phone,jdbcType=VARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.Company">
|
||||
update company
|
||||
<set>
|
||||
<if test="name != null">
|
||||
`name` = #{name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="address != null">
|
||||
address = #{address,jdbcType=VARCHAR},
|
||||
</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">
|
||||
managers = #{record.managers,jdbcType=VARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause"/>
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.Company">
|
||||
update company
|
||||
<set>
|
||||
<if test="name != null">
|
||||
`name` = #{name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="address != null">
|
||||
address = #{address,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="phone != null">
|
||||
phone = #{phone,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="managers != null">
|
||||
managers = #{managers,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.Company">
|
||||
update company
|
||||
set `name` = #{name,jdbcType=VARCHAR},
|
||||
address = #{address,jdbcType=VARCHAR},
|
||||
phone = #{phone,jdbcType=VARCHAR}
|
||||
phone = #{phone,jdbcType=VARCHAR},
|
||||
managers = #{managers,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
Loading…
Reference in New Issue
Block a user