完成 团油代理商、业务员业务接口

dev-discount
胡锐 3 years ago
parent 9424a0ff90
commit 2af2c1866e
  1. 175
      hai-bweb/src/main/java/com/bweb/controller/HighTyAgentController.java
  2. 190
      hai-bweb/src/main/java/com/bweb/controller/HighTySalesmanController.java
  3. 31
      hai-bweb/src/main/java/com/bweb/controller/LoginController.java
  4. 21
      hai-service/src/main/java/com/hai/common/security/UserCenter.java
  5. 125
      hai-service/src/main/java/com/hai/dao/HighTyAgentMapper.java
  6. 7
      hai-service/src/main/java/com/hai/dao/HighTyAgentMapperExt.java
  7. 130
      hai-service/src/main/java/com/hai/dao/HighTyAgentOilStationMapper.java
  8. 7
      hai-service/src/main/java/com/hai/dao/HighTyAgentOilStationMapperExt.java
  9. 346
      hai-service/src/main/java/com/hai/dao/HighTyAgentOilStationSqlProvider.java
  10. 332
      hai-service/src/main/java/com/hai/dao/HighTyAgentSqlProvider.java
  11. 122
      hai-service/src/main/java/com/hai/dao/HighTySalesmanMapper.java
  12. 7
      hai-service/src/main/java/com/hai/dao/HighTySalesmanMapperExt.java
  13. 318
      hai-service/src/main/java/com/hai/dao/HighTySalesmanSqlProvider.java
  14. 229
      hai-service/src/main/java/com/hai/entity/HighTyAgent.java
  15. 1023
      hai-service/src/main/java/com/hai/entity/HighTyAgentExample.java
  16. 245
      hai-service/src/main/java/com/hai/entity/HighTyAgentOilStation.java
  17. 1063
      hai-service/src/main/java/com/hai/entity/HighTyAgentOilStationExample.java
  18. 213
      hai-service/src/main/java/com/hai/entity/HighTySalesman.java
  19. 943
      hai-service/src/main/java/com/hai/entity/HighTySalesmanExample.java
  20. 41
      hai-service/src/main/java/com/hai/enum_type/UserObjectTypeEnum.java
  21. 20
      hai-service/src/main/java/com/hai/model/UserInfoModel.java
  22. 64
      hai-service/src/main/java/com/hai/service/HighTyAgentService.java
  23. 64
      hai-service/src/main/java/com/hai/service/HighTySalesmanService.java
  24. 182
      hai-service/src/main/java/com/hai/service/impl/HighTyAgentServiceImpl.java
  25. 179
      hai-service/src/main/java/com/hai/service/impl/HighTySalesmanServiceImpl.java

