new-dev
parent
8b93147cf6
commit
38dd67f618
@ -0,0 +1,193 @@ |
||||
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.SessionObject; |
||||
import com.hai.common.security.UserCenter; |
||||
import com.hai.common.utils.ResponseMsgUtil; |
||||
import com.hai.entity.*; |
||||
import com.hai.model.ResponseData; |
||||
import com.hai.model.UserInfoModel; |
||||
import com.hai.service.HighAgentService; |
||||
import com.hai.service.HighDiscountPackageAgentService; |
||||
import com.hai.service.HighDiscountPackageService; |
||||
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.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Controller; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import javax.annotation.Resource; |
||||
import javax.servlet.http.HttpServletRequest; |
||||
import java.util.*; |
||||
|
||||
|
||||
@Controller |
||||
@RequestMapping(value = "/discountPackageAgent") |
||||
@Api(value = "优惠券包代理商接口") |
||||
public class HighDiscountPackageAgentController { |
||||
|
||||
private static Logger log = LoggerFactory.getLogger(HighDiscountPackageAgentController.class); |
||||
|
||||
@Resource |
||||
private HighDiscountPackageAgentService discountPackageAgentService; |
||||
|
||||
@Resource |
||||
private HighDiscountPackageService discountPackageService; |
||||
|
||||
@Resource |
||||
private HighAgentService highAgentService; |
||||
|
||||
@Autowired |
||||
private UserCenter userCenter; |
||||
|
||||
@RequestMapping(value="/distribute",method = RequestMethod.POST) |
||||
@ResponseBody |
||||
@ApiOperation(value = "分发优惠券") |
||||
public ResponseData distribute(@RequestBody JSONObject object, HttpServletRequest request) { |
||||
try { |
||||
|
||||
SessionObject sessionObject = userCenter.getSessionObject(request); |
||||
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); |
||||
|
||||
if (object.getLong("agentId") == null || |
||||
object.getInteger("discountPackageId") == null || |
||||
object.getInteger("num") == null) { |
||||
log.error("discountPackageAgent -> distribute() error!","参数错误"); |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
|
||||
HighDiscountPackage discountPackage = discountPackageService.findDiscountPackageById(object.getInteger("discountPackageId")); |
||||
HighAgent agent = highAgentService.findByAgentMsgId(object.getLong("agentId")); |
||||
|
||||
if (object.getLong("parentAgentId") != null) { |
||||
Map<String , Object> mapParent = new HashMap<>(); |
||||
mapParent.put("agentId" , object.getLong("parentAgentId")); |
||||
mapParent.put("discountPackageId" , object.getLong("discountPackageId")); |
||||
HighDiscountPackageAgentRel discountPackageAgentRelParent = discountPackageAgentService.getDetailRelByMap(mapParent); |
||||
|
||||
if (discountPackageAgentRelParent != null && discountPackageAgentRelParent.getStockCount() < object.getInteger("num") ) { |
||||
log.error("discountPackageAgent -> distribute() error!","参数错误"); |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "库存数量不足"); |
||||
} |
||||
|
||||
discountPackageAgentRelParent.setStockCount(discountPackageAgentRelParent.getStockCount()-object.getInteger("num")); |
||||
|
||||
discountPackageAgentService.updateDiscountPackageAgentRel(discountPackageAgentRelParent); |
||||
} |
||||
|
||||
|
||||
if (discountPackage == null) { |
||||
log.error("discountPackageAgent -> distribute() error!","参数错误"); |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "优惠券包不存在"); |
||||
} |
||||
if (agent == null) { |
||||
log.error("discountPackageAgent -> distribute() error!","参数错误"); |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "代理商不存在"); |
||||
} |
||||
|
||||
Map<String , Object> map = new HashMap<>(); |
||||
map.put("agentId" , object.getLong("agentId")); |
||||
map.put("discountPackageId" , object.getLong("discountPackageId")); |
||||
|
||||
HighDiscountPackageAgentRel discountPackageAgentRel = discountPackageAgentService.getDetailRelByMap(map); |
||||
HighDiscountPackageAgentRecord discountPackageAgentRecord = new HighDiscountPackageAgentRecord(); |
||||
|
||||
|
||||
if (discountPackageAgentRel == null) { |
||||
discountPackageAgentRel = new HighDiscountPackageAgentRel(); |
||||
discountPackageAgentRel.setStatus(1); |
||||
discountPackageAgentRel.setOpId(userInfoModel.getSecUser().getId()); |
||||
discountPackageAgentRel.setOpName(userInfoModel.getSecUser().getLoginName()); |
||||
discountPackageAgentRel.setAgentId(object.getLong("agentId")); |
||||
discountPackageAgentRel.setAgentName(agent.getAgentName()); |
||||
discountPackageAgentRel.setDiscountPackageId(object.getLong("discountPackageId")); |
||||
discountPackageAgentRel.setDiscountPackageTitle(discountPackage.getTitle()); |
||||
discountPackageAgentRel.setSalesCount(0); |
||||
discountPackageAgentRel.setStockCount(0); |
||||
discountPackageAgentRel.setCreateTime(new Date()); |
||||
discountPackageAgentRel.setUpdateTime(new Date()); |
||||
} |
||||
discountPackageAgentRel.setStockCount(object.getInteger("num") + discountPackageAgentRel.getStockCount()); |
||||
|
||||
if (discountPackageAgentRel.getId() == null) { |
||||
discountPackageAgentService.insertDiscountPackageAgentRel(discountPackageAgentRel); |
||||
} else { |
||||
discountPackageAgentRel.setUpdateTime(new Date()); |
||||
discountPackageAgentService.updateDiscountPackageAgentRel(discountPackageAgentRel); |
||||
} |
||||
|
||||
discountPackageAgentRecord.setAgentId(object.getLong("agentId")); |
||||
discountPackageAgentRecord.setAgentName(agent.getAgentName()); |
||||
discountPackageAgentRecord.setDiscountPackageId(object.getLong("discountPackageId")); |
||||
discountPackageAgentRecord.setDiscountPackageTitle(discountPackage.getTitle()); |
||||
discountPackageAgentRecord.setCreateTime(new Date()); |
||||
discountPackageAgentRecord.setUpdateTime(new Date()); |
||||
discountPackageAgentRecord.setStatus(1); |
||||
discountPackageAgentRecord.setOpId(userInfoModel.getSecUser().getId()); |
||||
discountPackageAgentRecord.setOpName(userInfoModel.getSecUser().getLoginName()); |
||||
discountPackageAgentRecord.setCount(object.getInteger("num")); |
||||
discountPackageAgentRecord.setAfterCount(discountPackageAgentRel.getStockCount()); |
||||
discountPackageAgentRecord.setFrontCount(discountPackageAgentRel.getStockCount() - object.getInteger("num")); |
||||
|
||||
discountPackageAgentService.insertDiscountPackageAgentRecord(discountPackageAgentRecord); |
||||
|
||||
|
||||
return ResponseMsgUtil.success("操作成功"); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("HighDiscountCouponRelController -> insertDiscountCoupon() error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value = "/getDiscountPackageAgentRelList", method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "获取优惠券包代理商关联列表") |
||||
public ResponseData getDiscountPackageAgentRelList(@RequestParam(name = "agentId", required = false) Long agentId) { |
||||
try { |
||||
|
||||
Map<String,Object> map = new HashMap<>(); |
||||
|
||||
map.put("agentId",agentId); |
||||
|
||||
List<HighDiscountPackageAgentRel> list = discountPackageAgentService.getListRel(map); |
||||
|
||||
return ResponseMsgUtil.success(list); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("HighOrderController --> getUserOrderList() error!", e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value = "/getDiscountPackageAgentRecord", method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "获取优惠券包代理商分发记录列表") |
||||
public ResponseData getDiscountPackageAgentRecord(@RequestParam(name = "agentId", required = false) Long agentId,@RequestParam(name = "discountPackageId", required = false) Long discountPackageId) { |
||||
try { |
||||
|
||||
Map<String,Object> map = new HashMap<>(); |
||||
|
||||
map.put("agentId",agentId); |
||||
map.put("discountPackageId",discountPackageId); |
||||
|
||||
List<HighDiscountPackageAgentRecord> list = discountPackageAgentService.getListRecord(map); |
||||
|
||||
return ResponseMsgUtil.success(list); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("HighOrderController --> getUserOrderList() error!", e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,142 @@ |
||||
package com.hai.dao; |
||||
|
||||
import com.hai.entity.HighDiscountPackageAgentRecord; |
||||
import com.hai.entity.HighDiscountPackageAgentRecordExample; |
||||
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 HighDiscountPackageAgentRecordMapper extends HighDiscountPackageAgentRecordMapperExt { |
||||
@SelectProvider(type=HighDiscountPackageAgentRecordSqlProvider.class, method="countByExample") |
||||
long countByExample(HighDiscountPackageAgentRecordExample example); |
||||
|
||||
@DeleteProvider(type=HighDiscountPackageAgentRecordSqlProvider.class, method="deleteByExample") |
||||
int deleteByExample(HighDiscountPackageAgentRecordExample example); |
||||
|
||||
@Delete({ |
||||
"delete from high_discount_package_agent_record", |
||||
"where id = #{id,jdbcType=BIGINT}" |
||||
}) |
||||
int deleteByPrimaryKey(Long id); |
||||
|
||||
@Insert({ |
||||
"insert into high_discount_package_agent_record (discount_package_title, discount_package_id, ", |
||||
"agent_name, agent_id, ", |
||||
"`count`, front_count, ", |
||||
"after_count, create_time, ", |
||||
"update_time, `status`, ", |
||||
"op_id, op_name, ext_1, ", |
||||
"ext_2, ext_3)", |
||||
"values (#{discountPackageTitle,jdbcType=VARCHAR}, #{discountPackageId,jdbcType=BIGINT}, ", |
||||
"#{agentName,jdbcType=VARCHAR}, #{agentId,jdbcType=BIGINT}, ", |
||||
"#{count,jdbcType=INTEGER}, #{frontCount,jdbcType=INTEGER}, ", |
||||
"#{afterCount,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ", |
||||
"#{updateTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}, ", |
||||
"#{opId,jdbcType=BIGINT}, #{opName,jdbcType=VARCHAR}, #{ext1,jdbcType=VARCHAR}, ", |
||||
"#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" |
||||
}) |
||||
@Options(useGeneratedKeys=true,keyProperty="id") |
||||
int insert(HighDiscountPackageAgentRecord record); |
||||
|
||||
@InsertProvider(type=HighDiscountPackageAgentRecordSqlProvider.class, method="insertSelective") |
||||
@Options(useGeneratedKeys=true,keyProperty="id") |
||||
int insertSelective(HighDiscountPackageAgentRecord record); |
||||
|
||||
@SelectProvider(type=HighDiscountPackageAgentRecordSqlProvider.class, method="selectByExample") |
||||
@Results({ |
||||
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), |
||||
@Result(column="discount_package_title", property="discountPackageTitle", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="discount_package_id", property="discountPackageId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="agent_name", property="agentName", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="agent_id", property="agentId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="count", property="count", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="front_count", property="frontCount", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="after_count", property="afterCount", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="op_id", property="opId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="op_name", property="opName", jdbcType=JdbcType.VARCHAR), |
||||
@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<HighDiscountPackageAgentRecord> selectByExample(HighDiscountPackageAgentRecordExample example); |
||||
|
||||
@Select({ |
||||
"select", |
||||
"id, discount_package_title, discount_package_id, agent_name, agent_id, `count`, ", |
||||
"front_count, after_count, create_time, update_time, `status`, op_id, op_name, ", |
||||
"ext_1, ext_2, ext_3", |
||||
"from high_discount_package_agent_record", |
||||
"where id = #{id,jdbcType=BIGINT}" |
||||
}) |
||||
@Results({ |
||||
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), |
||||
@Result(column="discount_package_title", property="discountPackageTitle", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="discount_package_id", property="discountPackageId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="agent_name", property="agentName", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="agent_id", property="agentId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="count", property="count", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="front_count", property="frontCount", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="after_count", property="afterCount", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="op_id", property="opId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="op_name", property="opName", jdbcType=JdbcType.VARCHAR), |
||||
@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) |
||||
}) |
||||
HighDiscountPackageAgentRecord selectByPrimaryKey(Long id); |
||||
|
||||
@UpdateProvider(type=HighDiscountPackageAgentRecordSqlProvider.class, method="updateByExampleSelective") |
||||
int updateByExampleSelective(@Param("record") HighDiscountPackageAgentRecord record, @Param("example") HighDiscountPackageAgentRecordExample example); |
||||
|
||||
@UpdateProvider(type=HighDiscountPackageAgentRecordSqlProvider.class, method="updateByExample") |
||||
int updateByExample(@Param("record") HighDiscountPackageAgentRecord record, @Param("example") HighDiscountPackageAgentRecordExample example); |
||||
|
||||
@UpdateProvider(type=HighDiscountPackageAgentRecordSqlProvider.class, method="updateByPrimaryKeySelective") |
||||
int updateByPrimaryKeySelective(HighDiscountPackageAgentRecord record); |
||||
|
||||
@Update({ |
||||
"update high_discount_package_agent_record", |
||||
"set discount_package_title = #{discountPackageTitle,jdbcType=VARCHAR},", |
||||
"discount_package_id = #{discountPackageId,jdbcType=BIGINT},", |
||||
"agent_name = #{agentName,jdbcType=VARCHAR},", |
||||
"agent_id = #{agentId,jdbcType=BIGINT},", |
||||
"`count` = #{count,jdbcType=INTEGER},", |
||||
"front_count = #{frontCount,jdbcType=INTEGER},", |
||||
"after_count = #{afterCount,jdbcType=INTEGER},", |
||||
"create_time = #{createTime,jdbcType=TIMESTAMP},", |
||||
"update_time = #{updateTime,jdbcType=TIMESTAMP},", |
||||
"`status` = #{status,jdbcType=INTEGER},", |
||||
"op_id = #{opId,jdbcType=BIGINT},", |
||||
"op_name = #{opName,jdbcType=VARCHAR},", |
||||
"ext_1 = #{ext1,jdbcType=VARCHAR},", |
||||
"ext_2 = #{ext2,jdbcType=VARCHAR},", |
||||
"ext_3 = #{ext3,jdbcType=VARCHAR}", |
||||
"where id = #{id,jdbcType=BIGINT}" |
||||
}) |
||||
int updateByPrimaryKey(HighDiscountPackageAgentRecord record); |
||||
} |
@ -0,0 +1,7 @@ |
||||
package com.hai.dao; |
||||
|
||||
/** |
||||
* mapper扩展类 |
||||
*/ |
||||
public interface HighDiscountPackageAgentRecordMapperExt { |
||||
} |
@ -0,0 +1,388 @@ |
||||
package com.hai.dao; |
||||
|
||||
import com.hai.entity.HighDiscountPackageAgentRecord; |
||||
import com.hai.entity.HighDiscountPackageAgentRecordExample.Criteria; |
||||
import com.hai.entity.HighDiscountPackageAgentRecordExample.Criterion; |
||||
import com.hai.entity.HighDiscountPackageAgentRecordExample; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
import org.apache.ibatis.jdbc.SQL; |
||||
|
||||
public class HighDiscountPackageAgentRecordSqlProvider { |
||||
|
||||
public String countByExample(HighDiscountPackageAgentRecordExample example) { |
||||
SQL sql = new SQL(); |
||||
sql.SELECT("count(*)").FROM("high_discount_package_agent_record"); |
||||
applyWhere(sql, example, false); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String deleteByExample(HighDiscountPackageAgentRecordExample example) { |
||||
SQL sql = new SQL(); |
||||
sql.DELETE_FROM("high_discount_package_agent_record"); |
||||
applyWhere(sql, example, false); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String insertSelective(HighDiscountPackageAgentRecord record) { |
||||
SQL sql = new SQL(); |
||||
sql.INSERT_INTO("high_discount_package_agent_record"); |
||||
|
||||
if (record.getDiscountPackageTitle() != null) { |
||||
sql.VALUES("discount_package_title", "#{discountPackageTitle,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getDiscountPackageId() != null) { |
||||
sql.VALUES("discount_package_id", "#{discountPackageId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getAgentName() != null) { |
||||
sql.VALUES("agent_name", "#{agentName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getAgentId() != null) { |
||||
sql.VALUES("agent_id", "#{agentId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getCount() != null) { |
||||
sql.VALUES("`count`", "#{count,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getFrontCount() != null) { |
||||
sql.VALUES("front_count", "#{frontCount,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getAfterCount() != null) { |
||||
sql.VALUES("after_count", "#{afterCount,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.getStatus() != null) { |
||||
sql.VALUES("`status`", "#{status,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getOpId() != null) { |
||||
sql.VALUES("op_id", "#{opId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getOpName() != null) { |
||||
sql.VALUES("op_name", "#{opName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
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(HighDiscountPackageAgentRecordExample example) { |
||||
SQL sql = new SQL(); |
||||
if (example != null && example.isDistinct()) { |
||||
sql.SELECT_DISTINCT("id"); |
||||
} else { |
||||
sql.SELECT("id"); |
||||
} |
||||
sql.SELECT("discount_package_title"); |
||||
sql.SELECT("discount_package_id"); |
||||
sql.SELECT("agent_name"); |
||||
sql.SELECT("agent_id"); |
||||
sql.SELECT("`count`"); |
||||
sql.SELECT("front_count"); |
||||
sql.SELECT("after_count"); |
||||
sql.SELECT("create_time"); |
||||
sql.SELECT("update_time"); |
||||
sql.SELECT("`status`"); |
||||
sql.SELECT("op_id"); |
||||
sql.SELECT("op_name"); |
||||
sql.SELECT("ext_1"); |
||||
sql.SELECT("ext_2"); |
||||
sql.SELECT("ext_3"); |
||||
sql.FROM("high_discount_package_agent_record"); |
||||
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) { |
||||
HighDiscountPackageAgentRecord record = (HighDiscountPackageAgentRecord) parameter.get("record"); |
||||
HighDiscountPackageAgentRecordExample example = (HighDiscountPackageAgentRecordExample) parameter.get("example"); |
||||
|
||||
SQL sql = new SQL(); |
||||
sql.UPDATE("high_discount_package_agent_record"); |
||||
|
||||
if (record.getId() != null) { |
||||
sql.SET("id = #{record.id,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getDiscountPackageTitle() != null) { |
||||
sql.SET("discount_package_title = #{record.discountPackageTitle,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getDiscountPackageId() != null) { |
||||
sql.SET("discount_package_id = #{record.discountPackageId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getAgentName() != null) { |
||||
sql.SET("agent_name = #{record.agentName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getAgentId() != null) { |
||||
sql.SET("agent_id = #{record.agentId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getCount() != null) { |
||||
sql.SET("`count` = #{record.count,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getFrontCount() != null) { |
||||
sql.SET("front_count = #{record.frontCount,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getAfterCount() != null) { |
||||
sql.SET("after_count = #{record.afterCount,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.getStatus() != null) { |
||||
sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getOpId() != null) { |
||||
sql.SET("op_id = #{record.opId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getOpName() != null) { |
||||
sql.SET("op_name = #{record.opName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
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_discount_package_agent_record"); |
||||
|
||||
sql.SET("id = #{record.id,jdbcType=BIGINT}"); |
||||
sql.SET("discount_package_title = #{record.discountPackageTitle,jdbcType=VARCHAR}"); |
||||
sql.SET("discount_package_id = #{record.discountPackageId,jdbcType=BIGINT}"); |
||||
sql.SET("agent_name = #{record.agentName,jdbcType=VARCHAR}"); |
||||
sql.SET("agent_id = #{record.agentId,jdbcType=BIGINT}"); |
||||
sql.SET("`count` = #{record.count,jdbcType=INTEGER}"); |
||||
sql.SET("front_count = #{record.frontCount,jdbcType=INTEGER}"); |
||||
sql.SET("after_count = #{record.afterCount,jdbcType=INTEGER}"); |
||||
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); |
||||
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}"); |
||||
sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); |
||||
sql.SET("op_id = #{record.opId,jdbcType=BIGINT}"); |
||||
sql.SET("op_name = #{record.opName,jdbcType=VARCHAR}"); |
||||
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); |
||||
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}"); |
||||
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); |
||||
|
||||
HighDiscountPackageAgentRecordExample example = (HighDiscountPackageAgentRecordExample) parameter.get("example"); |
||||
applyWhere(sql, example, true); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String updateByPrimaryKeySelective(HighDiscountPackageAgentRecord record) { |
||||
SQL sql = new SQL(); |
||||
sql.UPDATE("high_discount_package_agent_record"); |
||||
|
||||
if (record.getDiscountPackageTitle() != null) { |
||||
sql.SET("discount_package_title = #{discountPackageTitle,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getDiscountPackageId() != null) { |
||||
sql.SET("discount_package_id = #{discountPackageId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getAgentName() != null) { |
||||
sql.SET("agent_name = #{agentName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getAgentId() != null) { |
||||
sql.SET("agent_id = #{agentId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getCount() != null) { |
||||
sql.SET("`count` = #{count,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getFrontCount() != null) { |
||||
sql.SET("front_count = #{frontCount,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getAfterCount() != null) { |
||||
sql.SET("after_count = #{afterCount,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.getStatus() != null) { |
||||
sql.SET("`status` = #{status,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getOpId() != null) { |
||||
sql.SET("op_id = #{opId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getOpName() != null) { |
||||
sql.SET("op_name = #{opName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
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, HighDiscountPackageAgentRecordExample 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,137 @@ |
||||
package com.hai.dao; |
||||
|
||||
import com.hai.entity.HighDiscountPackageAgentRel; |
||||
import com.hai.entity.HighDiscountPackageAgentRelExample; |
||||
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 HighDiscountPackageAgentRelMapper extends HighDiscountPackageAgentRelMapperExt { |
||||
@SelectProvider(type=HighDiscountPackageAgentRelSqlProvider.class, method="countByExample") |
||||
long countByExample(HighDiscountPackageAgentRelExample example); |
||||
|
||||
@DeleteProvider(type=HighDiscountPackageAgentRelSqlProvider.class, method="deleteByExample") |
||||
int deleteByExample(HighDiscountPackageAgentRelExample example); |
||||
|
||||
@Delete({ |
||||
"delete from high_discount_package_agent_rel", |
||||
"where id = #{id,jdbcType=BIGINT}" |
||||
}) |
||||
int deleteByPrimaryKey(Long id); |
||||
|
||||
@Insert({ |
||||
"insert into high_discount_package_agent_rel (discount_package_title, discount_package_id, ", |
||||
"agent_name, agent_id, ", |
||||
"stock_count, sales_count, ", |
||||
"create_time, update_time, ", |
||||
"`status`, op_id, op_name, ", |
||||
"ext_1, ext_2, ext_3)", |
||||
"values (#{discountPackageTitle,jdbcType=VARCHAR}, #{discountPackageId,jdbcType=BIGINT}, ", |
||||
"#{agentName,jdbcType=VARCHAR}, #{agentId,jdbcType=BIGINT}, ", |
||||
"#{stockCount,jdbcType=INTEGER}, #{salesCount,jdbcType=INTEGER}, ", |
||||
"#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ", |
||||
"#{status,jdbcType=INTEGER}, #{opId,jdbcType=BIGINT}, #{opName,jdbcType=VARCHAR}, ", |
||||
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" |
||||
}) |
||||
@Options(useGeneratedKeys=true,keyProperty="id") |
||||
int insert(HighDiscountPackageAgentRel record); |
||||
|
||||
@InsertProvider(type=HighDiscountPackageAgentRelSqlProvider.class, method="insertSelective") |
||||
@Options(useGeneratedKeys=true,keyProperty="id") |
||||
int insertSelective(HighDiscountPackageAgentRel record); |
||||
|
||||
@SelectProvider(type=HighDiscountPackageAgentRelSqlProvider.class, method="selectByExample") |
||||
@Results({ |
||||
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), |
||||
@Result(column="discount_package_title", property="discountPackageTitle", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="discount_package_id", property="discountPackageId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="agent_name", property="agentName", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="agent_id", property="agentId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="stock_count", property="stockCount", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="sales_count", property="salesCount", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="op_id", property="opId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="op_name", property="opName", jdbcType=JdbcType.VARCHAR), |
||||
@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<HighDiscountPackageAgentRel> selectByExample(HighDiscountPackageAgentRelExample example); |
||||
|
||||
@Select({ |
||||
"select", |
||||
"id, discount_package_title, discount_package_id, agent_name, agent_id, stock_count, ", |
||||
"sales_count, create_time, update_time, `status`, op_id, op_name, ext_1, ext_2, ", |
||||
"ext_3", |
||||
"from high_discount_package_agent_rel", |
||||
"where id = #{id,jdbcType=BIGINT}" |
||||
}) |
||||
@Results({ |
||||
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), |
||||
@Result(column="discount_package_title", property="discountPackageTitle", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="discount_package_id", property="discountPackageId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="agent_name", property="agentName", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="agent_id", property="agentId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="stock_count", property="stockCount", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="sales_count", property="salesCount", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="op_id", property="opId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="op_name", property="opName", jdbcType=JdbcType.VARCHAR), |
||||
@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) |
||||
}) |
||||
HighDiscountPackageAgentRel selectByPrimaryKey(Long id); |
||||
|
||||
@UpdateProvider(type=HighDiscountPackageAgentRelSqlProvider.class, method="updateByExampleSelective") |
||||
int updateByExampleSelective(@Param("record") HighDiscountPackageAgentRel record, @Param("example") HighDiscountPackageAgentRelExample example); |
||||
|
||||
@UpdateProvider(type=HighDiscountPackageAgentRelSqlProvider.class, method="updateByExample") |
||||
int updateByExample(@Param("record") HighDiscountPackageAgentRel record, @Param("example") HighDiscountPackageAgentRelExample example); |
||||
|
||||
@UpdateProvider(type=HighDiscountPackageAgentRelSqlProvider.class, method="updateByPrimaryKeySelective") |
||||
int updateByPrimaryKeySelective(HighDiscountPackageAgentRel record); |
||||
|
||||
@Update({ |
||||
"update high_discount_package_agent_rel", |
||||
"set discount_package_title = #{discountPackageTitle,jdbcType=VARCHAR},", |
||||
"discount_package_id = #{discountPackageId,jdbcType=BIGINT},", |
||||
"agent_name = #{agentName,jdbcType=VARCHAR},", |
||||
"agent_id = #{agentId,jdbcType=BIGINT},", |
||||
"stock_count = #{stockCount,jdbcType=INTEGER},", |
||||
"sales_count = #{salesCount,jdbcType=INTEGER},", |
||||
"create_time = #{createTime,jdbcType=TIMESTAMP},", |
||||
"update_time = #{updateTime,jdbcType=TIMESTAMP},", |
||||
"`status` = #{status,jdbcType=INTEGER},", |
||||
"op_id = #{opId,jdbcType=BIGINT},", |
||||
"op_name = #{opName,jdbcType=VARCHAR},", |
||||
"ext_1 = #{ext1,jdbcType=VARCHAR},", |
||||
"ext_2 = #{ext2,jdbcType=VARCHAR},", |
||||
"ext_3 = #{ext3,jdbcType=VARCHAR}", |
||||
"where id = #{id,jdbcType=BIGINT}" |
||||
}) |
||||
int updateByPrimaryKey(HighDiscountPackageAgentRel record); |
||||
} |
@ -0,0 +1,7 @@ |
||||
package com.hai.dao; |
||||
|
||||
/** |
||||
* mapper扩展类 |
||||
*/ |
||||
public interface HighDiscountPackageAgentRelMapperExt { |
||||
} |
@ -0,0 +1,374 @@ |
||||
package com.hai.dao; |
||||
|
||||
import com.hai.entity.HighDiscountPackageAgentRel; |
||||
import com.hai.entity.HighDiscountPackageAgentRelExample.Criteria; |
||||
import com.hai.entity.HighDiscountPackageAgentRelExample.Criterion; |
||||
import com.hai.entity.HighDiscountPackageAgentRelExample; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
import org.apache.ibatis.jdbc.SQL; |
||||
|
||||
public class HighDiscountPackageAgentRelSqlProvider { |
||||
|
||||
public String countByExample(HighDiscountPackageAgentRelExample example) { |
||||
SQL sql = new SQL(); |
||||
sql.SELECT("count(*)").FROM("high_discount_package_agent_rel"); |
||||
applyWhere(sql, example, false); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String deleteByExample(HighDiscountPackageAgentRelExample example) { |
||||
SQL sql = new SQL(); |
||||
sql.DELETE_FROM("high_discount_package_agent_rel"); |
||||
applyWhere(sql, example, false); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String insertSelective(HighDiscountPackageAgentRel record) { |
||||
SQL sql = new SQL(); |
||||
sql.INSERT_INTO("high_discount_package_agent_rel"); |
||||
|
||||
if (record.getDiscountPackageTitle() != null) { |
||||
sql.VALUES("discount_package_title", "#{discountPackageTitle,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getDiscountPackageId() != null) { |
||||
sql.VALUES("discount_package_id", "#{discountPackageId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getAgentName() != null) { |
||||
sql.VALUES("agent_name", "#{agentName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getAgentId() != null) { |
||||
sql.VALUES("agent_id", "#{agentId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getStockCount() != null) { |
||||
sql.VALUES("stock_count", "#{stockCount,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getSalesCount() != null) { |
||||
sql.VALUES("sales_count", "#{salesCount,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.getStatus() != null) { |
||||
sql.VALUES("`status`", "#{status,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getOpId() != null) { |
||||
sql.VALUES("op_id", "#{opId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getOpName() != null) { |
||||
sql.VALUES("op_name", "#{opName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
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(HighDiscountPackageAgentRelExample example) { |
||||
SQL sql = new SQL(); |
||||
if (example != null && example.isDistinct()) { |
||||
sql.SELECT_DISTINCT("id"); |
||||
} else { |
||||
sql.SELECT("id"); |
||||
} |
||||
sql.SELECT("discount_package_title"); |
||||
sql.SELECT("discount_package_id"); |
||||
sql.SELECT("agent_name"); |
||||
sql.SELECT("agent_id"); |
||||
sql.SELECT("stock_count"); |
||||
sql.SELECT("sales_count"); |
||||
sql.SELECT("create_time"); |
||||
sql.SELECT("update_time"); |
||||
sql.SELECT("`status`"); |
||||
sql.SELECT("op_id"); |
||||
sql.SELECT("op_name"); |
||||
sql.SELECT("ext_1"); |
||||
sql.SELECT("ext_2"); |
||||
sql.SELECT("ext_3"); |
||||
sql.FROM("high_discount_package_agent_rel"); |
||||
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) { |
||||
HighDiscountPackageAgentRel record = (HighDiscountPackageAgentRel) parameter.get("record"); |
||||
HighDiscountPackageAgentRelExample example = (HighDiscountPackageAgentRelExample) parameter.get("example"); |
||||
|
||||
SQL sql = new SQL(); |
||||
sql.UPDATE("high_discount_package_agent_rel"); |
||||
|
||||
if (record.getId() != null) { |
||||
sql.SET("id = #{record.id,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getDiscountPackageTitle() != null) { |
||||
sql.SET("discount_package_title = #{record.discountPackageTitle,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getDiscountPackageId() != null) { |
||||
sql.SET("discount_package_id = #{record.discountPackageId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getAgentName() != null) { |
||||
sql.SET("agent_name = #{record.agentName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getAgentId() != null) { |
||||
sql.SET("agent_id = #{record.agentId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getStockCount() != null) { |
||||
sql.SET("stock_count = #{record.stockCount,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getSalesCount() != null) { |
||||
sql.SET("sales_count = #{record.salesCount,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.getStatus() != null) { |
||||
sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getOpId() != null) { |
||||
sql.SET("op_id = #{record.opId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getOpName() != null) { |
||||
sql.SET("op_name = #{record.opName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
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_discount_package_agent_rel"); |
||||
|
||||
sql.SET("id = #{record.id,jdbcType=BIGINT}"); |
||||
sql.SET("discount_package_title = #{record.discountPackageTitle,jdbcType=VARCHAR}"); |
||||
sql.SET("discount_package_id = #{record.discountPackageId,jdbcType=BIGINT}"); |
||||
sql.SET("agent_name = #{record.agentName,jdbcType=VARCHAR}"); |
||||
sql.SET("agent_id = #{record.agentId,jdbcType=BIGINT}"); |
||||
sql.SET("stock_count = #{record.stockCount,jdbcType=INTEGER}"); |
||||
sql.SET("sales_count = #{record.salesCount,jdbcType=INTEGER}"); |
||||
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); |
||||
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}"); |
||||
sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); |
||||
sql.SET("op_id = #{record.opId,jdbcType=BIGINT}"); |
||||
sql.SET("op_name = #{record.opName,jdbcType=VARCHAR}"); |
||||
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); |
||||
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}"); |
||||
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); |
||||
|
||||
HighDiscountPackageAgentRelExample example = (HighDiscountPackageAgentRelExample) parameter.get("example"); |
||||
applyWhere(sql, example, true); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String updateByPrimaryKeySelective(HighDiscountPackageAgentRel record) { |
||||
SQL sql = new SQL(); |
||||
sql.UPDATE("high_discount_package_agent_rel"); |
||||
|
||||
if (record.getDiscountPackageTitle() != null) { |
||||
sql.SET("discount_package_title = #{discountPackageTitle,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getDiscountPackageId() != null) { |
||||
sql.SET("discount_package_id = #{discountPackageId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getAgentName() != null) { |
||||
sql.SET("agent_name = #{agentName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getAgentId() != null) { |
||||
sql.SET("agent_id = #{agentId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getStockCount() != null) { |
||||
sql.SET("stock_count = #{stockCount,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getSalesCount() != null) { |
||||
sql.SET("sales_count = #{salesCount,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.getStatus() != null) { |
||||
sql.SET("`status` = #{status,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getOpId() != null) { |
||||
sql.SET("op_id = #{opId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getOpName() != null) { |
||||
sql.SET("op_name = #{opName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
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, HighDiscountPackageAgentRelExample 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,305 @@ |
||||
package com.hai.entity; |
||||
|
||||
import java.io.Serializable; |
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* high_discount_package_agent_record |
||||
* @author |
||||
*/ |
||||
/** |
||||
* |
||||
* 代码由工具生成 |
||||
* |
||||
**/ |
||||
public class HighDiscountPackageAgentRecord implements Serializable { |
||||
/** |
||||
* 主键 |
||||
*/ |
||||
private Long id; |
||||
|
||||
/** |
||||
* 优惠券包名称 |
||||
*/ |
||||
private String discountPackageTitle; |
||||
|
||||
/** |
||||
* 优惠券包id |
||||
*/ |
||||
private Long discountPackageId; |
||||
|
||||
/** |
||||
* 代理商名称 |
||||
*/ |
||||
private String agentName; |
||||
|
||||
/** |
||||
* 代理商id |
||||
*/ |
||||
private Long agentId; |
||||
|
||||
/** |
||||
* 分发数量 |
||||
*/ |
||||
private Integer count; |
||||
|
||||
/** |
||||
* 分发前数量 |
||||
*/ |
||||
private Integer frontCount; |
||||
|
||||
/** |
||||
* 分发后数量 |
||||
*/ |
||||
private Integer afterCount; |
||||
|
||||
/** |
||||
* 创建时间 |
||||
*/ |
||||
private Date createTime; |
||||
|
||||
/** |
||||
* 更新时间 |
||||
*/ |
||||
private Date updateTime; |
||||
|
||||
/** |
||||
* 状态 |
||||
*/ |
||||
private Integer status; |
||||
|
||||
/** |
||||
* 操作人 |
||||
*/ |
||||
private Long opId; |
||||
|
||||
/** |
||||
* 操作人名称 |
||||
*/ |
||||
private String opName; |
||||
|
||||
/** |
||||
* ext_1 |
||||
*/ |
||||
private String ext1; |
||||
|
||||
/** |
||||
* ext_2 |
||||
*/ |
||||
private String ext2; |
||||
|
||||
/** |
||||
* ext_3 |
||||
*/ |
||||
private String ext3; |
||||
|
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
public Long getId() { |
||||
return id; |
||||
} |
||||
|
||||
public void setId(Long id) { |
||||
this.id = id; |
||||
} |
||||
|
||||
public String getDiscountPackageTitle() { |
||||
return discountPackageTitle; |
||||
} |
||||
|
||||
public void setDiscountPackageTitle(String discountPackageTitle) { |
||||
this.discountPackageTitle = discountPackageTitle; |
||||
} |
||||
|
||||
public Long getDiscountPackageId() { |
||||
return discountPackageId; |
||||
} |
||||
|
||||
public void setDiscountPackageId(Long discountPackageId) { |
||||
this.discountPackageId = discountPackageId; |
||||
} |
||||
|
||||
public String getAgentName() { |
||||
return agentName; |
||||
} |
||||
|
||||
public void setAgentName(String agentName) { |
||||
this.agentName = agentName; |
||||
} |
||||
|
||||
public Long getAgentId() { |
||||
return agentId; |
||||
} |
||||
|
||||
public void setAgentId(Long agentId) { |
||||
this.agentId = agentId; |
||||
} |
||||
|
||||
public Integer getCount() { |
||||
return count; |
||||
} |
||||
|
||||
public void setCount(Integer count) { |
||||
this.count = count; |
||||
} |
||||
|
||||
public Integer getFrontCount() { |
||||
return frontCount; |
||||
} |
||||
|
||||
public void setFrontCount(Integer frontCount) { |
||||
this.frontCount = frontCount; |
||||
} |
||||
|
||||
public Integer getAfterCount() { |
||||
return afterCount; |
||||
} |
||||
|
||||
public void setAfterCount(Integer afterCount) { |
||||
this.afterCount = afterCount; |
||||
} |
||||
|
||||
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 Integer getStatus() { |
||||
return status; |
||||
} |
||||
|
||||
public void setStatus(Integer status) { |
||||
this.status = status; |
||||
} |
||||
|
||||
public Long getOpId() { |
||||
return opId; |
||||
} |
||||
|
||||
public void setOpId(Long opId) { |
||||
this.opId = opId; |
||||
} |
||||
|
||||
public String getOpName() { |
||||
return opName; |
||||
} |
||||
|
||||
public void setOpName(String opName) { |
||||
this.opName = opName; |
||||
} |
||||
|
||||
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; |
||||
} |
||||
HighDiscountPackageAgentRecord other = (HighDiscountPackageAgentRecord) that; |
||||
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) |
||||
&& (this.getDiscountPackageTitle() == null ? other.getDiscountPackageTitle() == null : this.getDiscountPackageTitle().equals(other.getDiscountPackageTitle())) |
||||
&& (this.getDiscountPackageId() == null ? other.getDiscountPackageId() == null : this.getDiscountPackageId().equals(other.getDiscountPackageId())) |
||||
&& (this.getAgentName() == null ? other.getAgentName() == null : this.getAgentName().equals(other.getAgentName())) |
||||
&& (this.getAgentId() == null ? other.getAgentId() == null : this.getAgentId().equals(other.getAgentId())) |
||||
&& (this.getCount() == null ? other.getCount() == null : this.getCount().equals(other.getCount())) |
||||
&& (this.getFrontCount() == null ? other.getFrontCount() == null : this.getFrontCount().equals(other.getFrontCount())) |
||||
&& (this.getAfterCount() == null ? other.getAfterCount() == null : this.getAfterCount().equals(other.getAfterCount())) |
||||
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) |
||||
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime())) |
||||
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus())) |
||||
&& (this.getOpId() == null ? other.getOpId() == null : this.getOpId().equals(other.getOpId())) |
||||
&& (this.getOpName() == null ? other.getOpName() == null : this.getOpName().equals(other.getOpName())) |
||||
&& (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 + ((getDiscountPackageTitle() == null) ? 0 : getDiscountPackageTitle().hashCode()); |
||||
result = prime * result + ((getDiscountPackageId() == null) ? 0 : getDiscountPackageId().hashCode()); |
||||
result = prime * result + ((getAgentName() == null) ? 0 : getAgentName().hashCode()); |
||||
result = prime * result + ((getAgentId() == null) ? 0 : getAgentId().hashCode()); |
||||
result = prime * result + ((getCount() == null) ? 0 : getCount().hashCode()); |
||||
result = prime * result + ((getFrontCount() == null) ? 0 : getFrontCount().hashCode()); |
||||
result = prime * result + ((getAfterCount() == null) ? 0 : getAfterCount().hashCode()); |
||||
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); |
||||
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode()); |
||||
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode()); |
||||
result = prime * result + ((getOpId() == null) ? 0 : getOpId().hashCode()); |
||||
result = prime * result + ((getOpName() == null) ? 0 : getOpName().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(", discountPackageTitle=").append(discountPackageTitle); |
||||
sb.append(", discountPackageId=").append(discountPackageId); |
||||
sb.append(", agentName=").append(agentName); |
||||
sb.append(", agentId=").append(agentId); |
||||
sb.append(", count=").append(count); |
||||
sb.append(", frontCount=").append(frontCount); |
||||
sb.append(", afterCount=").append(afterCount); |
||||
sb.append(", createTime=").append(createTime); |
||||
sb.append(", updateTime=").append(updateTime); |
||||
sb.append(", status=").append(status); |
||||
sb.append(", opId=").append(opId); |
||||
sb.append(", opName=").append(opName); |
||||
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(); |
||||
} |
||||
} |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,289 @@ |
||||
package com.hai.entity; |
||||
|
||||
import java.io.Serializable; |
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* high_discount_package_agent_rel |
||||
* @author |
||||
*/ |
||||
/** |
||||
* |
||||
* 代码由工具生成 |
||||
* |
||||
**/ |
||||
public class HighDiscountPackageAgentRel implements Serializable { |
||||
/** |
||||
* 主键 |
||||
*/ |
||||
private Long id; |
||||
|
||||
/** |
||||
* 优惠券包名称 |
||||
*/ |
||||
private String discountPackageTitle; |
||||
|
||||
/** |
||||
* 优惠券包id |
||||
*/ |
||||
private Long discountPackageId; |
||||
|
||||
/** |
||||
* 代理商名称 |
||||
*/ |
||||
private String agentName; |
||||
|
||||
/** |
||||
* 代理商id |
||||
*/ |
||||
private Long agentId; |
||||
|
||||
/** |
||||
* 库存数量 |
||||
*/ |
||||
private Integer stockCount; |
||||
|
||||
/** |
||||
* 销售数量 |
||||
*/ |
||||
private Integer salesCount; |
||||
|
||||
/** |
||||
* 创建时间 |
||||
*/ |
||||
private Date createTime; |
||||
|
||||
/** |
||||
* 更新时间 |
||||
*/ |
||||
private Date updateTime; |
||||
|
||||
/** |
||||
* 状态 |
||||
*/ |
||||
private Integer status; |
||||
|
||||
/** |
||||
* 操作人 |
||||
*/ |
||||
private Long opId; |
||||
|
||||
/** |
||||
* 操作人名称 |
||||
*/ |
||||
private String opName; |
||||
|
||||
/** |
||||
* ext_1 |
||||
*/ |
||||
private String ext1; |
||||
|
||||
/** |
||||
* ext_2 |
||||
*/ |
||||
private String ext2; |
||||
|
||||
/** |
||||
* ext_3 |
||||
*/ |
||||
private String ext3; |
||||
|
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
public Long getId() { |
||||
return id; |
||||
} |
||||
|
||||
public void setId(Long id) { |
||||
this.id = id; |
||||
} |
||||
|
||||
public String getDiscountPackageTitle() { |
||||
return discountPackageTitle; |
||||
} |
||||
|
||||
public void setDiscountPackageTitle(String discountPackageTitle) { |
||||
this.discountPackageTitle = discountPackageTitle; |
||||
} |
||||
|
||||
public Long getDiscountPackageId() { |
||||
return discountPackageId; |
||||
} |
||||
|
||||
public void setDiscountPackageId(Long discountPackageId) { |
||||
this.discountPackageId = discountPackageId; |
||||
} |
||||
|
||||
public String getAgentName() { |
||||
return agentName; |
||||
} |
||||
|
||||
public void setAgentName(String agentName) { |
||||
this.agentName = agentName; |
||||
} |
||||
|
||||
public Long getAgentId() { |
||||
return agentId; |
||||
} |
||||
|
||||
public void setAgentId(Long agentId) { |
||||
this.agentId = agentId; |
||||
} |
||||
|
||||
public Integer getStockCount() { |
||||
return stockCount; |
||||
} |
||||
|
||||
public void setStockCount(Integer stockCount) { |
||||
this.stockCount = stockCount; |
||||
} |
||||
|
||||
public Integer getSalesCount() { |
||||
return salesCount; |
||||
} |
||||
|
||||
public void setSalesCount(Integer salesCount) { |
||||
this.salesCount = salesCount; |
||||
} |
||||
|
||||
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 Integer getStatus() { |
||||
return status; |
||||
} |
||||
|
||||
public void setStatus(Integer status) { |
||||
this.status = status; |
||||
} |
||||
|
||||
public Long getOpId() { |
||||
return opId; |
||||
} |
||||
|
||||
public void setOpId(Long opId) { |
||||
this.opId = opId; |
||||
} |
||||
|
||||
public String getOpName() { |
||||
return opName; |
||||
} |
||||
|
||||
public void setOpName(String opName) { |
||||
this.opName = opName; |
||||
} |
||||
|
||||
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; |
||||
} |
||||
HighDiscountPackageAgentRel other = (HighDiscountPackageAgentRel) that; |
||||
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) |
||||
&& (this.getDiscountPackageTitle() == null ? other.getDiscountPackageTitle() == null : this.getDiscountPackageTitle().equals(other.getDiscountPackageTitle())) |
||||
&& (this.getDiscountPackageId() == null ? other.getDiscountPackageId() == null : this.getDiscountPackageId().equals(other.getDiscountPackageId())) |
||||
&& (this.getAgentName() == null ? other.getAgentName() == null : this.getAgentName().equals(other.getAgentName())) |
||||
&& (this.getAgentId() == null ? other.getAgentId() == null : this.getAgentId().equals(other.getAgentId())) |
||||
&& (this.getStockCount() == null ? other.getStockCount() == null : this.getStockCount().equals(other.getStockCount())) |
||||
&& (this.getSalesCount() == null ? other.getSalesCount() == null : this.getSalesCount().equals(other.getSalesCount())) |
||||
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) |
||||
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime())) |
||||
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus())) |
||||
&& (this.getOpId() == null ? other.getOpId() == null : this.getOpId().equals(other.getOpId())) |
||||
&& (this.getOpName() == null ? other.getOpName() == null : this.getOpName().equals(other.getOpName())) |
||||
&& (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 + ((getDiscountPackageTitle() == null) ? 0 : getDiscountPackageTitle().hashCode()); |
||||
result = prime * result + ((getDiscountPackageId() == null) ? 0 : getDiscountPackageId().hashCode()); |
||||
result = prime * result + ((getAgentName() == null) ? 0 : getAgentName().hashCode()); |
||||
result = prime * result + ((getAgentId() == null) ? 0 : getAgentId().hashCode()); |
||||
result = prime * result + ((getStockCount() == null) ? 0 : getStockCount().hashCode()); |
||||
result = prime * result + ((getSalesCount() == null) ? 0 : getSalesCount().hashCode()); |
||||
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); |
||||
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode()); |
||||
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode()); |
||||
result = prime * result + ((getOpId() == null) ? 0 : getOpId().hashCode()); |
||||
result = prime * result + ((getOpName() == null) ? 0 : getOpName().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(", discountPackageTitle=").append(discountPackageTitle); |
||||
sb.append(", discountPackageId=").append(discountPackageId); |
||||
sb.append(", agentName=").append(agentName); |
||||
sb.append(", agentId=").append(agentId); |
||||
sb.append(", stockCount=").append(stockCount); |
||||
sb.append(", salesCount=").append(salesCount); |
||||
sb.append(", createTime=").append(createTime); |
||||
sb.append(", updateTime=").append(updateTime); |
||||
sb.append(", status=").append(status); |
||||
sb.append(", opId=").append(opId); |
||||
sb.append(", opName=").append(opName); |
||||
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(); |
||||
} |
||||
} |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,120 @@ |
||||
package com.hai.service; |
||||
|
||||
import com.hai.entity.HighActivityInfo; |
||||
import com.hai.entity.HighActivityPartakeRule; |
||||
import com.hai.entity.HighDiscountPackageAgentRecord; |
||||
import com.hai.entity.HighDiscountPackageAgentRel; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @serviceName .java |
||||
* @author Sum1Dream |
||||
* @version 1.0.0 |
||||
* @Description // 优惠券包代理商业务
|
||||
* @createTime 10:50 2023/9/20 |
||||
**/ |
||||
public interface HighDiscountPackageAgentService { |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name insertDiscountPackageAgent |
||||
* @Description // 新增优惠券包代理商关联
|
||||
* @Date 10:52 2023/9/20 |
||||
* @Param discountPackageAgentRel |
||||
* @return void |
||||
*/ |
||||
void insertDiscountPackageAgentRel(HighDiscountPackageAgentRel discountPackageAgentRel); |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name updateDiscountPackageAgentRel |
||||
* @Description // 更新优惠券包代理商关联
|
||||
* @Date 10:53 2023/9/20 |
||||
* @Param discountPackageAgentRel |
||||
* @return void |
||||
*/ |
||||
void updateDiscountPackageAgentRel(HighDiscountPackageAgentRel discountPackageAgentRel); |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name getDetailRelById |
||||
* @Description // 根据id查询优惠券包代理商关联详情
|
||||
* @Date 10:53 2023/9/20 |
||||
* @Param id |
||||
* @return com.hai.entity.HighDiscountPackageAgentRel |
||||
*/ |
||||
HighDiscountPackageAgentRel getDetailRelById(Long id); |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name getDetailRelByMap |
||||
* @Description //根据map查询优惠券包代理商关联详情
|
||||
* @Date 15:13 2023/9/20 |
||||
* @Param map |
||||
* @return com.hai.entity.HighDiscountPackageAgentRel |
||||
*/ |
||||
HighDiscountPackageAgentRel getDetailRelByMap(Map<String , Object> map); |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name getListRel |
||||
* @Description // 查询列表
|
||||
* @Date 11:27 2023/9/20 |
||||
* @Param param |
||||
* @return java.util.List<com.hai.entity.HighDiscountPackageAgentRel> |
||||
*/ |
||||
List<HighDiscountPackageAgentRel> getListRel(Map<String, Object> param); |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name insertDiscountPackageAgentRecord |
||||
* @Description // 插入优惠券包代理商分发记录
|
||||
* @Date 13:53 2023/9/20 |
||||
* @Param discountPackageAgentRecord |
||||
* @return void |
||||
*/ |
||||
void insertDiscountPackageAgentRecord(HighDiscountPackageAgentRecord discountPackageAgentRecord); |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name updateDiscountPackageAgentRecord |
||||
* @Description //更新优惠券包代理商分发记录
|
||||
* @Date 13:55 2023/9/20 |
||||
* @Param discountPackageAgentRecord |
||||
* @return void |
||||
*/ |
||||
void updateDiscountPackageAgentRecord(HighDiscountPackageAgentRecord discountPackageAgentRecord); |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name getDetailRecordById |
||||
* @Description // 根据id 查询优惠券包代理商分发记录
|
||||
* @Date 13:55 2023/9/20 |
||||
* @Param id |
||||
* @return com.hai.entity.HighDiscountPackageAgentRecord |
||||
*/ |
||||
HighDiscountPackageAgentRecord getDetailRecordById(Long id); |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name getDetailRecordByMap |
||||
* @Description // 根据map 查询优惠券包代理商分发记录
|
||||
* @Date 15:13 2023/9/20 |
||||
* @Param map |
||||
* @return com.hai.entity.HighDiscountPackageAgentRecord |
||||
*/ |
||||
HighDiscountPackageAgentRecord getDetailRecordByMap(Map<String , Object> map); |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name getListRecord |
||||
* @Description // 查询列表
|
||||
* @Date 13:59 2023/9/20 |
||||
* @Param param |
||||
* @return java.util.List<com.hai.entity.HighDiscountPackageAgentRecord> |
||||
*/ |
||||
List<HighDiscountPackageAgentRecord> getListRecord(Map<String, Object> param); |
||||
|
||||
} |
@ -0,0 +1,108 @@ |
||||
package com.hai.service.impl; |
||||
|
||||
import com.hai.dao.HighDiscountPackageAgentRecordMapper; |
||||
import com.hai.dao.HighDiscountPackageAgentRelMapper; |
||||
import com.hai.entity.*; |
||||
import com.hai.service.HighDiscountPackageAgentService; |
||||
import org.apache.commons.collections4.MapUtils; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
@Service("highDiscountPackageAgentService") |
||||
public class HighDiscountPackageAgentServiceImpl implements HighDiscountPackageAgentService { |
||||
|
||||
@Resource |
||||
private HighDiscountPackageAgentRecordMapper discountPackageAgentRecordMapper; |
||||
|
||||
@Resource |
||||
private HighDiscountPackageAgentRelMapper discountPackageAgentRelMapper; |
||||
|
||||
@Override |
||||
public void insertDiscountPackageAgentRel(HighDiscountPackageAgentRel discountPackageAgentRel) { |
||||
discountPackageAgentRelMapper.insert(discountPackageAgentRel); |
||||
} |
||||
|
||||
@Override |
||||
public void updateDiscountPackageAgentRel(HighDiscountPackageAgentRel discountPackageAgentRel) { |
||||
discountPackageAgentRelMapper.updateByPrimaryKey(discountPackageAgentRel); |
||||
} |
||||
|
||||
@Override |
||||
public HighDiscountPackageAgentRel getDetailRelById(Long id) { |
||||
return discountPackageAgentRelMapper.selectByPrimaryKey(id); |
||||
} |
||||
|
||||
@Override |
||||
public HighDiscountPackageAgentRel getDetailRelByMap(Map<String, Object> map) { |
||||
|
||||
HighDiscountPackageAgentRelExample example = new HighDiscountPackageAgentRelExample(); |
||||
HighDiscountPackageAgentRelExample.Criteria criteria = example.createCriteria(); |
||||
|
||||
if (MapUtils.getLong(map, "agentId") != null) { |
||||
criteria.andAgentIdEqualTo(MapUtils.getLong(map, "agentId")); |
||||
} |
||||
if (MapUtils.getLong(map, "discountPackageId") != null) { |
||||
criteria.andDiscountPackageIdEqualTo(MapUtils.getLong(map, "discountPackageId")); |
||||
} |
||||
|
||||
List<HighDiscountPackageAgentRel> list = discountPackageAgentRelMapper.selectByExample(example); |
||||
|
||||
if (list.size() > 0) { |
||||
return list.get(0); |
||||
} |
||||
|
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public List<HighDiscountPackageAgentRel> getListRel(Map<String, Object> param) { |
||||
|
||||
HighDiscountPackageAgentRelExample example = new HighDiscountPackageAgentRelExample(); |
||||
HighDiscountPackageAgentRelExample.Criteria criteria = example.createCriteria(); |
||||
|
||||
if (MapUtils.getLong(param, "agentId") != null) { |
||||
criteria.andAgentIdEqualTo(MapUtils.getLong(param, "agentId")); |
||||
} |
||||
|
||||
return discountPackageAgentRelMapper.selectByExample(example); |
||||
} |
||||
|
||||
@Override |
||||
public void insertDiscountPackageAgentRecord(HighDiscountPackageAgentRecord discountPackageAgentRecord) { |
||||
discountPackageAgentRecordMapper.insert(discountPackageAgentRecord); |
||||
} |
||||
|
||||
@Override |
||||
public void updateDiscountPackageAgentRecord(HighDiscountPackageAgentRecord discountPackageAgentRecord) { |
||||
discountPackageAgentRecordMapper.updateByPrimaryKey(discountPackageAgentRecord); |
||||
} |
||||
|
||||
@Override |
||||
public HighDiscountPackageAgentRecord getDetailRecordById(Long id) { |
||||
return discountPackageAgentRecordMapper.selectByPrimaryKey(id); |
||||
} |
||||
|
||||
@Override |
||||
public HighDiscountPackageAgentRecord getDetailRecordByMap(Map<String, Object> map) { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public List<HighDiscountPackageAgentRecord> getListRecord(Map<String, Object> param) { |
||||
|
||||
HighDiscountPackageAgentRecordExample example = new HighDiscountPackageAgentRecordExample(); |
||||
HighDiscountPackageAgentRecordExample.Criteria criteria = example.createCriteria(); |
||||
|
||||
if (MapUtils.getLong(param, "agentId") != null) { |
||||
criteria.andAgentIdEqualTo(MapUtils.getLong(param, "agentId")); |
||||
} |
||||
if (MapUtils.getLong(param, "discountPackageId") != null) { |
||||
criteria.andDiscountPackageIdEqualTo(MapUtils.getLong(param, "discountPackageId")); |
||||
} |
||||
|
||||
return discountPackageAgentRecordMapper.selectByExample(example); |
||||
} |
||||
} |
Loading…
Reference in new issue