@ -0,0 +1,175 @@
package com.bweb.controller;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.HighTyAgent;
import com.hai.model.ResponseData;
import com.hai.service.HighTyAgentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;
@Controller
@RequestMapping(value = "/tyAgent")
@Api(value = "订单接口")
public class HighTyAgentController {
private static Logger log = LoggerFactory.getLogger(HighTyAgentController.class);
@Resource
private HighTyAgentService tyAgentService;
@RequestMapping(value = "/addAgent", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "增加代理商")
public ResponseData addAgent(@RequestBody JSONObject body, HttpServletRequest request) {
try {
if (StringUtils.isBlank(body.getString("agentName"))
|| StringUtils.isBlank(body.getString("agentUser"))
|| StringUtils.isBlank(body.getString("agentPhone"))
) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQUEST_ERROR, "");
}
HighTyAgent tyAgent = new HighTyAgent();
tyAgent.setAgentName(body.getString("agentName"));
tyAgent.setAgentUser(body.getString("agentUser"));
tyAgent.setAgentPhone(body.getString("agentPhone"));
tyAgent.setAgentAddress(body.getString("agentAddress"));
tyAgentService.addAgent(tyAgent);
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
log.error("HighTyAgentController --> addAgent() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/updateAgent", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "修改代理商")
public ResponseData updateAgent(@RequestBody JSONObject body, HttpServletRequest request) {
try {
if (body.getLong("id") == null
|| StringUtils.isBlank(body.getString("agentName"))
|| StringUtils.isBlank(body.getString("agentUser"))
|| StringUtils.isBlank(body.getString("agentPhone"))
) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQUEST_ERROR, "");
}
// 查询代理商
HighTyAgent tyAgent = tyAgentService.getDetailById(body.getLong("id"));
if (tyAgent == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到代理商信息");
}
tyAgent.setAgentName(body.getString("agentName"));
tyAgent.setAgentUser(body.getString("agentUser"));
tyAgent.setAgentPhone(body.getString("agentPhone"));
tyAgentService.updateAgent(tyAgent);
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
log.error("HighTyAgentController --> updateAgent() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/delAgent", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "删除代理商")
public ResponseData delAgent(@RequestBody JSONObject body, HttpServletRequest request) {
try {
if (StringUtils.isBlank(body.getString("agentKey"))) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQUEST_ERROR, "");
}
tyAgentService.delAgent(body.getString("agentKey"));
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
log.error("HighTyAgentController --> delAgent() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/agentPwdReset", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "代理商密码重置")
public ResponseData agentPwdReset(@RequestBody JSONObject body, HttpServletRequest request) {
try {
if (StringUtils.isBlank(body.getString("agentKey"))) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQUEST_ERROR, "");
}
tyAgentService.agentPwdReset(body.getString("agentKey"));
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
log.error("HighTyAgentController --> updateAgent() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/getDetailByKey", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询代理商详情")
public ResponseData getDetailByKey(@RequestParam(name = "key", required = true) String key) {
try {
return ResponseMsgUtil.success(tyAgentService.getDetailByKey(key));
} catch (Exception e) {
log.error("HighTyAgentController --> getDetailByKey() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/getAgentList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询代理商列表")
public ResponseData getAgentList(@RequestParam(name = "agentKey", required = false) String agentKey,
@RequestParam(name = "agentName", required = false) String agentName,
@RequestParam(name = "agentUser", required = false) String agentUser,
@RequestParam(name = "agentPhone", required = false) String agentPhone,
@RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize) {
try {
Map<String, Object> param = new HashMap<>();
param.put("agentKey", agentKey);
param.put("agentName", agentName);
param.put("agentUser", agentUser);
param.put("agentPhone", agentPhone);
PageHelper.startPage(pageNum,pageSize);
return ResponseMsgUtil.success(new PageInfo<>(tyAgentService.getAgentList(param)));
} catch (Exception e) {
log.error("HighTyAgentController --> getAgentList() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -0,0 +1,190 @@
package com.bweb.controller;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.security.UserCenter;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.HighTyAgent;
import com.hai.entity.HighTySalesman;
import com.hai.enum_type.UserObjectTypeEnum;
import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel;
import com.hai.service.HighTyAgentService;
import com.hai.service.HighTySalesmanService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;
@Controller
@RequestMapping(value = "/tySalesman")
@Api(value = "订单接口")
public class HighTySalesmanController {
private static Logger log = LoggerFactory.getLogger(HighTySalesmanController.class);
@Resource
private HighTySalesmanService tySalesmanService;
@Resource
private HighTyAgentService tyAgentService;
@Resource
private UserCenter userCenter;
@RequestMapping(value = "/addSalesman", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "增加业务员")
public ResponseData addSalesman(@RequestBody JSONObject body, HttpServletRequest request) {
try {
UserInfoModel userModel = userCenter.getSessionModel(UserInfoModel.class);
if (userModel == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.SEC_USER_EXPIRED, "");
}
if (userModel.getHighTyAgent() == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法创建,权限不足");
}
if (StringUtils.isBlank(body.getString("salesmanName"))
|| StringUtils.isBlank(body.getString("salesmanPhone"))) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQUEST_ERROR, "");
}
HighTySalesman tySalesman = new HighTySalesman();
tySalesman.setTyAgentId(userModel.getHighTyAgent().getId());
tySalesman.setSalesmanName(body.getString("salesmanName"));
tySalesman.setSalesmanPhone(body.getString("salesmanPhone"));
tySalesmanService.addSalesman(tySalesman);
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
log.error("HighTySalesmanController --> addSalesman() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/updateSalesman", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "修改业务员")
public ResponseData updateSalesman(@RequestBody JSONObject body, HttpServletRequest request) {
try {
UserInfoModel userModel = userCenter.getSessionModel(UserInfoModel.class);
if (userModel == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.SEC_USER_EXPIRED, "");
}
if (!userModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type6.getType())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法修改,权限不足");
}
if (body.getLong("id") == null
|| StringUtils.isBlank(body.getString("salesmanName"))
|| StringUtils.isBlank(body.getString("salesmanPhone"))
) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQUEST_ERROR, "");
}
// 查询代理商
HighTySalesman salesman = tySalesmanService.getDetailById(body.getLong("id"));
if (salesman == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到代理商信息");
}
salesman.setSalesmanName(body.getString("salesmanName"));
salesman.setSalesmanPhone(body.getString("salesmanPhone"));
tySalesmanService.updateSalesman(salesman);
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
log.error("HighTySalesmanController --> updateSalesman() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/delSalesman", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "删除业务员")
public ResponseData delSalesman(@RequestBody JSONObject body, HttpServletRequest request) {
try {
if (StringUtils.isBlank(body.getString("salesmanKey"))) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQUEST_ERROR, "");
}
tySalesmanService.delSalesman(body.getString("salesmanKey"));
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
log.error("HighTyAgentController --> delSalesman() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/salesmanPwdReset", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "业务员密码重置")
public ResponseData salesmanPwdReset(@RequestBody JSONObject body, HttpServletRequest request) {
try {
if (StringUtils.isBlank(body.getString("salesmanKey"))) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQUEST_ERROR, "");
}
tySalesmanService.salesmanPwdReset(body.getString("salesmanKey"));
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
log.error("HighTyAgentController --> salesmanPwdReset() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/getDetailByKey", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询业务员详情")
public ResponseData getDetailByKey(@RequestParam(name = "key", required = true) String key) {
try {
return ResponseMsgUtil.success(tySalesmanService.getDetailByKey(key));
} catch (Exception e) {
log.error("HighTySalesmanController --> getDetailByKey() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/getSalesmanList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询业务员列表")
public ResponseData getSalesmanList(@RequestParam(name = "tyAgentId", required = true) Long tyAgentId,
@RequestParam(name = "salesmanKey", required = false) String salesmanKey,
@RequestParam(name = "salesmanName", required = false) String salesmanName,
@RequestParam(name = "salesmanPhone", required = false) String salesmanPhone,
@RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize) {
try {
Map<String, Object> param = new HashMap<>();
param.put("tyAgentId", tyAgentId);
param.put("salesmanKey", salesmanKey);
param.put("salesmanName", salesmanName);
param.put("salesmanPhone", salesmanPhone);
PageHelper.startPage(pageNum, pageSize);
return ResponseMsgUtil.success(new PageInfo<>(tySalesmanService.getSalesmanList(param)));
} catch (Exception e) {
log.error("HighTySalesmanController --> getSalesmanList() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -59,6 +59,12 @@ public class LoginController {
@Resource
private SecPermissionService secPermissionService;
@Resource
private HighTyAgentService tyAgentService;
@Resource
private HighTySalesmanService tySalesmanService;
@Resource
private HighAgentService highAgentService;
@ -174,6 +180,31 @@ public class LoginController {
} else if (secUser.getObjectType() == 5) {
// 查询管理人员
} else if (secUser.getObjectType() == 6) {
// 查询团油代理商
HighTyAgent tyAgent = tyAgentService.getDetailById(secUser.getObjectId());
if (tyAgent == null) {
log.error("login error!","未找到代理商");
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_AGENT, "未找到代理商");
}
if (!tyAgent.getStatus().equals(1)) {
log.error("login error!","代理商状态错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_AGENT, "代理商状态错误");
}
userInfoModel.setHighTyAgent(tyAgent);
} else if (secUser.getObjectType() == 7) {
// 查询团油业务员
HighTySalesman tySalesman = tySalesmanService.getDetailById(secUser.getObjectId());
if (tySalesman == null) {
log.error("login error!","未找到业务员");
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_AGENT, "未找到业务员");
}
if (!tySalesman.getStatus().equals(1)) {
log.error("login error!","业务员状态错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_AGENT, "业务员状态错误");
}
userInfoModel.setHighTySalesman(tySalesman);
} else {
log.error("login error!","用户信息错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.SEC_USER_EXPIRED, "");

@ -9,6 +9,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
@ -92,7 +94,22 @@ public class UserCenter {
return cookie.getValue();
}
public SessionObject getSessionObject(HttpServletRequest request) throws Exception{
public <E> E getSessionModel(Class<E> clazz){
if (RequestContextHolder.getRequestAttributes()!=null) {
HttpServletRequest req = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
SessionObject sessionObject = getSessionObject(req);
if (sessionObject == null){
return null;
}
if (clazz.equals(sessionObject.getObject().getClass())){
return (E)sessionObject.getObject();
}
}
return null;
}
public SessionObject getSessionObject(HttpServletRequest request) {
String token = request.getHeader("Authorization");
if (StringUtils.isBlank(token)) {
if (StringUtils.isNotBlank(read(request))) {
@ -145,9 +162,9 @@ public class UserCenter {
CookieUtil.delCookie(response, COOKIE_FIELD);
}
}
}
}
}

@ -0,0 +1,125 @@
package com.hai.dao;
import com.hai.entity.HighTyAgent;
import com.hai.entity.HighTyAgentExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;
import org.springframework.stereotype.Repository;
/**
*
* 代码由工具生成,请勿修改!!!
* 如果需要扩展请在其父类进行扩展
*
**/
@Repository
public interface HighTyAgentMapper extends HighTyAgentMapperExt {
@SelectProvider(type=HighTyAgentSqlProvider.class, method="countByExample")
long countByExample(HighTyAgentExample example);
@DeleteProvider(type=HighTyAgentSqlProvider.class, method="deleteByExample")
int deleteByExample(HighTyAgentExample example);
@Delete({
"delete from high_ty_agent",
"where id = #{id,jdbcType=BIGINT}"
})
int deleteByPrimaryKey(Long id);
@Insert({
"insert into high_ty_agent (agent_key, agent_name, ",
"agent_address, agent_user, ",
"agent_phone, `status`, ",
"create_time, update_time, ",
"ext_1, ext_2, ext_3)",
"values (#{agentKey,jdbcType=VARCHAR}, #{agentName,jdbcType=VARCHAR}, ",
"#{agentAddress,jdbcType=VARCHAR}, #{agentUser,jdbcType=VARCHAR}, ",
"#{agentPhone,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, ",
"#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ",
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
})
@Options(useGeneratedKeys=true,keyProperty="id")
int insert(HighTyAgent record);
@InsertProvider(type=HighTyAgentSqlProvider.class, method="insertSelective")
@Options(useGeneratedKeys=true,keyProperty="id")
int insertSelective(HighTyAgent record);
@SelectProvider(type=HighTyAgentSqlProvider.class, method="selectByExample")
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="agent_key", property="agentKey", jdbcType=JdbcType.VARCHAR),
@Result(column="agent_name", property="agentName", jdbcType=JdbcType.VARCHAR),
@Result(column="agent_address", property="agentAddress", jdbcType=JdbcType.VARCHAR),
@Result(column="agent_user", property="agentUser", jdbcType=JdbcType.VARCHAR),
@Result(column="agent_phone", property="agentPhone", jdbcType=JdbcType.VARCHAR),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR)
})
List<HighTyAgent> selectByExample(HighTyAgentExample example);
@Select({
"select",
"id, agent_key, agent_name, agent_address, agent_user, agent_phone, `status`, ",
"create_time, update_time, ext_1, ext_2, ext_3",
"from high_ty_agent",
"where id = #{id,jdbcType=BIGINT}"
})
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="agent_key", property="agentKey", jdbcType=JdbcType.VARCHAR),
@Result(column="agent_name", property="agentName", jdbcType=JdbcType.VARCHAR),
@Result(column="agent_address", property="agentAddress", jdbcType=JdbcType.VARCHAR),
@Result(column="agent_user", property="agentUser", jdbcType=JdbcType.VARCHAR),
@Result(column="agent_phone", property="agentPhone", jdbcType=JdbcType.VARCHAR),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR)
})
HighTyAgent selectByPrimaryKey(Long id);
@UpdateProvider(type=HighTyAgentSqlProvider.class, method="updateByExampleSelective")
int updateByExampleSelective(@Param("record") HighTyAgent record, @Param("example") HighTyAgentExample example);
@UpdateProvider(type=HighTyAgentSqlProvider.class, method="updateByExample")
int updateByExample(@Param("record") HighTyAgent record, @Param("example") HighTyAgentExample example);
@UpdateProvider(type=HighTyAgentSqlProvider.class, method="updateByPrimaryKeySelective")
int updateByPrimaryKeySelective(HighTyAgent record);
@Update({
"update high_ty_agent",
"set agent_key = #{agentKey,jdbcType=VARCHAR},",
"agent_name = #{agentName,jdbcType=VARCHAR},",
"agent_address = #{agentAddress,jdbcType=VARCHAR},",
"agent_user = #{agentUser,jdbcType=VARCHAR},",
"agent_phone = #{agentPhone,jdbcType=VARCHAR},",
"`status` = #{status,jdbcType=INTEGER},",
"create_time = #{createTime,jdbcType=TIMESTAMP},",
"update_time = #{updateTime,jdbcType=TIMESTAMP},",
"ext_1 = #{ext1,jdbcType=VARCHAR},",
"ext_2 = #{ext2,jdbcType=VARCHAR},",
"ext_3 = #{ext3,jdbcType=VARCHAR}",
"where id = #{id,jdbcType=BIGINT}"
})
int updateByPrimaryKey(HighTyAgent record);
}

@ -0,0 +1,7 @@
package com.hai.dao;
/**
* mapper扩展类
*/
public interface HighTyAgentMapperExt {
}

@ -0,0 +1,130 @@
package com.hai.dao;
import com.hai.entity.HighTyAgentOilStation;
import com.hai.entity.HighTyAgentOilStationExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;
import org.springframework.stereotype.Repository;
/**
*
* 代码由工具生成,请勿修改!!!
* 如果需要扩展请在其父类进行扩展
*
**/
@Repository
public interface HighTyAgentOilStationMapper extends HighTyAgentOilStationMapperExt {
@SelectProvider(type=HighTyAgentOilStationSqlProvider.class, method="countByExample")
long countByExample(HighTyAgentOilStationExample example);
@DeleteProvider(type=HighTyAgentOilStationSqlProvider.class, method="deleteByExample")
int deleteByExample(HighTyAgentOilStationExample example);
@Delete({
"delete from high_ty_agent_oil_station",
"where id = #{id,jdbcType=BIGINT}"
})
int deleteByPrimaryKey(Long id);
@Insert({
"insert into high_ty_agent_oil_station (ty_agent_id, ty_agent_name, ",
"ty_salesman_id, ty_salesman_name, ",
"oil_station_id, oil_station_name, ",
"`status`, create_time, ",
"update_time, ext_1, ",
"ext_2, ext_3)",
"values (#{tyAgentId,jdbcType=BIGINT}, #{tyAgentName,jdbcType=VARCHAR}, ",
"#{tySalesmanId,jdbcType=BIGINT}, #{tySalesmanName,jdbcType=VARCHAR}, ",
"#{oilStationId,jdbcType=BIGINT}, #{oilStationName,jdbcType=VARCHAR}, ",
"#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ",
"#{updateTime,jdbcType=TIMESTAMP}, #{ext1,jdbcType=VARCHAR}, ",
"#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
})
@Options(useGeneratedKeys=true,keyProperty="id")
int insert(HighTyAgentOilStation record);
@InsertProvider(type=HighTyAgentOilStationSqlProvider.class, method="insertSelective")
@Options(useGeneratedKeys=true,keyProperty="id")
int insertSelective(HighTyAgentOilStation record);
@SelectProvider(type=HighTyAgentOilStationSqlProvider.class, method="selectByExample")
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="ty_agent_id", property="tyAgentId", jdbcType=JdbcType.BIGINT),
@Result(column="ty_agent_name", property="tyAgentName", jdbcType=JdbcType.VARCHAR),
@Result(column="ty_salesman_id", property="tySalesmanId", jdbcType=JdbcType.BIGINT),
@Result(column="ty_salesman_name", property="tySalesmanName", jdbcType=JdbcType.VARCHAR),
@Result(column="oil_station_id", property="oilStationId", jdbcType=JdbcType.BIGINT),
@Result(column="oil_station_name", property="oilStationName", jdbcType=JdbcType.VARCHAR),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR)
})
List<HighTyAgentOilStation> selectByExample(HighTyAgentOilStationExample example);
@Select({
"select",
"id, ty_agent_id, ty_agent_name, ty_salesman_id, ty_salesman_name, oil_station_id, ",
"oil_station_name, `status`, create_time, update_time, ext_1, ext_2, ext_3",
"from high_ty_agent_oil_station",
"where id = #{id,jdbcType=BIGINT}"
})
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="ty_agent_id", property="tyAgentId", jdbcType=JdbcType.BIGINT),
@Result(column="ty_agent_name", property="tyAgentName", jdbcType=JdbcType.VARCHAR),
@Result(column="ty_salesman_id", property="tySalesmanId", jdbcType=JdbcType.BIGINT),
@Result(column="ty_salesman_name", property="tySalesmanName", jdbcType=JdbcType.VARCHAR),
@Result(column="oil_station_id", property="oilStationId", jdbcType=JdbcType.BIGINT),
@Result(column="oil_station_name", property="oilStationName", jdbcType=JdbcType.VARCHAR),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR)
})
HighTyAgentOilStation selectByPrimaryKey(Long id);
@UpdateProvider(type=HighTyAgentOilStationSqlProvider.class, method="updateByExampleSelective")
int updateByExampleSelective(@Param("record") HighTyAgentOilStation record, @Param("example") HighTyAgentOilStationExample example);
@UpdateProvider(type=HighTyAgentOilStationSqlProvider.class, method="updateByExample")
int updateByExample(@Param("record") HighTyAgentOilStation record, @Param("example") HighTyAgentOilStationExample example);
@UpdateProvider(type=HighTyAgentOilStationSqlProvider.class, method="updateByPrimaryKeySelective")
int updateByPrimaryKeySelective(HighTyAgentOilStation record);
@Update({
"update high_ty_agent_oil_station",
"set ty_agent_id = #{tyAgentId,jdbcType=BIGINT},",
"ty_agent_name = #{tyAgentName,jdbcType=VARCHAR},",
"ty_salesman_id = #{tySalesmanId,jdbcType=BIGINT},",
"ty_salesman_name = #{tySalesmanName,jdbcType=VARCHAR},",
"oil_station_id = #{oilStationId,jdbcType=BIGINT},",
"oil_station_name = #{oilStationName,jdbcType=VARCHAR},",
"`status` = #{status,jdbcType=INTEGER},",
"create_time = #{createTime,jdbcType=TIMESTAMP},",
"update_time = #{updateTime,jdbcType=TIMESTAMP},",
"ext_1 = #{ext1,jdbcType=VARCHAR},",
"ext_2 = #{ext2,jdbcType=VARCHAR},",
"ext_3 = #{ext3,jdbcType=VARCHAR}",
"where id = #{id,jdbcType=BIGINT}"
})
int updateByPrimaryKey(HighTyAgentOilStation record);
}

@ -0,0 +1,7 @@
package com.hai.dao;
/**
* mapper扩展类
*/
public interface HighTyAgentOilStationMapperExt {
}

@ -0,0 +1,346 @@
package com.hai.dao;
import com.hai.entity.HighTyAgentOilStation;
import com.hai.entity.HighTyAgentOilStationExample.Criteria;
import com.hai.entity.HighTyAgentOilStationExample.Criterion;
import com.hai.entity.HighTyAgentOilStationExample;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.jdbc.SQL;
public class HighTyAgentOilStationSqlProvider {
public String countByExample(HighTyAgentOilStationExample example) {
SQL sql = new SQL();
sql.SELECT("count(*)").FROM("high_ty_agent_oil_station");
applyWhere(sql, example, false);
return sql.toString();
}
public String deleteByExample(HighTyAgentOilStationExample example) {
SQL sql = new SQL();
sql.DELETE_FROM("high_ty_agent_oil_station");
applyWhere(sql, example, false);
return sql.toString();
}
public String insertSelective(HighTyAgentOilStation record) {
SQL sql = new SQL();
sql.INSERT_INTO("high_ty_agent_oil_station");
if (record.getTyAgentId() != null) {
sql.VALUES("ty_agent_id", "#{tyAgentId,jdbcType=BIGINT}");
}
if (record.getTyAgentName() != null) {
sql.VALUES("ty_agent_name", "#{tyAgentName,jdbcType=VARCHAR}");
}
if (record.getTySalesmanId() != null) {
sql.VALUES("ty_salesman_id", "#{tySalesmanId,jdbcType=BIGINT}");
}
if (record.getTySalesmanName() != null) {
sql.VALUES("ty_salesman_name", "#{tySalesmanName,jdbcType=VARCHAR}");
}
if (record.getOilStationId() != null) {
sql.VALUES("oil_station_id", "#{oilStationId,jdbcType=BIGINT}");
}
if (record.getOilStationName() != null) {
sql.VALUES("oil_station_name", "#{oilStationName,jdbcType=VARCHAR}");
}
if (record.getStatus() != null) {
sql.VALUES("`status`", "#{status,jdbcType=INTEGER}");
}
if (record.getCreateTime() != null) {
sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}");
}
if (record.getUpdateTime() != null) {
sql.VALUES("update_time", "#{updateTime,jdbcType=TIMESTAMP}");
}
if (record.getExt1() != null) {
sql.VALUES("ext_1", "#{ext1,jdbcType=VARCHAR}");
}
if (record.getExt2() != null) {
sql.VALUES("ext_2", "#{ext2,jdbcType=VARCHAR}");
}
if (record.getExt3() != null) {
sql.VALUES("ext_3", "#{ext3,jdbcType=VARCHAR}");
}
return sql.toString();
}
public String selectByExample(HighTyAgentOilStationExample example) {
SQL sql = new SQL();
if (example != null && example.isDistinct()) {
sql.SELECT_DISTINCT("id");
} else {
sql.SELECT("id");
}
sql.SELECT("ty_agent_id");
sql.SELECT("ty_agent_name");
sql.SELECT("ty_salesman_id");
sql.SELECT("ty_salesman_name");
sql.SELECT("oil_station_id");
sql.SELECT("oil_station_name");
sql.SELECT("`status`");
sql.SELECT("create_time");
sql.SELECT("update_time");
sql.SELECT("ext_1");
sql.SELECT("ext_2");
sql.SELECT("ext_3");
sql.FROM("high_ty_agent_oil_station");
applyWhere(sql, example, false);
if (example != null && example.getOrderByClause() != null) {
sql.ORDER_BY(example.getOrderByClause());
}
return sql.toString();
}
public String updateByExampleSelective(Map<String, Object> parameter) {
HighTyAgentOilStation record = (HighTyAgentOilStation) parameter.get("record");
HighTyAgentOilStationExample example = (HighTyAgentOilStationExample) parameter.get("example");
SQL sql = new SQL();
sql.UPDATE("high_ty_agent_oil_station");
if (record.getId() != null) {
sql.SET("id = #{record.id,jdbcType=BIGINT}");
}
if (record.getTyAgentId() != null) {
sql.SET("ty_agent_id = #{record.tyAgentId,jdbcType=BIGINT}");
}
if (record.getTyAgentName() != null) {
sql.SET("ty_agent_name = #{record.tyAgentName,jdbcType=VARCHAR}");
}
if (record.getTySalesmanId() != null) {
sql.SET("ty_salesman_id = #{record.tySalesmanId,jdbcType=BIGINT}");
}
if (record.getTySalesmanName() != null) {
sql.SET("ty_salesman_name = #{record.tySalesmanName,jdbcType=VARCHAR}");
}
if (record.getOilStationId() != null) {
sql.SET("oil_station_id = #{record.oilStationId,jdbcType=BIGINT}");
}
if (record.getOilStationName() != null) {
sql.SET("oil_station_name = #{record.oilStationName,jdbcType=VARCHAR}");
}
if (record.getStatus() != null) {
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
}
if (record.getCreateTime() != null) {
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
}
if (record.getUpdateTime() != null) {
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}");
}
if (record.getExt1() != null) {
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}");
}
if (record.getExt2() != null) {
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}");
}
if (record.getExt3() != null) {
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}");
}
applyWhere(sql, example, true);
return sql.toString();
}
public String updateByExample(Map<String, Object> parameter) {
SQL sql = new SQL();
sql.UPDATE("high_ty_agent_oil_station");
sql.SET("id = #{record.id,jdbcType=BIGINT}");
sql.SET("ty_agent_id = #{record.tyAgentId,jdbcType=BIGINT}");
sql.SET("ty_agent_name = #{record.tyAgentName,jdbcType=VARCHAR}");
sql.SET("ty_salesman_id = #{record.tySalesmanId,jdbcType=BIGINT}");
sql.SET("ty_salesman_name = #{record.tySalesmanName,jdbcType=VARCHAR}");
sql.SET("oil_station_id = #{record.oilStationId,jdbcType=BIGINT}");
sql.SET("oil_station_name = #{record.oilStationName,jdbcType=VARCHAR}");
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}");
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}");
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}");
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}");
HighTyAgentOilStationExample example = (HighTyAgentOilStationExample) parameter.get("example");
applyWhere(sql, example, true);
return sql.toString();
}
public String updateByPrimaryKeySelective(HighTyAgentOilStation record) {
SQL sql = new SQL();
sql.UPDATE("high_ty_agent_oil_station");
if (record.getTyAgentId() != null) {
sql.SET("ty_agent_id = #{tyAgentId,jdbcType=BIGINT}");
}
if (record.getTyAgentName() != null) {
sql.SET("ty_agent_name = #{tyAgentName,jdbcType=VARCHAR}");
}
if (record.getTySalesmanId() != null) {
sql.SET("ty_salesman_id = #{tySalesmanId,jdbcType=BIGINT}");
}
if (record.getTySalesmanName() != null) {
sql.SET("ty_salesman_name = #{tySalesmanName,jdbcType=VARCHAR}");
}
if (record.getOilStationId() != null) {
sql.SET("oil_station_id = #{oilStationId,jdbcType=BIGINT}");
}
if (record.getOilStationName() != null) {
sql.SET("oil_station_name = #{oilStationName,jdbcType=VARCHAR}");
}
if (record.getStatus() != null) {
sql.SET("`status` = #{status,jdbcType=INTEGER}");
}
if (record.getCreateTime() != null) {
sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}");
}
if (record.getUpdateTime() != null) {
sql.SET("update_time = #{updateTime,jdbcType=TIMESTAMP}");
}
if (record.getExt1() != null) {
sql.SET("ext_1 = #{ext1,jdbcType=VARCHAR}");
}
if (record.getExt2() != null) {
sql.SET("ext_2 = #{ext2,jdbcType=VARCHAR}");
}
if (record.getExt3() != null) {
sql.SET("ext_3 = #{ext3,jdbcType=VARCHAR}");
}
sql.WHERE("id = #{id,jdbcType=BIGINT}");
return sql.toString();
}
protected void applyWhere(SQL sql, HighTyAgentOilStationExample example, boolean includeExamplePhrase) {
if (example == null) {
return;
}
String parmPhrase1;
String parmPhrase1_th;
String parmPhrase2;
String parmPhrase2_th;
String parmPhrase3;
String parmPhrase3_th;
if (includeExamplePhrase) {
parmPhrase1 = "%s #{example.oredCriteria[%d].allCriteria[%d].value}";
parmPhrase1_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}";
parmPhrase2 = "%s #{example.oredCriteria[%d].allCriteria[%d].value} and #{example.oredCriteria[%d].criteria[%d].secondValue}";
parmPhrase2_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{example.oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}";
parmPhrase3 = "#{example.oredCriteria[%d].allCriteria[%d].value[%d]}";
parmPhrase3_th = "#{example.oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}";
} else {
parmPhrase1 = "%s #{oredCriteria[%d].allCriteria[%d].value}";
parmPhrase1_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}";
parmPhrase2 = "%s #{oredCriteria[%d].allCriteria[%d].value} and #{oredCriteria[%d].criteria[%d].secondValue}";
parmPhrase2_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}";
parmPhrase3 = "#{oredCriteria[%d].allCriteria[%d].value[%d]}";
parmPhrase3_th = "#{oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}";
}
StringBuilder sb = new StringBuilder();
List<Criteria> oredCriteria = example.getOredCriteria();
boolean firstCriteria = true;
for (int i = 0; i < oredCriteria.size(); i++) {
Criteria criteria = oredCriteria.get(i);
if (criteria.isValid()) {
if (firstCriteria) {
firstCriteria = false;
} else {
sb.append(" or ");
}
sb.append('(');
List<Criterion> criterions = criteria.getAllCriteria();
boolean firstCriterion = true;
for (int j = 0; j < criterions.size(); j++) {
Criterion criterion = criterions.get(j);
if (firstCriterion) {
firstCriterion = false;
} else {
sb.append(" and ");
}
if (criterion.isNoValue()) {
sb.append(criterion.getCondition());
} else if (criterion.isSingleValue()) {
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase1, criterion.getCondition(), i, j));
} else {
sb.append(String.format(parmPhrase1_th, criterion.getCondition(), i, j,criterion.getTypeHandler()));
}
} else if (criterion.isBetweenValue()) {
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase2, criterion.getCondition(), i, j, i, j));
} else {
sb.append(String.format(parmPhrase2_th, criterion.getCondition(), i, j, criterion.getTypeHandler(), i, j, criterion.getTypeHandler()));
}
} else if (criterion.isListValue()) {
sb.append(criterion.getCondition());
sb.append(" (");
List<?> listItems = (List<?>) criterion.getValue();
boolean comma = false;
for (int k = 0; k < listItems.size(); k++) {
if (comma) {
sb.append(", ");
} else {
comma = true;
}
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase3, i, j, k));
} else {
sb.append(String.format(parmPhrase3_th, i, j, k, criterion.getTypeHandler()));
}
}
sb.append(')');
}
}
sb.append(')');
}
}
if (sb.length() > 0) {
sql.WHERE(sb.toString());
}
}
}

@ -0,0 +1,332 @@
package com.hai.dao;
import com.hai.entity.HighTyAgent;
import com.hai.entity.HighTyAgentExample.Criteria;
import com.hai.entity.HighTyAgentExample.Criterion;
import com.hai.entity.HighTyAgentExample;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.jdbc.SQL;
public class HighTyAgentSqlProvider {
public String countByExample(HighTyAgentExample example) {
SQL sql = new SQL();
sql.SELECT("count(*)").FROM("high_ty_agent");
applyWhere(sql, example, false);
return sql.toString();
}
public String deleteByExample(HighTyAgentExample example) {
SQL sql = new SQL();
sql.DELETE_FROM("high_ty_agent");
applyWhere(sql, example, false);
return sql.toString();
}
public String insertSelective(HighTyAgent record) {
SQL sql = new SQL();
sql.INSERT_INTO("high_ty_agent");
if (record.getAgentKey() != null) {
sql.VALUES("agent_key", "#{agentKey,jdbcType=VARCHAR}");
}
if (record.getAgentName() != null) {
sql.VALUES("agent_name", "#{agentName,jdbcType=VARCHAR}");
}
if (record.getAgentAddress() != null) {
sql.VALUES("agent_address", "#{agentAddress,jdbcType=VARCHAR}");
}
if (record.getAgentUser() != null) {
sql.VALUES("agent_user", "#{agentUser,jdbcType=VARCHAR}");
}
if (record.getAgentPhone() != null) {
sql.VALUES("agent_phone", "#{agentPhone,jdbcType=VARCHAR}");
}
if (record.getStatus() != null) {
sql.VALUES("`status`", "#{status,jdbcType=INTEGER}");
}
if (record.getCreateTime() != null) {
sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}");
}
if (record.getUpdateTime() != null) {
sql.VALUES("update_time", "#{updateTime,jdbcType=TIMESTAMP}");
}
if (record.getExt1() != null) {
sql.VALUES("ext_1", "#{ext1,jdbcType=VARCHAR}");
}
if (record.getExt2() != null) {
sql.VALUES("ext_2", "#{ext2,jdbcType=VARCHAR}");
}
if (record.getExt3() != null) {
sql.VALUES("ext_3", "#{ext3,jdbcType=VARCHAR}");
}
return sql.toString();
}
public String selectByExample(HighTyAgentExample example) {
SQL sql = new SQL();
if (example != null && example.isDistinct()) {
sql.SELECT_DISTINCT("id");
} else {
sql.SELECT("id");
}
sql.SELECT("agent_key");
sql.SELECT("agent_name");
sql.SELECT("agent_address");
sql.SELECT("agent_user");
sql.SELECT("agent_phone");
sql.SELECT("`status`");
sql.SELECT("create_time");
sql.SELECT("update_time");
sql.SELECT("ext_1");
sql.SELECT("ext_2");
sql.SELECT("ext_3");
sql.FROM("high_ty_agent");
applyWhere(sql, example, false);
if (example != null && example.getOrderByClause() != null) {
sql.ORDER_BY(example.getOrderByClause());
}
return sql.toString();
}
public String updateByExampleSelective(Map<String, Object> parameter) {
HighTyAgent record = (HighTyAgent) parameter.get("record");
HighTyAgentExample example = (HighTyAgentExample) parameter.get("example");
SQL sql = new SQL();
sql.UPDATE("high_ty_agent");
if (record.getId() != null) {
sql.SET("id = #{record.id,jdbcType=BIGINT}");
}
if (record.getAgentKey() != null) {
sql.SET("agent_key = #{record.agentKey,jdbcType=VARCHAR}");
}
if (record.getAgentName() != null) {
sql.SET("agent_name = #{record.agentName,jdbcType=VARCHAR}");
}
if (record.getAgentAddress() != null) {
sql.SET("agent_address = #{record.agentAddress,jdbcType=VARCHAR}");
}
if (record.getAgentUser() != null) {
sql.SET("agent_user = #{record.agentUser,jdbcType=VARCHAR}");
}
if (record.getAgentPhone() != null) {
sql.SET("agent_phone = #{record.agentPhone,jdbcType=VARCHAR}");
}
if (record.getStatus() != null) {
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
}
if (record.getCreateTime() != null) {
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
}
if (record.getUpdateTime() != null) {
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}");
}
if (record.getExt1() != null) {
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}");
}
if (record.getExt2() != null) {
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}");
}
if (record.getExt3() != null) {
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}");
}
applyWhere(sql, example, true);
return sql.toString();
}
public String updateByExample(Map<String, Object> parameter) {
SQL sql = new SQL();
sql.UPDATE("high_ty_agent");
sql.SET("id = #{record.id,jdbcType=BIGINT}");
sql.SET("agent_key = #{record.agentKey,jdbcType=VARCHAR}");
sql.SET("agent_name = #{record.agentName,jdbcType=VARCHAR}");
sql.SET("agent_address = #{record.agentAddress,jdbcType=VARCHAR}");
sql.SET("agent_user = #{record.agentUser,jdbcType=VARCHAR}");
sql.SET("agent_phone = #{record.agentPhone,jdbcType=VARCHAR}");
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}");
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}");
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}");
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}");
HighTyAgentExample example = (HighTyAgentExample) parameter.get("example");
applyWhere(sql, example, true);
return sql.toString();
}
public String updateByPrimaryKeySelective(HighTyAgent record) {
SQL sql = new SQL();
sql.UPDATE("high_ty_agent");
if (record.getAgentKey() != null) {
sql.SET("agent_key = #{agentKey,jdbcType=VARCHAR}");
}
if (record.getAgentName() != null) {
sql.SET("agent_name = #{agentName,jdbcType=VARCHAR}");
}
if (record.getAgentAddress() != null) {
sql.SET("agent_address = #{agentAddress,jdbcType=VARCHAR}");
}
if (record.getAgentUser() != null) {
sql.SET("agent_user = #{agentUser,jdbcType=VARCHAR}");
}
if (record.getAgentPhone() != null) {
sql.SET("agent_phone = #{agentPhone,jdbcType=VARCHAR}");
}
if (record.getStatus() != null) {
sql.SET("`status` = #{status,jdbcType=INTEGER}");
}
if (record.getCreateTime() != null) {
sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}");
}
if (record.getUpdateTime() != null) {
sql.SET("update_time = #{updateTime,jdbcType=TIMESTAMP}");
}
if (record.getExt1() != null) {
sql.SET("ext_1 = #{ext1,jdbcType=VARCHAR}");
}
if (record.getExt2() != null) {
sql.SET("ext_2 = #{ext2,jdbcType=VARCHAR}");
}
if (record.getExt3() != null) {
sql.SET("ext_3 = #{ext3,jdbcType=VARCHAR}");
}
sql.WHERE("id = #{id,jdbcType=BIGINT}");
return sql.toString();
}
protected void applyWhere(SQL sql, HighTyAgentExample example, boolean includeExamplePhrase) {
if (example == null) {
return;
}
String parmPhrase1;
String parmPhrase1_th;
String parmPhrase2;
String parmPhrase2_th;
String parmPhrase3;
String parmPhrase3_th;
if (includeExamplePhrase) {
parmPhrase1 = "%s #{example.oredCriteria[%d].allCriteria[%d].value}";
parmPhrase1_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}";
parmPhrase2 = "%s #{example.oredCriteria[%d].allCriteria[%d].value} and #{example.oredCriteria[%d].criteria[%d].secondValue}";
parmPhrase2_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{example.oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}";
parmPhrase3 = "#{example.oredCriteria[%d].allCriteria[%d].value[%d]}";
parmPhrase3_th = "#{example.oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}";
} else {
parmPhrase1 = "%s #{oredCriteria[%d].allCriteria[%d].value}";
parmPhrase1_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}";
parmPhrase2 = "%s #{oredCriteria[%d].allCriteria[%d].value} and #{oredCriteria[%d].criteria[%d].secondValue}";
parmPhrase2_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}";
parmPhrase3 = "#{oredCriteria[%d].allCriteria[%d].value[%d]}";
parmPhrase3_th = "#{oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}";
}
StringBuilder sb = new StringBuilder();
List<Criteria> oredCriteria = example.getOredCriteria();
boolean firstCriteria = true;
for (int i = 0; i < oredCriteria.size(); i++) {
Criteria criteria = oredCriteria.get(i);
if (criteria.isValid()) {
if (firstCriteria) {
firstCriteria = false;
} else {
sb.append(" or ");
}
sb.append('(');
List<Criterion> criterions = criteria.getAllCriteria();
boolean firstCriterion = true;
for (int j = 0; j < criterions.size(); j++) {
Criterion criterion = criterions.get(j);
if (firstCriterion) {
firstCriterion = false;
} else {
sb.append(" and ");
}
if (criterion.isNoValue()) {
sb.append(criterion.getCondition());
} else if (criterion.isSingleValue()) {
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase1, criterion.getCondition(), i, j));
} else {
sb.append(String.format(parmPhrase1_th, criterion.getCondition(), i, j,criterion.getTypeHandler()));
}
} else if (criterion.isBetweenValue()) {
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase2, criterion.getCondition(), i, j, i, j));
} else {
sb.append(String.format(parmPhrase2_th, criterion.getCondition(), i, j, criterion.getTypeHandler(), i, j, criterion.getTypeHandler()));
}
} else if (criterion.isListValue()) {
sb.append(criterion.getCondition());
sb.append(" (");
List<?> listItems = (List<?>) criterion.getValue();
boolean comma = false;
for (int k = 0; k < listItems.size(); k++) {
if (comma) {
sb.append(", ");
} else {
comma = true;
}
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase3, i, j, k));
} else {
sb.append(String.format(parmPhrase3_th, i, j, k, criterion.getTypeHandler()));
}
}
sb.append(')');
}
}
sb.append(')');
}
}
if (sb.length() > 0) {
sql.WHERE(sb.toString());
}
}
}

@ -0,0 +1,122 @@
package com.hai.dao;
import com.hai.entity.HighTySalesman;
import com.hai.entity.HighTySalesmanExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;
import org.springframework.stereotype.Repository;
/**
*
* 代码由工具生成,请勿修改!!!
* 如果需要扩展请在其父类进行扩展
*
**/
@Repository
public interface HighTySalesmanMapper extends HighTySalesmanMapperExt {
@SelectProvider(type=HighTySalesmanSqlProvider.class, method="countByExample")
long countByExample(HighTySalesmanExample example);
@DeleteProvider(type=HighTySalesmanSqlProvider.class, method="deleteByExample")
int deleteByExample(HighTySalesmanExample example);
@Delete({
"delete from high_ty_salesman",
"where id = #{id,jdbcType=BIGINT}"
})
int deleteByPrimaryKey(Long id);
@Insert({
"insert into high_ty_salesman (ty_agent_id, salesman_key, ",
"salesman_name, salesman_phone, ",
"`status`, create_time, ",
"update_time, ext_1, ",
"ext_2, ext_3)",
"values (#{tyAgentId,jdbcType=BIGINT}, #{salesmanKey,jdbcType=VARCHAR}, ",
"#{salesmanName,jdbcType=VARCHAR}, #{salesmanPhone,jdbcType=VARCHAR}, ",
"#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ",
"#{updateTime,jdbcType=TIMESTAMP}, #{ext1,jdbcType=VARCHAR}, ",
"#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
})
@Options(useGeneratedKeys=true,keyProperty="id")
int insert(HighTySalesman record);
@InsertProvider(type=HighTySalesmanSqlProvider.class, method="insertSelective")
@Options(useGeneratedKeys=true,keyProperty="id")
int insertSelective(HighTySalesman record);
@SelectProvider(type=HighTySalesmanSqlProvider.class, method="selectByExample")
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="ty_agent_id", property="tyAgentId", jdbcType=JdbcType.BIGINT),
@Result(column="salesman_key", property="salesmanKey", jdbcType=JdbcType.VARCHAR),
@Result(column="salesman_name", property="salesmanName", jdbcType=JdbcType.VARCHAR),
@Result(column="salesman_phone", property="salesmanPhone", jdbcType=JdbcType.VARCHAR),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR)
})
List<HighTySalesman> selectByExample(HighTySalesmanExample example);
@Select({
"select",
"id, ty_agent_id, salesman_key, salesman_name, salesman_phone, `status`, create_time, ",
"update_time, ext_1, ext_2, ext_3",
"from high_ty_salesman",
"where id = #{id,jdbcType=BIGINT}"
})
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="ty_agent_id", property="tyAgentId", jdbcType=JdbcType.BIGINT),
@Result(column="salesman_key", property="salesmanKey", jdbcType=JdbcType.VARCHAR),
@Result(column="salesman_name", property="salesmanName", jdbcType=JdbcType.VARCHAR),
@Result(column="salesman_phone", property="salesmanPhone", jdbcType=JdbcType.VARCHAR),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR)
})
HighTySalesman selectByPrimaryKey(Long id);
@UpdateProvider(type=HighTySalesmanSqlProvider.class, method="updateByExampleSelective")
int updateByExampleSelective(@Param("record") HighTySalesman record, @Param("example") HighTySalesmanExample example);
@UpdateProvider(type=HighTySalesmanSqlProvider.class, method="updateByExample")
int updateByExample(@Param("record") HighTySalesman record, @Param("example") HighTySalesmanExample example);
@UpdateProvider(type=HighTySalesmanSqlProvider.class, method="updateByPrimaryKeySelective")
int updateByPrimaryKeySelective(HighTySalesman record);
@Update({
"update high_ty_salesman",
"set ty_agent_id = #{tyAgentId,jdbcType=BIGINT},",
"salesman_key = #{salesmanKey,jdbcType=VARCHAR},",
"salesman_name = #{salesmanName,jdbcType=VARCHAR},",
"salesman_phone = #{salesmanPhone,jdbcType=VARCHAR},",
"`status` = #{status,jdbcType=INTEGER},",
"create_time = #{createTime,jdbcType=TIMESTAMP},",
"update_time = #{updateTime,jdbcType=TIMESTAMP},",
"ext_1 = #{ext1,jdbcType=VARCHAR},",
"ext_2 = #{ext2,jdbcType=VARCHAR},",
"ext_3 = #{ext3,jdbcType=VARCHAR}",
"where id = #{id,jdbcType=BIGINT}"
})
int updateByPrimaryKey(HighTySalesman record);
}

@ -0,0 +1,7 @@
package com.hai.dao;
/**
* mapper扩展类
*/
public interface HighTySalesmanMapperExt {
}

@ -0,0 +1,318 @@
package com.hai.dao;
import com.hai.entity.HighTySalesman;
import com.hai.entity.HighTySalesmanExample.Criteria;
import com.hai.entity.HighTySalesmanExample.Criterion;
import com.hai.entity.HighTySalesmanExample;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.jdbc.SQL;
public class HighTySalesmanSqlProvider {
public String countByExample(HighTySalesmanExample example) {
SQL sql = new SQL();
sql.SELECT("count(*)").FROM("high_ty_salesman");
applyWhere(sql, example, false);
return sql.toString();
}
public String deleteByExample(HighTySalesmanExample example) {
SQL sql = new SQL();
sql.DELETE_FROM("high_ty_salesman");
applyWhere(sql, example, false);
return sql.toString();
}
public String insertSelective(HighTySalesman record) {
SQL sql = new SQL();
sql.INSERT_INTO("high_ty_salesman");
if (record.getTyAgentId() != null) {
sql.VALUES("ty_agent_id", "#{tyAgentId,jdbcType=BIGINT}");
}
if (record.getSalesmanKey() != null) {
sql.VALUES("salesman_key", "#{salesmanKey,jdbcType=VARCHAR}");
}
if (record.getSalesmanName() != null) {
sql.VALUES("salesman_name", "#{salesmanName,jdbcType=VARCHAR}");
}
if (record.getSalesmanPhone() != null) {
sql.VALUES("salesman_phone", "#{salesmanPhone,jdbcType=VARCHAR}");
}
if (record.getStatus() != null) {
sql.VALUES("`status`", "#{status,jdbcType=INTEGER}");
}
if (record.getCreateTime() != null) {
sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}");
}
if (record.getUpdateTime() != null) {
sql.VALUES("update_time", "#{updateTime,jdbcType=TIMESTAMP}");
}
if (record.getExt1() != null) {
sql.VALUES("ext_1", "#{ext1,jdbcType=VARCHAR}");
}
if (record.getExt2() != null) {
sql.VALUES("ext_2", "#{ext2,jdbcType=VARCHAR}");
}
if (record.getExt3() != null) {
sql.VALUES("ext_3", "#{ext3,jdbcType=VARCHAR}");
}
return sql.toString();
}
public String selectByExample(HighTySalesmanExample example) {
SQL sql = new SQL();
if (example != null && example.isDistinct()) {
sql.SELECT_DISTINCT("id");
} else {
sql.SELECT("id");
}
sql.SELECT("ty_agent_id");
sql.SELECT("salesman_key");
sql.SELECT("salesman_name");
sql.SELECT("salesman_phone");
sql.SELECT("`status`");
sql.SELECT("create_time");
sql.SELECT("update_time");
sql.SELECT("ext_1");
sql.SELECT("ext_2");
sql.SELECT("ext_3");
sql.FROM("high_ty_salesman");
applyWhere(sql, example, false);
if (example != null && example.getOrderByClause() != null) {
sql.ORDER_BY(example.getOrderByClause());
}
return sql.toString();
}
public String updateByExampleSelective(Map<String, Object> parameter) {
HighTySalesman record = (HighTySalesman) parameter.get("record");
HighTySalesmanExample example = (HighTySalesmanExample) parameter.get("example");
SQL sql = new SQL();
sql.UPDATE("high_ty_salesman");
if (record.getId() != null) {
sql.SET("id = #{record.id,jdbcType=BIGINT}");
}
if (record.getTyAgentId() != null) {
sql.SET("ty_agent_id = #{record.tyAgentId,jdbcType=BIGINT}");
}
if (record.getSalesmanKey() != null) {
sql.SET("salesman_key = #{record.salesmanKey,jdbcType=VARCHAR}");
}
if (record.getSalesmanName() != null) {
sql.SET("salesman_name = #{record.salesmanName,jdbcType=VARCHAR}");
}
if (record.getSalesmanPhone() != null) {
sql.SET("salesman_phone = #{record.salesmanPhone,jdbcType=VARCHAR}");
}
if (record.getStatus() != null) {
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
}
if (record.getCreateTime() != null) {
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
}
if (record.getUpdateTime() != null) {
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}");
}
if (record.getExt1() != null) {
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}");
}
if (record.getExt2() != null) {
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}");
}
if (record.getExt3() != null) {
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}");
}
applyWhere(sql, example, true);
return sql.toString();
}
public String updateByExample(Map<String, Object> parameter) {
SQL sql = new SQL();
sql.UPDATE("high_ty_salesman");
sql.SET("id = #{record.id,jdbcType=BIGINT}");
sql.SET("ty_agent_id = #{record.tyAgentId,jdbcType=BIGINT}");
sql.SET("salesman_key = #{record.salesmanKey,jdbcType=VARCHAR}");
sql.SET("salesman_name = #{record.salesmanName,jdbcType=VARCHAR}");
sql.SET("salesman_phone = #{record.salesmanPhone,jdbcType=VARCHAR}");
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}");
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}");
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}");
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}");
HighTySalesmanExample example = (HighTySalesmanExample) parameter.get("example");
applyWhere(sql, example, true);
return sql.toString();
}
public String updateByPrimaryKeySelective(HighTySalesman record) {
SQL sql = new SQL();
sql.UPDATE("high_ty_salesman");
if (record.getTyAgentId() != null) {
sql.SET("ty_agent_id = #{tyAgentId,jdbcType=BIGINT}");
}
if (record.getSalesmanKey() != null) {
sql.SET("salesman_key = #{salesmanKey,jdbcType=VARCHAR}");
}
if (record.getSalesmanName() != null) {
sql.SET("salesman_name = #{salesmanName,jdbcType=VARCHAR}");
}
if (record.getSalesmanPhone() != null) {
sql.SET("salesman_phone = #{salesmanPhone,jdbcType=VARCHAR}");
}
if (record.getStatus() != null) {
sql.SET("`status` = #{status,jdbcType=INTEGER}");
}
if (record.getCreateTime() != null) {
sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}");
}
if (record.getUpdateTime() != null) {
sql.SET("update_time = #{updateTime,jdbcType=TIMESTAMP}");
}
if (record.getExt1() != null) {
sql.SET("ext_1 = #{ext1,jdbcType=VARCHAR}");
}
if (record.getExt2() != null) {
sql.SET("ext_2 = #{ext2,jdbcType=VARCHAR}");
}
if (record.getExt3() != null) {
sql.SET("ext_3 = #{ext3,jdbcType=VARCHAR}");
}
sql.WHERE("id = #{id,jdbcType=BIGINT}");
return sql.toString();
}
protected void applyWhere(SQL sql, HighTySalesmanExample example, boolean includeExamplePhrase) {
if (example == null) {
return;
}
String parmPhrase1;
String parmPhrase1_th;
String parmPhrase2;
String parmPhrase2_th;
String parmPhrase3;
String parmPhrase3_th;
if (includeExamplePhrase) {
parmPhrase1 = "%s #{example.oredCriteria[%d].allCriteria[%d].value}";
parmPhrase1_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}";
parmPhrase2 = "%s #{example.oredCriteria[%d].allCriteria[%d].value} and #{example.oredCriteria[%d].criteria[%d].secondValue}";
parmPhrase2_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{example.oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}";
parmPhrase3 = "#{example.oredCriteria[%d].allCriteria[%d].value[%d]}";
parmPhrase3_th = "#{example.oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}";
} else {
parmPhrase1 = "%s #{oredCriteria[%d].allCriteria[%d].value}";
parmPhrase1_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}";
parmPhrase2 = "%s #{oredCriteria[%d].allCriteria[%d].value} and #{oredCriteria[%d].criteria[%d].secondValue}";
parmPhrase2_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}";
parmPhrase3 = "#{oredCriteria[%d].allCriteria[%d].value[%d]}";
parmPhrase3_th = "#{oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}";
}
StringBuilder sb = new StringBuilder();
List<Criteria> oredCriteria = example.getOredCriteria();
boolean firstCriteria = true;
for (int i = 0; i < oredCriteria.size(); i++) {
Criteria criteria = oredCriteria.get(i);
if (criteria.isValid()) {
if (firstCriteria) {
firstCriteria = false;
} else {
sb.append(" or ");
}
sb.append('(');
List<Criterion> criterions = criteria.getAllCriteria();
boolean firstCriterion = true;
for (int j = 0; j < criterions.size(); j++) {
Criterion criterion = criterions.get(j);
if (firstCriterion) {
firstCriterion = false;
} else {
sb.append(" and ");
}
if (criterion.isNoValue()) {
sb.append(criterion.getCondition());
} else if (criterion.isSingleValue()) {
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase1, criterion.getCondition(), i, j));
} else {
sb.append(String.format(parmPhrase1_th, criterion.getCondition(), i, j,criterion.getTypeHandler()));
}
} else if (criterion.isBetweenValue()) {
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase2, criterion.getCondition(), i, j, i, j));
} else {
sb.append(String.format(parmPhrase2_th, criterion.getCondition(), i, j, criterion.getTypeHandler(), i, j, criterion.getTypeHandler()));
}
} else if (criterion.isListValue()) {
sb.append(criterion.getCondition());
sb.append(" (");
List<?> listItems = (List<?>) criterion.getValue();
boolean comma = false;
for (int k = 0; k < listItems.size(); k++) {
if (comma) {
sb.append(", ");
} else {
comma = true;
}
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase3, i, j, k));
} else {
sb.append(String.format(parmPhrase3_th, i, j, k, criterion.getTypeHandler()));
}
}
sb.append(')');
}
}
sb.append(')');
}
}
if (sb.length() > 0) {
sql.WHERE(sb.toString());
}
}
}

@ -0,0 +1,229 @@
package com.hai.entity;
import java.io.Serializable;
import java.util.Date;
/**
* high_ty_agent
* @author
*/
/**
*
* 代码由工具生成
*
**/
public class HighTyAgent implements Serializable {
private Long id;
/**
* 代理商编号
*/
private String agentKey;
/**
* 代理商名称
*/
private String agentName;
/**
* 代理商地址
*/
private String agentAddress;
/**
* 联系人
*/
private String agentUser;
/**
* 联系电话
*/
private String agentPhone;
/**
* 状态 0删除 1正常
*/
private Integer status;
/**
* 创建时间
*/
private Date createTime;
/**
* 修改时间
*/
private Date updateTime;
private String ext1;
private String ext2;
private String ext3;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getAgentKey() {
return agentKey;
}
public void setAgentKey(String agentKey) {
this.agentKey = agentKey;
}
public String getAgentName() {
return agentName;
}
public void setAgentName(String agentName) {
this.agentName = agentName;
}
public String getAgentAddress() {
return agentAddress;
}
public void setAgentAddress(String agentAddress) {
this.agentAddress = agentAddress;
}
public String getAgentUser() {
return agentUser;
}
public void setAgentUser(String agentUser) {
this.agentUser = agentUser;
}
public String getAgentPhone() {
return agentPhone;
}
public void setAgentPhone(String agentPhone) {
this.agentPhone = agentPhone;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getExt1() {
return ext1;
}
public void setExt1(String ext1) {
this.ext1 = ext1;
}
public String getExt2() {
return ext2;
}
public void setExt2(String ext2) {
this.ext2 = ext2;
}
public String getExt3() {
return ext3;
}
public void setExt3(String ext3) {
this.ext3 = ext3;
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
HighTyAgent other = (HighTyAgent) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getAgentKey() == null ? other.getAgentKey() == null : this.getAgentKey().equals(other.getAgentKey()))
&& (this.getAgentName() == null ? other.getAgentName() == null : this.getAgentName().equals(other.getAgentName()))
&& (this.getAgentAddress() == null ? other.getAgentAddress() == null : this.getAgentAddress().equals(other.getAgentAddress()))
&& (this.getAgentUser() == null ? other.getAgentUser() == null : this.getAgentUser().equals(other.getAgentUser()))
&& (this.getAgentPhone() == null ? other.getAgentPhone() == null : this.getAgentPhone().equals(other.getAgentPhone()))
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
&& (this.getExt1() == null ? other.getExt1() == null : this.getExt1().equals(other.getExt1()))
&& (this.getExt2() == null ? other.getExt2() == null : this.getExt2().equals(other.getExt2()))
&& (this.getExt3() == null ? other.getExt3() == null : this.getExt3().equals(other.getExt3()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getAgentKey() == null) ? 0 : getAgentKey().hashCode());
result = prime * result + ((getAgentName() == null) ? 0 : getAgentName().hashCode());
result = prime * result + ((getAgentAddress() == null) ? 0 : getAgentAddress().hashCode());
result = prime * result + ((getAgentUser() == null) ? 0 : getAgentUser().hashCode());
result = prime * result + ((getAgentPhone() == null) ? 0 : getAgentPhone().hashCode());
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode());
result = prime * result + ((getExt2() == null) ? 0 : getExt2().hashCode());
result = prime * result + ((getExt3() == null) ? 0 : getExt3().hashCode());
return result;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", agentKey=").append(agentKey);
sb.append(", agentName=").append(agentName);
sb.append(", agentAddress=").append(agentAddress);
sb.append(", agentUser=").append(agentUser);
sb.append(", agentPhone=").append(agentPhone);
sb.append(", status=").append(status);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", ext1=").append(ext1);
sb.append(", ext2=").append(ext2);
sb.append(", ext3=").append(ext3);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}

@ -0,0 +1,245 @@
package com.hai.entity;
import java.io.Serializable;
import java.util.Date;
/**
* high_ty_agent_oil_station
* @author
*/
/**
*
* 代码由工具生成
*
**/
public class HighTyAgentOilStation implements Serializable {
private Long id;
/**
* 团油代理商id
*/
private Long tyAgentId;
/**
* 团油代理商名称
*/
private String tyAgentName;
/**
* 团油业务员id
*/
private Long tySalesmanId;
/**
* 团油业务员名称
*/
private String tySalesmanName;
/**
* 加油站id
*/
private Long oilStationId;
/**
* 加油站名称
*/
private String oilStationName;
/**
* 状态 0删除 1正常
*/
private Integer status;
/**
* 创建时间
*/
private Date createTime;
/**
* 修改时间
*/
private Date updateTime;
private String ext1;
private String ext2;
private String ext3;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getTyAgentId() {
return tyAgentId;
}
public void setTyAgentId(Long tyAgentId) {
this.tyAgentId = tyAgentId;
}
public String getTyAgentName() {
return tyAgentName;
}
public void setTyAgentName(String tyAgentName) {
this.tyAgentName = tyAgentName;
}
public Long getTySalesmanId() {
return tySalesmanId;
}
public void setTySalesmanId(Long tySalesmanId) {
this.tySalesmanId = tySalesmanId;
}
public String getTySalesmanName() {
return tySalesmanName;
}
public void setTySalesmanName(String tySalesmanName) {
this.tySalesmanName = tySalesmanName;
}
public Long getOilStationId() {
return oilStationId;
}
public void setOilStationId(Long oilStationId) {
this.oilStationId = oilStationId;
}
public String getOilStationName() {
return oilStationName;
}
public void setOilStationName(String oilStationName) {
this.oilStationName = oilStationName;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getExt1() {
return ext1;
}
public void setExt1(String ext1) {
this.ext1 = ext1;
}
public String getExt2() {
return ext2;
}
public void setExt2(String ext2) {
this.ext2 = ext2;
}
public String getExt3() {
return ext3;
}
public void setExt3(String ext3) {
this.ext3 = ext3;
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
HighTyAgentOilStation other = (HighTyAgentOilStation) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getTyAgentId() == null ? other.getTyAgentId() == null : this.getTyAgentId().equals(other.getTyAgentId()))
&& (this.getTyAgentName() == null ? other.getTyAgentName() == null : this.getTyAgentName().equals(other.getTyAgentName()))
&& (this.getTySalesmanId() == null ? other.getTySalesmanId() == null : this.getTySalesmanId().equals(other.getTySalesmanId()))
&& (this.getTySalesmanName() == null ? other.getTySalesmanName() == null : this.getTySalesmanName().equals(other.getTySalesmanName()))
&& (this.getOilStationId() == null ? other.getOilStationId() == null : this.getOilStationId().equals(other.getOilStationId()))
&& (this.getOilStationName() == null ? other.getOilStationName() == null : this.getOilStationName().equals(other.getOilStationName()))
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
&& (this.getExt1() == null ? other.getExt1() == null : this.getExt1().equals(other.getExt1()))
&& (this.getExt2() == null ? other.getExt2() == null : this.getExt2().equals(other.getExt2()))
&& (this.getExt3() == null ? other.getExt3() == null : this.getExt3().equals(other.getExt3()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getTyAgentId() == null) ? 0 : getTyAgentId().hashCode());
result = prime * result + ((getTyAgentName() == null) ? 0 : getTyAgentName().hashCode());
result = prime * result + ((getTySalesmanId() == null) ? 0 : getTySalesmanId().hashCode());
result = prime * result + ((getTySalesmanName() == null) ? 0 : getTySalesmanName().hashCode());
result = prime * result + ((getOilStationId() == null) ? 0 : getOilStationId().hashCode());
result = prime * result + ((getOilStationName() == null) ? 0 : getOilStationName().hashCode());
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode());
result = prime * result + ((getExt2() == null) ? 0 : getExt2().hashCode());
result = prime * result + ((getExt3() == null) ? 0 : getExt3().hashCode());
return result;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", tyAgentId=").append(tyAgentId);
sb.append(", tyAgentName=").append(tyAgentName);
sb.append(", tySalesmanId=").append(tySalesmanId);
sb.append(", tySalesmanName=").append(tySalesmanName);
sb.append(", oilStationId=").append(oilStationId);
sb.append(", oilStationName=").append(oilStationName);
sb.append(", status=").append(status);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", ext1=").append(ext1);
sb.append(", ext2=").append(ext2);
sb.append(", ext3=").append(ext3);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}

@ -0,0 +1,213 @@
package com.hai.entity;
import java.io.Serializable;
import java.util.Date;
/**
* high_ty_salesman
* @author
*/
/**
*
* 代码由工具生成
*
**/
public class HighTySalesman implements Serializable {
private Long id;
/**
* 代理商id
*/
private Long tyAgentId;
/**
* 业务员编号
*/
private String salesmanKey;
/**
* 业务员名称
*/
private String salesmanName;
/**
* 业务员联系电话
*/
private String salesmanPhone;
/**
* 状态 0删除 1正常
*/
private Integer status;
/**
* 创建时间
*/
private Date createTime;
/**
* 修改时间
*/
private Date updateTime;
private String ext1;
private String ext2;
private String ext3;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getTyAgentId() {
return tyAgentId;
}
public void setTyAgentId(Long tyAgentId) {
this.tyAgentId = tyAgentId;
}
public String getSalesmanKey() {
return salesmanKey;
}
public void setSalesmanKey(String salesmanKey) {
this.salesmanKey = salesmanKey;
}
public String getSalesmanName() {
return salesmanName;
}
public void setSalesmanName(String salesmanName) {
this.salesmanName = salesmanName;
}
public String getSalesmanPhone() {
return salesmanPhone;
}
public void setSalesmanPhone(String salesmanPhone) {
this.salesmanPhone = salesmanPhone;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getExt1() {
return ext1;
}
public void setExt1(String ext1) {
this.ext1 = ext1;
}
public String getExt2() {
return ext2;
}
public void setExt2(String ext2) {
this.ext2 = ext2;
}
public String getExt3() {
return ext3;
}
public void setExt3(String ext3) {
this.ext3 = ext3;
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
HighTySalesman other = (HighTySalesman) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getTyAgentId() == null ? other.getTyAgentId() == null : this.getTyAgentId().equals(other.getTyAgentId()))
&& (this.getSalesmanKey() == null ? other.getSalesmanKey() == null : this.getSalesmanKey().equals(other.getSalesmanKey()))
&& (this.getSalesmanName() == null ? other.getSalesmanName() == null : this.getSalesmanName().equals(other.getSalesmanName()))
&& (this.getSalesmanPhone() == null ? other.getSalesmanPhone() == null : this.getSalesmanPhone().equals(other.getSalesmanPhone()))
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
&& (this.getExt1() == null ? other.getExt1() == null : this.getExt1().equals(other.getExt1()))
&& (this.getExt2() == null ? other.getExt2() == null : this.getExt2().equals(other.getExt2()))
&& (this.getExt3() == null ? other.getExt3() == null : this.getExt3().equals(other.getExt3()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getTyAgentId() == null) ? 0 : getTyAgentId().hashCode());
result = prime * result + ((getSalesmanKey() == null) ? 0 : getSalesmanKey().hashCode());
result = prime * result + ((getSalesmanName() == null) ? 0 : getSalesmanName().hashCode());
result = prime * result + ((getSalesmanPhone() == null) ? 0 : getSalesmanPhone().hashCode());
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode());
result = prime * result + ((getExt2() == null) ? 0 : getExt2().hashCode());
result = prime * result + ((getExt3() == null) ? 0 : getExt3().hashCode());
return result;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", tyAgentId=").append(tyAgentId);
sb.append(", salesmanKey=").append(salesmanKey);
sb.append(", salesmanName=").append(salesmanName);
sb.append(", salesmanPhone=").append(salesmanPhone);
sb.append(", status=").append(status);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", ext1=").append(ext1);
sb.append(", ext2=").append(ext2);
sb.append(", ext3=").append(ext3);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}

@ -0,0 +1,943 @@
package com.hai.entity;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class HighTySalesmanExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
private Integer limit;
private Long offset;
public HighTySalesmanExample() {
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 setLimit(Integer limit) {
this.limit = limit;
}
public Integer getLimit() {
return limit;
}
public void setOffset(Long offset) {
this.offset = offset;
}
public Long getOffset() {
return offset;
}
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 andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andTyAgentIdIsNull() {
addCriterion("ty_agent_id is null");
return (Criteria) this;
}
public Criteria andTyAgentIdIsNotNull() {
addCriterion("ty_agent_id is not null");
return (Criteria) this;
}
public Criteria andTyAgentIdEqualTo(Long value) {
addCriterion("ty_agent_id =", value, "tyAgentId");
return (Criteria) this;
}
public Criteria andTyAgentIdNotEqualTo(Long value) {
addCriterion("ty_agent_id <>", value, "tyAgentId");
return (Criteria) this;
}
public Criteria andTyAgentIdGreaterThan(Long value) {
addCriterion("ty_agent_id >", value, "tyAgentId");
return (Criteria) this;
}
public Criteria andTyAgentIdGreaterThanOrEqualTo(Long value) {
addCriterion("ty_agent_id >=", value, "tyAgentId");
return (Criteria) this;
}
public Criteria andTyAgentIdLessThan(Long value) {
addCriterion("ty_agent_id <", value, "tyAgentId");
return (Criteria) this;
}
public Criteria andTyAgentIdLessThanOrEqualTo(Long value) {
addCriterion("ty_agent_id <=", value, "tyAgentId");
return (Criteria) this;
}
public Criteria andTyAgentIdIn(List<Long> values) {
addCriterion("ty_agent_id in", values, "tyAgentId");
return (Criteria) this;
}
public Criteria andTyAgentIdNotIn(List<Long> values) {
addCriterion("ty_agent_id not in", values, "tyAgentId");
return (Criteria) this;
}
public Criteria andTyAgentIdBetween(Long value1, Long value2) {
addCriterion("ty_agent_id between", value1, value2, "tyAgentId");
return (Criteria) this;
}
public Criteria andTyAgentIdNotBetween(Long value1, Long value2) {
addCriterion("ty_agent_id not between", value1, value2, "tyAgentId");
return (Criteria) this;
}
public Criteria andSalesmanKeyIsNull() {
addCriterion("salesman_key is null");
return (Criteria) this;
}
public Criteria andSalesmanKeyIsNotNull() {
addCriterion("salesman_key is not null");
return (Criteria) this;
}
public Criteria andSalesmanKeyEqualTo(String value) {
addCriterion("salesman_key =", value, "salesmanKey");
return (Criteria) this;
}
public Criteria andSalesmanKeyNotEqualTo(String value) {
addCriterion("salesman_key <>", value, "salesmanKey");
return (Criteria) this;
}
public Criteria andSalesmanKeyGreaterThan(String value) {
addCriterion("salesman_key >", value, "salesmanKey");
return (Criteria) this;
}
public Criteria andSalesmanKeyGreaterThanOrEqualTo(String value) {
addCriterion("salesman_key >=", value, "salesmanKey");
return (Criteria) this;
}
public Criteria andSalesmanKeyLessThan(String value) {
addCriterion("salesman_key <", value, "salesmanKey");
return (Criteria) this;
}
public Criteria andSalesmanKeyLessThanOrEqualTo(String value) {
addCriterion("salesman_key <=", value, "salesmanKey");
return (Criteria) this;
}
public Criteria andSalesmanKeyLike(String value) {
addCriterion("salesman_key like", value, "salesmanKey");
return (Criteria) this;
}
public Criteria andSalesmanKeyNotLike(String value) {
addCriterion("salesman_key not like", value, "salesmanKey");
return (Criteria) this;
}
public Criteria andSalesmanKeyIn(List<String> values) {
addCriterion("salesman_key in", values, "salesmanKey");
return (Criteria) this;
}
public Criteria andSalesmanKeyNotIn(List<String> values) {
addCriterion("salesman_key not in", values, "salesmanKey");
return (Criteria) this;
}
public Criteria andSalesmanKeyBetween(String value1, String value2) {
addCriterion("salesman_key between", value1, value2, "salesmanKey");
return (Criteria) this;
}
public Criteria andSalesmanKeyNotBetween(String value1, String value2) {
addCriterion("salesman_key not between", value1, value2, "salesmanKey");
return (Criteria) this;
}
public Criteria andSalesmanNameIsNull() {
addCriterion("salesman_name is null");
return (Criteria) this;
}
public Criteria andSalesmanNameIsNotNull() {
addCriterion("salesman_name is not null");
return (Criteria) this;
}
public Criteria andSalesmanNameEqualTo(String value) {
addCriterion("salesman_name =", value, "salesmanName");
return (Criteria) this;
}
public Criteria andSalesmanNameNotEqualTo(String value) {
addCriterion("salesman_name <>", value, "salesmanName");
return (Criteria) this;
}
public Criteria andSalesmanNameGreaterThan(String value) {
addCriterion("salesman_name >", value, "salesmanName");
return (Criteria) this;
}
public Criteria andSalesmanNameGreaterThanOrEqualTo(String value) {
addCriterion("salesman_name >=", value, "salesmanName");
return (Criteria) this;
}
public Criteria andSalesmanNameLessThan(String value) {
addCriterion("salesman_name <", value, "salesmanName");
return (Criteria) this;
}
public Criteria andSalesmanNameLessThanOrEqualTo(String value) {
addCriterion("salesman_name <=", value, "salesmanName");
return (Criteria) this;
}
public Criteria andSalesmanNameLike(String value) {
addCriterion("salesman_name like", value, "salesmanName");
return (Criteria) this;
}
public Criteria andSalesmanNameNotLike(String value) {
addCriterion("salesman_name not like", value, "salesmanName");
return (Criteria) this;
}
public Criteria andSalesmanNameIn(List<String> values) {
addCriterion("salesman_name in", values, "salesmanName");
return (Criteria) this;
}
public Criteria andSalesmanNameNotIn(List<String> values) {
addCriterion("salesman_name not in", values, "salesmanName");
return (Criteria) this;
}
public Criteria andSalesmanNameBetween(String value1, String value2) {
addCriterion("salesman_name between", value1, value2, "salesmanName");
return (Criteria) this;
}
public Criteria andSalesmanNameNotBetween(String value1, String value2) {
addCriterion("salesman_name not between", value1, value2, "salesmanName");
return (Criteria) this;
}
public Criteria andSalesmanPhoneIsNull() {
addCriterion("salesman_phone is null");
return (Criteria) this;
}
public Criteria andSalesmanPhoneIsNotNull() {
addCriterion("salesman_phone is not null");
return (Criteria) this;
}
public Criteria andSalesmanPhoneEqualTo(String value) {
addCriterion("salesman_phone =", value, "salesmanPhone");
return (Criteria) this;
}
public Criteria andSalesmanPhoneNotEqualTo(String value) {
addCriterion("salesman_phone <>", value, "salesmanPhone");
return (Criteria) this;
}
public Criteria andSalesmanPhoneGreaterThan(String value) {
addCriterion("salesman_phone >", value, "salesmanPhone");
return (Criteria) this;
}
public Criteria andSalesmanPhoneGreaterThanOrEqualTo(String value) {
addCriterion("salesman_phone >=", value, "salesmanPhone");
return (Criteria) this;
}
public Criteria andSalesmanPhoneLessThan(String value) {
addCriterion("salesman_phone <", value, "salesmanPhone");
return (Criteria) this;
}
public Criteria andSalesmanPhoneLessThanOrEqualTo(String value) {
addCriterion("salesman_phone <=", value, "salesmanPhone");
return (Criteria) this;
}
public Criteria andSalesmanPhoneLike(String value) {
addCriterion("salesman_phone like", value, "salesmanPhone");
return (Criteria) this;
}
public Criteria andSalesmanPhoneNotLike(String value) {
addCriterion("salesman_phone not like", value, "salesmanPhone");
return (Criteria) this;
}
public Criteria andSalesmanPhoneIn(List<String> values) {
addCriterion("salesman_phone in", values, "salesmanPhone");
return (Criteria) this;
}
public Criteria andSalesmanPhoneNotIn(List<String> values) {
addCriterion("salesman_phone not in", values, "salesmanPhone");
return (Criteria) this;
}
public Criteria andSalesmanPhoneBetween(String value1, String value2) {
addCriterion("salesman_phone between", value1, value2, "salesmanPhone");
return (Criteria) this;
}
public Criteria andSalesmanPhoneNotBetween(String value1, String value2) {
addCriterion("salesman_phone not between", value1, value2, "salesmanPhone");
return (Criteria) this;
}
public Criteria andStatusIsNull() {
addCriterion("`status` is null");
return (Criteria) this;
}
public Criteria andStatusIsNotNull() {
addCriterion("`status` is not null");
return (Criteria) this;
}
public Criteria andStatusEqualTo(Integer value) {
addCriterion("`status` =", value, "status");
return (Criteria) this;
}
public Criteria andStatusNotEqualTo(Integer value) {
addCriterion("`status` <>", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThan(Integer value) {
addCriterion("`status` >", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThanOrEqualTo(Integer value) {
addCriterion("`status` >=", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThan(Integer value) {
addCriterion("`status` <", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThanOrEqualTo(Integer value) {
addCriterion("`status` <=", value, "status");
return (Criteria) this;
}
public Criteria andStatusIn(List<Integer> values) {
addCriterion("`status` in", values, "status");
return (Criteria) this;
}
public Criteria andStatusNotIn(List<Integer> values) {
addCriterion("`status` not in", values, "status");
return (Criteria) this;
}
public Criteria andStatusBetween(Integer value1, Integer value2) {
addCriterion("`status` between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andStatusNotBetween(Integer value1, Integer value2) {
addCriterion("`status` not between", value1, value2, "status");
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 andUpdateTimeIsNull() {
addCriterion("update_time is null");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNotNull() {
addCriterion("update_time is not null");
return (Criteria) this;
}
public Criteria andUpdateTimeEqualTo(Date value) {
addCriterion("update_time =", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotEqualTo(Date value) {
addCriterion("update_time <>", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThan(Date value) {
addCriterion("update_time >", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("update_time >=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThan(Date value) {
addCriterion("update_time <", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThanOrEqualTo(Date value) {
addCriterion("update_time <=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIn(List<Date> values) {
addCriterion("update_time in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotIn(List<Date> values) {
addCriterion("update_time not in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeBetween(Date value1, Date value2) {
addCriterion("update_time between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotBetween(Date value1, Date value2) {
addCriterion("update_time not between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andExt1IsNull() {
addCriterion("ext_1 is null");
return (Criteria) this;
}
public Criteria andExt1IsNotNull() {
addCriterion("ext_1 is not null");
return (Criteria) this;
}
public Criteria andExt1EqualTo(String value) {
addCriterion("ext_1 =", value, "ext1");
return (Criteria) this;
}
public Criteria andExt1NotEqualTo(String value) {
addCriterion("ext_1 <>", value, "ext1");
return (Criteria) this;
}
public Criteria andExt1GreaterThan(String value) {
addCriterion("ext_1 >", value, "ext1");
return (Criteria) this;
}
public Criteria andExt1GreaterThanOrEqualTo(String value) {
addCriterion("ext_1 >=", value, "ext1");
return (Criteria) this;
}
public Criteria andExt1LessThan(String value) {
addCriterion("ext_1 <", value, "ext1");
return (Criteria) this;
}
public Criteria andExt1LessThanOrEqualTo(String value) {
addCriterion("ext_1 <=", value, "ext1");
return (Criteria) this;
}
public Criteria andExt1Like(String value) {
addCriterion("ext_1 like", value, "ext1");
return (Criteria) this;
}
public Criteria andExt1NotLike(String value) {
addCriterion("ext_1 not like", value, "ext1");
return (Criteria) this;
}
public Criteria andExt1In(List<String> values) {
addCriterion("ext_1 in", values, "ext1");
return (Criteria) this;
}
public Criteria andExt1NotIn(List<String> values) {
addCriterion("ext_1 not in", values, "ext1");
return (Criteria) this;
}
public Criteria andExt1Between(String value1, String value2) {
addCriterion("ext_1 between", value1, value2, "ext1");
return (Criteria) this;
}
public Criteria andExt1NotBetween(String value1, String value2) {
addCriterion("ext_1 not between", value1, value2, "ext1");
return (Criteria) this;
}
public Criteria andExt2IsNull() {
addCriterion("ext_2 is null");
return (Criteria) this;
}
public Criteria andExt2IsNotNull() {
addCriterion("ext_2 is not null");
return (Criteria) this;
}
public Criteria andExt2EqualTo(String value) {
addCriterion("ext_2 =", value, "ext2");
return (Criteria) this;
}
public Criteria andExt2NotEqualTo(String value) {
addCriterion("ext_2 <>", value, "ext2");
return (Criteria) this;
}
public Criteria andExt2GreaterThan(String value) {
addCriterion("ext_2 >", value, "ext2");
return (Criteria) this;
}
public Criteria andExt2GreaterThanOrEqualTo(String value) {
addCriterion("ext_2 >=", value, "ext2");
return (Criteria) this;
}
public Criteria andExt2LessThan(String value) {
addCriterion("ext_2 <", value, "ext2");
return (Criteria) this;
}
public Criteria andExt2LessThanOrEqualTo(String value) {
addCriterion("ext_2 <=", value, "ext2");
return (Criteria) this;
}
public Criteria andExt2Like(String value) {
addCriterion("ext_2 like", value, "ext2");
return (Criteria) this;
}
public Criteria andExt2NotLike(String value) {
addCriterion("ext_2 not like", value, "ext2");
return (Criteria) this;
}
public Criteria andExt2In(List<String> values) {
addCriterion("ext_2 in", values, "ext2");
return (Criteria) this;
}
public Criteria andExt2NotIn(List<String> values) {
addCriterion("ext_2 not in", values, "ext2");
return (Criteria) this;
}
public Criteria andExt2Between(String value1, String value2) {
addCriterion("ext_2 between", value1, value2, "ext2");
return (Criteria) this;
}
public Criteria andExt2NotBetween(String value1, String value2) {
addCriterion("ext_2 not between", value1, value2, "ext2");
return (Criteria) this;
}
public Criteria andExt3IsNull() {
addCriterion("ext_3 is null");
return (Criteria) this;
}
public Criteria andExt3IsNotNull() {
addCriterion("ext_3 is not null");
return (Criteria) this;
}
public Criteria andExt3EqualTo(String value) {
addCriterion("ext_3 =", value, "ext3");
return (Criteria) this;
}
public Criteria andExt3NotEqualTo(String value) {
addCriterion("ext_3 <>", value, "ext3");
return (Criteria) this;
}
public Criteria andExt3GreaterThan(String value) {
addCriterion("ext_3 >", value, "ext3");
return (Criteria) this;
}
public Criteria andExt3GreaterThanOrEqualTo(String value) {
addCriterion("ext_3 >=", value, "ext3");
return (Criteria) this;
}
public Criteria andExt3LessThan(String value) {
addCriterion("ext_3 <", value, "ext3");
return (Criteria) this;
}
public Criteria andExt3LessThanOrEqualTo(String value) {
addCriterion("ext_3 <=", value, "ext3");
return (Criteria) this;
}
public Criteria andExt3Like(String value) {
addCriterion("ext_3 like", value, "ext3");
return (Criteria) this;
}
public Criteria andExt3NotLike(String value) {
addCriterion("ext_3 not like", value, "ext3");
return (Criteria) this;
}
public Criteria andExt3In(List<String> values) {
addCriterion("ext_3 in", values, "ext3");
return (Criteria) this;
}
public Criteria andExt3NotIn(List<String> values) {
addCriterion("ext_3 not in", values, "ext3");
return (Criteria) this;
}
public Criteria andExt3Between(String value1, String value2) {
addCriterion("ext_3 between", value1, value2, "ext3");
return (Criteria) this;
}
public Criteria andExt3NotBetween(String value1, String value2) {
addCriterion("ext_3 not between", value1, value2, "ext3");
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);
}
}
}

@ -0,0 +1,41 @@
package com.hai.enum_type;
/**
* @author hurui
*/
public enum UserObjectTypeEnum {
type0(0, "超级管理员"),
type1(1, "公司"),
type2(2, "商户"),
type3(3, "门店"),
type4(4, "代理商"),
type5(5, "充值后台工商"),
type6(6, "团油代理商"),
type7(7, "团油业务员"),
;
private Integer type;
private String name;
UserObjectTypeEnum(Integer type,String name) {
this.type = type;
this.name = name;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}

@ -30,6 +30,10 @@ public class UserInfoModel {
private HighMerchantStore merchantStore;
// 代理商
private HighAgent highAgent;
// 团油代理商
private HighTyAgent highTyAgent;
// 团油业务员
private HighTySalesman highTySalesman;
// 权限列表
private List<SecPermission> permissionList;
// 菜单权限列表
@ -126,4 +130,20 @@ public class UserInfoModel {
public void setHighAgent(HighAgent highAgent) {
this.highAgent = highAgent;
}
public HighTyAgent getHighTyAgent() {
return highTyAgent;
}
public void setHighTyAgent(HighTyAgent highTyAgent) {
this.highTyAgent = highTyAgent;
}
public HighTySalesman getHighTySalesman() {
return highTySalesman;
}
public void setHighTySalesman(HighTySalesman highTySalesman) {
this.highTySalesman = highTySalesman;
}
}

@ -0,0 +1,64 @@
package com.hai.service;
import com.hai.entity.HighTyAgent;
import java.util.List;
import java.util.Map;
/**
* 团油代理商
* @author hurui
*/
public interface HighTyAgentService {
/**
* 编辑代理商
* @param tyAgent
*/
void editTyAgent(HighTyAgent tyAgent);
/**
* 增加代理商
* @param tyAgent
*/
void addAgent(HighTyAgent tyAgent);
/**
* 修改代理商
* @param tyAgent
*/
void updateAgent(HighTyAgent tyAgent);
/**
* 删除代理商
* @param key
*/
void delAgent(String key);
/**
* 重置密码
* @param key
*/
void agentPwdReset(String key);
/**
* 根据id 查询详情
* @param agentId
* @return
*/
HighTyAgent getDetailById(Long agentId);
/**
* 根据key 查询详情
* @param key
* @return
*/
HighTyAgent getDetailByKey(String key);
/**
* 查询代理商列表
* @param param
* @return
*/
List<HighTyAgent> getAgentList(Map<String, Object> param);
}

@ -0,0 +1,64 @@
package com.hai.service;
import com.hai.entity.HighTySalesman;
import java.util.List;
import java.util.Map;
/**
* @author hurui
*/
public interface HighTySalesmanService {
/**
* 编辑业务员
* @param tySalesman
*/
void editTySalesman(HighTySalesman tySalesman);
/**
* 增加业务员
* @param tySalesman
*/
void addSalesman(HighTySalesman tySalesman);
/**
* 修改业务员
* @param tySalesman
*/
void updateSalesman(HighTySalesman tySalesman);
/**
* 删除业务员
* @param key
*/
void delSalesman(String key);
/**
* 业务员密码重置
* @param key
*/
void salesmanPwdReset(String key);
/**
* 根据id 查询详情
* @param salesmanId
* @return
*/
HighTySalesman getDetailById(Long salesmanId);
/**
* 根据key 查询详情
* @param key
* @return
*/
HighTySalesman getDetailByKey(String key);
/**
* 查询业务员列表
* @param param
* @return
*/
List<HighTySalesman> getSalesmanList(Map<String, Object> param);
}

@ -0,0 +1,182 @@
package com.hai.service.impl;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.utils.MD5Util;
import com.hai.dao.HighTyAgentMapper;
import com.hai.entity.HighTyAgent;
import com.hai.entity.HighTyAgentExample;
import com.hai.entity.SecUser;
import com.hai.enum_type.UserObjectTypeEnum;
import com.hai.service.HighTyAgentService;
import com.hai.service.SecUserService;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Service("highTyAgentService")
public class HighTyAgentServiceImpl implements HighTyAgentService {
@Resource
private HighTyAgentMapper tyAgentMapper;
@Resource
private SecUserService secUserService;
@Override
public void editTyAgent(HighTyAgent tyAgent) {
if (tyAgent.getId() == null) {
tyAgent.setStatus(1);
tyAgent.setCreateTime(new Date());
tyAgent.setUpdateTime(new Date());
tyAgentMapper.insert(tyAgent);
// 生成key
Long key = 1000000 + tyAgent.getId();
tyAgent.setAgentKey(key.toString());
tyAgentMapper.updateByPrimaryKey(tyAgent);
} else {
tyAgent.setUpdateTime(new Date());
tyAgentMapper.updateByPrimaryKey(tyAgent);
}
}
@Override
@Transactional(rollbackFor=Exception.class,propagation= Propagation.REQUIRES_NEW)
public void addAgent(HighTyAgent tyAgent) {
try {
if (secUserService.findByPhone(tyAgent.getAgentPhone()) != null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "手机号已存在,请更换");
}
editTyAgent(tyAgent);
SecUser secUser = new SecUser();
secUser.setUserName(tyAgent.getAgentName());
secUser.setLoginName(tyAgent.getAgentPhone());
secUser.setPassword(MD5Util.encode("123456".getBytes()));
secUser.setAdminFlag(1);
secUser.setStatus(1);
secUser.setRoleId(7L);
secUser.setObjectType(UserObjectTypeEnum.type6.getType());
secUser.setObjectId(tyAgent.getId());
secUser.setCreateTime(new Date());
secUser.setUpdateTime(new Date());
secUserService.addUser(secUser);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void updateAgent(HighTyAgent tyAgent) {
// 查询账户
SecUser account = secUserService.getMainAccount(UserObjectTypeEnum.type6.getType(), tyAgent.getId());
if (account == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到账户信息");
}
if (!account.getLoginName().equals(tyAgent.getAgentPhone())) {
if (secUserService.findByPhone(tyAgent.getAgentPhone()) != null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "手机号已存在,请更换");
}
account.setLoginName(tyAgent.getAgentPhone());
}
editTyAgent(tyAgent);
account.setUserName(tyAgent.getAgentName());
secUserService.updateUser(account);
}
@Override
@Transactional(propagation= Propagation.REQUIRES_NEW)
public void delAgent(String key) {
HighTyAgent agent = getDetailByKey(key);
if (agent == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到代理商");
}
agent.setStatus(0);
editTyAgent(agent);
// 查询代理商账户
SecUser account = secUserService.getMainAccount(UserObjectTypeEnum.type6.getType(), agent.getId());
if (account == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到代理商账户信息");
}
account.setStatus(0);
secUserService.updateUser(account);
}
@Override
public void agentPwdReset(String key) {
try {
// 查询代理商
HighTyAgent tyAgent = getDetailByKey(key);
if (tyAgent == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到代理商信息");
}
// 查询代理商账户
SecUser account = secUserService.getMainAccount(UserObjectTypeEnum.type6.getType(), tyAgent.getId());
if (account == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到代理商账户信息");
}
account.setPassword(MD5Util.encode("123456".getBytes()));
account.setUpdateTime(new Date());
secUserService.updateUser(account);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public HighTyAgent getDetailById(Long agentId) {
return tyAgentMapper.selectByPrimaryKey(agentId);
}
@Override
public HighTyAgent getDetailByKey(String key) {
HighTyAgentExample example = new HighTyAgentExample();
example.createCriteria().andAgentKeyEqualTo(key).andStatusNotEqualTo(0);
List<HighTyAgent> list = tyAgentMapper.selectByExample(example);
if (list.size() > 0) {
return list.get(0);
}
return null;
}
@Override
public List<HighTyAgent> getAgentList(Map<String, Object> param) {
HighTyAgentExample example = new HighTyAgentExample();
HighTyAgentExample.Criteria criteria = example.createCriteria().andStatusNotEqualTo(0);
if (StringUtils.isNotBlank(MapUtils.getString(param, "agentKey"))) {
criteria.andAgentKeyLike("%" + MapUtils.getString(param, "agentKey") + "%");
}
if (StringUtils.isNotBlank(MapUtils.getString(param, "agentName"))) {
criteria.andAgentNameLike("%" + MapUtils.getString(param, "agentName") + "%");
}
if (StringUtils.isNotBlank(MapUtils.getString(param, "agentUser"))) {
criteria.andAgentUserEqualTo("%" + MapUtils.getString(param, "agentUser") + "%");
}
if (StringUtils.isNotBlank(MapUtils.getString(param, "agentPhone"))) {
criteria.andAgentPhoneLike("%" + MapUtils.getString(param, "agentPhone") + "%");
}
example.setOrderByClause("create_time desc");
return tyAgentMapper.selectByExample(example);
}
}

@ -0,0 +1,179 @@
package com.hai.service.impl;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.utils.MD5Util;
import com.hai.dao.HighTySalesmanMapper;
import com.hai.entity.HighTyAgent;
import com.hai.entity.HighTySalesman;
import com.hai.entity.HighTySalesmanExample;
import com.hai.entity.SecUser;
import com.hai.enum_type.UserObjectTypeEnum;
import com.hai.service.HighTySalesmanService;
import com.hai.service.SecUserService;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Service("highTySalesmanService")
public class HighTySalesmanServiceImpl implements HighTySalesmanService {
@Resource
private HighTySalesmanMapper tySalesmanMapper;
@Resource
private SecUserService secUserService;
@Override
public void editTySalesman(HighTySalesman tySalesman) {
if (tySalesman.getId() == null) {
tySalesman.setCreateTime(new Date());
tySalesman.setUpdateTime(new Date());
tySalesman.setStatus(1);
tySalesmanMapper.insert(tySalesman);
// 生成key
Long key = 2000000 + tySalesman.getId();
tySalesman.setSalesmanKey(key.toString());
tySalesmanMapper.updateByPrimaryKey(tySalesman);
} else {
tySalesman.setUpdateTime(new Date());
tySalesmanMapper.updateByPrimaryKey(tySalesman);
}
}
@Override
public void addSalesman(HighTySalesman tySalesman) {
try {
if (secUserService.findByPhone(tySalesman.getSalesmanPhone()) != null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "手机号已存在,请更换");
}
editTySalesman(tySalesman);
SecUser secUser = new SecUser();
secUser.setUserName(tySalesman.getSalesmanName());
secUser.setLoginName(tySalesman.getSalesmanPhone());
secUser.setPassword(MD5Util.encode("123456".getBytes()));
secUser.setAdminFlag(1);
secUser.setStatus(1);
secUser.setRoleId(8L);
secUser.setObjectType(UserObjectTypeEnum.type7.getType());
secUser.setObjectId(tySalesman.getId());
secUser.setCreateTime(new Date());
secUser.setUpdateTime(new Date());
secUserService.addUser(secUser);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void updateSalesman(HighTySalesman tySalesman) {
// 查询账户
SecUser account = secUserService.getMainAccount(UserObjectTypeEnum.type7.getType(), tySalesman.getId());
if (account == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到账户信息");
}
if (!account.getLoginName().equals(tySalesman.getSalesmanPhone())) {
if (secUserService.findByPhone(tySalesman.getSalesmanPhone()) != null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "手机号已存在,请更换");
}
account.setLoginName(tySalesman.getSalesmanPhone());
}
editTySalesman(tySalesman);
account.setUserName(tySalesman.getSalesmanName());
secUserService.updateUser(account);
}
@Override
@Transactional(propagation= Propagation.REQUIRES_NEW)
public void delSalesman(String key) {
HighTySalesman salesman = getDetailByKey(key);
if (salesman == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到业务员");
}
salesman.setStatus(0);
editTySalesman(salesman);
// 查询代理商账户
SecUser account = secUserService.getMainAccount(UserObjectTypeEnum.type7.getType(), salesman.getId());
if (account == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到业务员账户信息");
}
account.setStatus(0);
secUserService.updateUser(account);
}
@Override
@Transactional(propagation= Propagation.REQUIRES_NEW)
public void salesmanPwdReset(String key) {
try {
HighTySalesman salesman = getDetailByKey(key);
if (salesman == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到业务员");
}
// 查询代理商账户
SecUser account = secUserService.getMainAccount(UserObjectTypeEnum.type7.getType(), salesman.getId());
if (account == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到业务员账户信息");
}
account.setPassword(MD5Util.encode("123456".getBytes()));
secUserService.updateUser(account);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public HighTySalesman getDetailById(Long salesmanId) {
return tySalesmanMapper.selectByPrimaryKey(salesmanId);
}
@Override
public HighTySalesman getDetailByKey(String key) {
HighTySalesmanExample example = new HighTySalesmanExample();
example.createCriteria().andStatusNotEqualTo(0).andSalesmanKeyEqualTo(key);
List<HighTySalesman> list = tySalesmanMapper.selectByExample(example);
if (list.size() > 0) {
return list.get(0);
}
return null;
}
@Override
public List<HighTySalesman> getSalesmanList(Map<String, Object> param) {
HighTySalesmanExample example = new HighTySalesmanExample();
HighTySalesmanExample.Criteria criteria = example.createCriteria().andStatusNotEqualTo(0);
if (MapUtils.getLong(param, "tyAgentId") != null) {
criteria.andTyAgentIdEqualTo(MapUtils.getLong(param, "tyAgentId"));
}
if (StringUtils.isNotBlank(MapUtils.getString(param, "salesmanKey"))) {
criteria.andSalesmanKeyLike("%" + MapUtils.getString(param, "salesmanKey") + "%");
}
if (StringUtils.isNotBlank(MapUtils.getString(param, "salesmanName"))) {
criteria.andSalesmanNameLike("%" + MapUtils.getString(param, "salesmanName") + "%");
}
if (StringUtils.isNotBlank(MapUtils.getString(param, "salesmanPhone"))) {
criteria.andSalesmanPhoneLike("%" + MapUtils.getString(param, "salesmanPhone") + "%");
}
example.setOrderByClause("create_time desc");
return tySalesmanMapper.selectByExample(example);
}
}
Loading…
Cancel
Save