parent
83a6d1561f
commit
25916061ec
@ -0,0 +1,100 @@ |
||||
package com.bweb.controller; |
||||
|
||||
import com.alibaba.excel.EasyExcel; |
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.bweb.config.SysConst; |
||||
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.AESEncodeUtil; |
||||
import com.hai.common.security.SessionObject; |
||||
import com.hai.common.security.UserCenter; |
||||
import com.hai.common.utils.ResponseMsgUtil; |
||||
import com.hai.config.CommonSysConst; |
||||
import com.hai.entity.*; |
||||
import com.hai.model.DiscountUseConditionModel; |
||||
import com.hai.model.ResponseData; |
||||
import com.hai.model.UserInfoModel; |
||||
import com.hai.service.*; |
||||
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.io.File; |
||||
import java.math.BigDecimal; |
||||
import java.net.URLEncoder; |
||||
import java.util.Date; |
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @Auther: 胡锐 |
||||
* @Description: |
||||
* @Date: 2021/4/4 00:19 |
||||
*/ |
||||
@Controller |
||||
@RequestMapping(value = "/discountAgentBatch") |
||||
@Api(value = "优惠券和代理商接口") |
||||
public class HighDiscountAgentBatchController { |
||||
|
||||
private static Logger log = LoggerFactory.getLogger(HighDiscountAgentBatchController.class); |
||||
@Resource |
||||
private HighDiscountAgentBatchService highDiscountAgentBatchService; |
||||
|
||||
@RequestMapping(value="/replenish",method = RequestMethod.POST) |
||||
@ResponseBody |
||||
@ApiOperation(value = "批次补充") |
||||
public ResponseData replenish(@RequestBody JSONObject jsonObject) { |
||||
try { |
||||
|
||||
String batchIdentifier = jsonObject.getString("batchIdentifier"); |
||||
Long mailTime = jsonObject.getLong("mailTime"); |
||||
Integer batchNum = jsonObject.getInteger("batchNum"); |
||||
|
||||
if (StringUtils.isBlank(batchIdentifier)) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
// 查询数据
|
||||
HighDiscountAgentBatch batch = highDiscountAgentBatchService.getBatchByIdentifier(batchIdentifier); |
||||
if (batch == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "批次不存在"); |
||||
} |
||||
if (mailTime != null) { |
||||
batch.setMailTime(new Date(mailTime)); |
||||
} |
||||
if (batchNum != null) { |
||||
batch.setBatchNum(batch.getBatchNum().intValue() + batchNum); |
||||
} |
||||
highDiscountAgentBatchService.editData(batch); |
||||
return ResponseMsgUtil.success("操作成功"); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("HighDiscountAgentBatchController -> replenish() error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value="/getBatchDetail",method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "查询批次详情") |
||||
public ResponseData getBatchDetail(@RequestParam(name = "batchIdentifier", required = true) String batchIdentifier) { |
||||
try { |
||||
|
||||
return ResponseMsgUtil.success(highDiscountAgentBatchService.getBatchByIdentifier(batchIdentifier)); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("HighDiscountController -> getBatchDetail() error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,155 @@ |
||||
package com.hai.dao; |
||||
|
||||
import com.hai.entity.HighDiscountAgentBatch; |
||||
import com.hai.entity.HighDiscountAgentBatchExample; |
||||
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 HighDiscountAgentBatchMapper extends HighDiscountAgentBatchMapperExt { |
||||
@SelectProvider(type=HighDiscountAgentBatchSqlProvider.class, method="countByExample") |
||||
long countByExample(HighDiscountAgentBatchExample example); |
||||
|
||||
@DeleteProvider(type=HighDiscountAgentBatchSqlProvider.class, method="deleteByExample") |
||||
int deleteByExample(HighDiscountAgentBatchExample example); |
||||
|
||||
@Delete({ |
||||
"delete from high_discount_agent_batch", |
||||
"where id = #{id,jdbcType=BIGINT}" |
||||
}) |
||||
int deleteByPrimaryKey(Long id); |
||||
|
||||
@Insert({ |
||||
"insert into high_discount_agent_batch (discount_agent_id, discount_id, ", |
||||
"discount_name, discount_price, ", |
||||
"using_range, use_scope, ", |
||||
"agent_id, batch_identifier, ", |
||||
"batch_num, code_start, ", |
||||
"code_end, mail_time, ", |
||||
"create_time, `status`, ", |
||||
"qr_code, ext_1, ext_2, ", |
||||
"ext_3)", |
||||
"values (#{discountAgentId,jdbcType=BIGINT}, #{discountId,jdbcType=BIGINT}, ", |
||||
"#{discountName,jdbcType=VARCHAR}, #{discountPrice,jdbcType=DECIMAL}, ", |
||||
"#{usingRange,jdbcType=INTEGER}, #{useScope,jdbcType=INTEGER}, ", |
||||
"#{agentId,jdbcType=BIGINT}, #{batchIdentifier,jdbcType=VARCHAR}, ", |
||||
"#{batchNum,jdbcType=INTEGER}, #{codeStart,jdbcType=VARCHAR}, ", |
||||
"#{codeEnd,jdbcType=VARCHAR}, #{mailTime,jdbcType=TIMESTAMP}, ", |
||||
"#{createTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}, ", |
||||
"#{qrCode,jdbcType=VARCHAR}, #{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, ", |
||||
"#{ext3,jdbcType=VARCHAR})" |
||||
}) |
||||
@Options(useGeneratedKeys=true,keyProperty="id") |
||||
int insert(HighDiscountAgentBatch record); |
||||
|
||||
@InsertProvider(type=HighDiscountAgentBatchSqlProvider.class, method="insertSelective") |
||||
@Options(useGeneratedKeys=true,keyProperty="id") |
||||
int insertSelective(HighDiscountAgentBatch record); |
||||
|
||||
@SelectProvider(type=HighDiscountAgentBatchSqlProvider.class, method="selectByExample") |
||||
@Results({ |
||||
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), |
||||
@Result(column="discount_agent_id", property="discountAgentId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="discount_id", property="discountId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="discount_name", property="discountName", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="discount_price", property="discountPrice", jdbcType=JdbcType.DECIMAL), |
||||
@Result(column="using_range", property="usingRange", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="use_scope", property="useScope", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="agent_id", property="agentId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="batch_identifier", property="batchIdentifier", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="batch_num", property="batchNum", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="code_start", property="codeStart", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="code_end", property="codeEnd", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="mail_time", property="mailTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="qr_code", property="qrCode", 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<HighDiscountAgentBatch> selectByExample(HighDiscountAgentBatchExample example); |
||||
|
||||
@Select({ |
||||
"select", |
||||
"id, discount_agent_id, discount_id, discount_name, discount_price, using_range, ", |
||||
"use_scope, agent_id, batch_identifier, batch_num, code_start, code_end, mail_time, ", |
||||
"create_time, `status`, qr_code, ext_1, ext_2, ext_3", |
||||
"from high_discount_agent_batch", |
||||
"where id = #{id,jdbcType=BIGINT}" |
||||
}) |
||||
@Results({ |
||||
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), |
||||
@Result(column="discount_agent_id", property="discountAgentId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="discount_id", property="discountId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="discount_name", property="discountName", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="discount_price", property="discountPrice", jdbcType=JdbcType.DECIMAL), |
||||
@Result(column="using_range", property="usingRange", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="use_scope", property="useScope", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="agent_id", property="agentId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="batch_identifier", property="batchIdentifier", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="batch_num", property="batchNum", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="code_start", property="codeStart", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="code_end", property="codeEnd", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="mail_time", property="mailTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="qr_code", property="qrCode", 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) |
||||
}) |
||||
HighDiscountAgentBatch selectByPrimaryKey(Long id); |
||||
|
||||
@UpdateProvider(type=HighDiscountAgentBatchSqlProvider.class, method="updateByExampleSelective") |
||||
int updateByExampleSelective(@Param("record") HighDiscountAgentBatch record, @Param("example") HighDiscountAgentBatchExample example); |
||||
|
||||
@UpdateProvider(type=HighDiscountAgentBatchSqlProvider.class, method="updateByExample") |
||||
int updateByExample(@Param("record") HighDiscountAgentBatch record, @Param("example") HighDiscountAgentBatchExample example); |
||||
|
||||
@UpdateProvider(type=HighDiscountAgentBatchSqlProvider.class, method="updateByPrimaryKeySelective") |
||||
int updateByPrimaryKeySelective(HighDiscountAgentBatch record); |
||||
|
||||
@Update({ |
||||
"update high_discount_agent_batch", |
||||
"set discount_agent_id = #{discountAgentId,jdbcType=BIGINT},", |
||||
"discount_id = #{discountId,jdbcType=BIGINT},", |
||||
"discount_name = #{discountName,jdbcType=VARCHAR},", |
||||
"discount_price = #{discountPrice,jdbcType=DECIMAL},", |
||||
"using_range = #{usingRange,jdbcType=INTEGER},", |
||||
"use_scope = #{useScope,jdbcType=INTEGER},", |
||||
"agent_id = #{agentId,jdbcType=BIGINT},", |
||||
"batch_identifier = #{batchIdentifier,jdbcType=VARCHAR},", |
||||
"batch_num = #{batchNum,jdbcType=INTEGER},", |
||||
"code_start = #{codeStart,jdbcType=VARCHAR},", |
||||
"code_end = #{codeEnd,jdbcType=VARCHAR},", |
||||
"mail_time = #{mailTime,jdbcType=TIMESTAMP},", |
||||
"create_time = #{createTime,jdbcType=TIMESTAMP},", |
||||
"`status` = #{status,jdbcType=INTEGER},", |
||||
"qr_code = #{qrCode,jdbcType=VARCHAR},", |
||||
"ext_1 = #{ext1,jdbcType=VARCHAR},", |
||||
"ext_2 = #{ext2,jdbcType=VARCHAR},", |
||||
"ext_3 = #{ext3,jdbcType=VARCHAR}", |
||||
"where id = #{id,jdbcType=BIGINT}" |
||||
}) |
||||
int updateByPrimaryKey(HighDiscountAgentBatch record); |
||||
} |
@ -0,0 +1,53 @@ |
||||
package com.hai.dao; |
||||
|
||||
|
||||
import org.apache.ibatis.annotations.Param; |
||||
import org.apache.ibatis.annotations.Select; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* mapper扩展类 |
||||
*/ |
||||
public interface HighDiscountAgentBatchMapperExt { |
||||
|
||||
@Select("<script>" + |
||||
" select a.*," + |
||||
" ROUND((a.useNum / a.batchNum) * 100, 2) useRate" + |
||||
" from (select " + |
||||
" a.batch_identifier batchIdentifier," + |
||||
" a.discount_name discountName," + |
||||
" a.discount_price discountPrice," + |
||||
" a.using_range discountUsingRange," + |
||||
" a.code_start codeStart," + |
||||
" a.code_end codeEnd," + |
||||
" a.create_time createTime," + |
||||
" a.mail_time mailTime," + |
||||
" a.batch_num batchNum," + |
||||
" (select count(1) from high_discount_agent_code where discount_agent_batch_id = a.id and `status` in (2,3)) useNum" + |
||||
" from high_discount_agent_batch a where 1 = 1" + |
||||
" <if test='param.usingRange != null'> and a.using_range = #{param.usingRange} </if>" + |
||||
" <if test='param.price != null'> and a.discount_price = #{param.price} </if>" + |
||||
") a" + |
||||
"</script>") |
||||
List<Map<String,Object>> queryUsageCount(@Param("param") Map<String,Object> param); |
||||
|
||||
@Select("<script>" + |
||||
" select" + |
||||
" sum(a.batchNum) batchNum," + |
||||
" sum(a.useNum) useNum," + |
||||
" sum((a.useNum * a.discountPrice)) usePrice," + |
||||
" ROUND(sum(a.useNum) / sum(a.batchNum) * 100, 2) useRate" + |
||||
" from (select " + |
||||
" a.discount_price discountPrice," + |
||||
" a.using_range discountUsingRange," + |
||||
" a.batch_num batchNum," + |
||||
" (select count(1) from high_discount_agent_code where discount_agent_batch_id = a.id and `status` in (2,3)) useNum" + |
||||
" from high_discount_agent_batch a where 1 = 1" + |
||||
" <if test='param.usingRange != null'> and a.using_range = #{param.usingRange} </if>" + |
||||
" <if test='param.price != null'> and a.discount_price = #{param.price} </if>" + |
||||
" ) a " + |
||||
"</script>") |
||||
Map<String,Object> queryCount(@Param("param") Map<String,Object> param); |
||||
} |
@ -0,0 +1,430 @@ |
||||
package com.hai.dao; |
||||
|
||||
import com.hai.entity.HighDiscountAgentBatch; |
||||
import com.hai.entity.HighDiscountAgentBatchExample.Criteria; |
||||
import com.hai.entity.HighDiscountAgentBatchExample.Criterion; |
||||
import com.hai.entity.HighDiscountAgentBatchExample; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
import org.apache.ibatis.jdbc.SQL; |
||||
|
||||
public class HighDiscountAgentBatchSqlProvider { |
||||
|
||||
public String countByExample(HighDiscountAgentBatchExample example) { |
||||
SQL sql = new SQL(); |
||||
sql.SELECT("count(*)").FROM("high_discount_agent_batch"); |
||||
applyWhere(sql, example, false); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String deleteByExample(HighDiscountAgentBatchExample example) { |
||||
SQL sql = new SQL(); |
||||
sql.DELETE_FROM("high_discount_agent_batch"); |
||||
applyWhere(sql, example, false); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String insertSelective(HighDiscountAgentBatch record) { |
||||
SQL sql = new SQL(); |
||||
sql.INSERT_INTO("high_discount_agent_batch"); |
||||
|
||||
if (record.getDiscountAgentId() != null) { |
||||
sql.VALUES("discount_agent_id", "#{discountAgentId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getDiscountId() != null) { |
||||
sql.VALUES("discount_id", "#{discountId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getDiscountName() != null) { |
||||
sql.VALUES("discount_name", "#{discountName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getDiscountPrice() != null) { |
||||
sql.VALUES("discount_price", "#{discountPrice,jdbcType=DECIMAL}"); |
||||
} |
||||
|
||||
if (record.getUsingRange() != null) { |
||||
sql.VALUES("using_range", "#{usingRange,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getUseScope() != null) { |
||||
sql.VALUES("use_scope", "#{useScope,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getAgentId() != null) { |
||||
sql.VALUES("agent_id", "#{agentId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getBatchIdentifier() != null) { |
||||
sql.VALUES("batch_identifier", "#{batchIdentifier,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getBatchNum() != null) { |
||||
sql.VALUES("batch_num", "#{batchNum,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getCodeStart() != null) { |
||||
sql.VALUES("code_start", "#{codeStart,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getCodeEnd() != null) { |
||||
sql.VALUES("code_end", "#{codeEnd,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getMailTime() != null) { |
||||
sql.VALUES("mail_time", "#{mailTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getCreateTime() != null) { |
||||
sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getStatus() != null) { |
||||
sql.VALUES("`status`", "#{status,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getQrCode() != null) { |
||||
sql.VALUES("qr_code", "#{qrCode,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(HighDiscountAgentBatchExample example) { |
||||
SQL sql = new SQL(); |
||||
if (example != null && example.isDistinct()) { |
||||
sql.SELECT_DISTINCT("id"); |
||||
} else { |
||||
sql.SELECT("id"); |
||||
} |
||||
sql.SELECT("discount_agent_id"); |
||||
sql.SELECT("discount_id"); |
||||
sql.SELECT("discount_name"); |
||||
sql.SELECT("discount_price"); |
||||
sql.SELECT("using_range"); |
||||
sql.SELECT("use_scope"); |
||||
sql.SELECT("agent_id"); |
||||
sql.SELECT("batch_identifier"); |
||||
sql.SELECT("batch_num"); |
||||
sql.SELECT("code_start"); |
||||
sql.SELECT("code_end"); |
||||
sql.SELECT("mail_time"); |
||||
sql.SELECT("create_time"); |
||||
sql.SELECT("`status`"); |
||||
sql.SELECT("qr_code"); |
||||
sql.SELECT("ext_1"); |
||||
sql.SELECT("ext_2"); |
||||
sql.SELECT("ext_3"); |
||||
sql.FROM("high_discount_agent_batch"); |
||||
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) { |
||||
HighDiscountAgentBatch record = (HighDiscountAgentBatch) parameter.get("record"); |
||||
HighDiscountAgentBatchExample example = (HighDiscountAgentBatchExample) parameter.get("example"); |
||||
|
||||
SQL sql = new SQL(); |
||||
sql.UPDATE("high_discount_agent_batch"); |
||||
|
||||
if (record.getId() != null) { |
||||
sql.SET("id = #{record.id,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getDiscountAgentId() != null) { |
||||
sql.SET("discount_agent_id = #{record.discountAgentId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getDiscountId() != null) { |
||||
sql.SET("discount_id = #{record.discountId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getDiscountName() != null) { |
||||
sql.SET("discount_name = #{record.discountName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getDiscountPrice() != null) { |
||||
sql.SET("discount_price = #{record.discountPrice,jdbcType=DECIMAL}"); |
||||
} |
||||
|
||||
if (record.getUsingRange() != null) { |
||||
sql.SET("using_range = #{record.usingRange,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getUseScope() != null) { |
||||
sql.SET("use_scope = #{record.useScope,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getAgentId() != null) { |
||||
sql.SET("agent_id = #{record.agentId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getBatchIdentifier() != null) { |
||||
sql.SET("batch_identifier = #{record.batchIdentifier,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getBatchNum() != null) { |
||||
sql.SET("batch_num = #{record.batchNum,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getCodeStart() != null) { |
||||
sql.SET("code_start = #{record.codeStart,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getCodeEnd() != null) { |
||||
sql.SET("code_end = #{record.codeEnd,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getMailTime() != null) { |
||||
sql.SET("mail_time = #{record.mailTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getCreateTime() != null) { |
||||
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getStatus() != null) { |
||||
sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getQrCode() != null) { |
||||
sql.SET("qr_code = #{record.qrCode,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_agent_batch"); |
||||
|
||||
sql.SET("id = #{record.id,jdbcType=BIGINT}"); |
||||
sql.SET("discount_agent_id = #{record.discountAgentId,jdbcType=BIGINT}"); |
||||
sql.SET("discount_id = #{record.discountId,jdbcType=BIGINT}"); |
||||
sql.SET("discount_name = #{record.discountName,jdbcType=VARCHAR}"); |
||||
sql.SET("discount_price = #{record.discountPrice,jdbcType=DECIMAL}"); |
||||
sql.SET("using_range = #{record.usingRange,jdbcType=INTEGER}"); |
||||
sql.SET("use_scope = #{record.useScope,jdbcType=INTEGER}"); |
||||
sql.SET("agent_id = #{record.agentId,jdbcType=BIGINT}"); |
||||
sql.SET("batch_identifier = #{record.batchIdentifier,jdbcType=VARCHAR}"); |
||||
sql.SET("batch_num = #{record.batchNum,jdbcType=INTEGER}"); |
||||
sql.SET("code_start = #{record.codeStart,jdbcType=VARCHAR}"); |
||||
sql.SET("code_end = #{record.codeEnd,jdbcType=VARCHAR}"); |
||||
sql.SET("mail_time = #{record.mailTime,jdbcType=TIMESTAMP}"); |
||||
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); |
||||
sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); |
||||
sql.SET("qr_code = #{record.qrCode,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}"); |
||||
|
||||
HighDiscountAgentBatchExample example = (HighDiscountAgentBatchExample) parameter.get("example"); |
||||
applyWhere(sql, example, true); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String updateByPrimaryKeySelective(HighDiscountAgentBatch record) { |
||||
SQL sql = new SQL(); |
||||
sql.UPDATE("high_discount_agent_batch"); |
||||
|
||||
if (record.getDiscountAgentId() != null) { |
||||
sql.SET("discount_agent_id = #{discountAgentId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getDiscountId() != null) { |
||||
sql.SET("discount_id = #{discountId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getDiscountName() != null) { |
||||
sql.SET("discount_name = #{discountName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getDiscountPrice() != null) { |
||||
sql.SET("discount_price = #{discountPrice,jdbcType=DECIMAL}"); |
||||
} |
||||
|
||||
if (record.getUsingRange() != null) { |
||||
sql.SET("using_range = #{usingRange,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getUseScope() != null) { |
||||
sql.SET("use_scope = #{useScope,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getAgentId() != null) { |
||||
sql.SET("agent_id = #{agentId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getBatchIdentifier() != null) { |
||||
sql.SET("batch_identifier = #{batchIdentifier,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getBatchNum() != null) { |
||||
sql.SET("batch_num = #{batchNum,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getCodeStart() != null) { |
||||
sql.SET("code_start = #{codeStart,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getCodeEnd() != null) { |
||||
sql.SET("code_end = #{codeEnd,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getMailTime() != null) { |
||||
sql.SET("mail_time = #{mailTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getCreateTime() != null) { |
||||
sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getStatus() != null) { |
||||
sql.SET("`status` = #{status,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getQrCode() != null) { |
||||
sql.SET("qr_code = #{qrCode,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, HighDiscountAgentBatchExample 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,345 @@ |
||||
package com.hai.entity; |
||||
|
||||
import java.io.Serializable; |
||||
import java.math.BigDecimal; |
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* high_discount_agent_batch |
||||
* @author |
||||
*/ |
||||
/** |
||||
* |
||||
* 代码由工具生成 |
||||
* |
||||
**/ |
||||
public class HighDiscountAgentBatch implements Serializable { |
||||
/** |
||||
* 主键 |
||||
*/ |
||||
private Long id; |
||||
|
||||
/** |
||||
* 优惠券与代理商关系 |
||||
*/ |
||||
private Long discountAgentId; |
||||
|
||||
/** |
||||
* 优惠券id |
||||
*/ |
||||
private Long discountId; |
||||
|
||||
/** |
||||
* 优惠券名称 |
||||
*/ |
||||
private String discountName; |
||||
|
||||
/** |
||||
* 优惠券金额 |
||||
*/ |
||||
private BigDecimal discountPrice; |
||||
|
||||
/** |
||||
* 使用归属 |
||||
*/ |
||||
private Integer usingRange; |
||||
|
||||
/** |
||||
* 使用范围 1. 全场 2.卡券 3.话费 |
||||
*/ |
||||
private Integer useScope; |
||||
|
||||
/** |
||||
* 代理商id |
||||
*/ |
||||
private Long agentId; |
||||
|
||||
/** |
||||
* 批次标识 |
||||
*/ |
||||
private String batchIdentifier; |
||||
|
||||
/** |
||||
* 批次数量 |
||||
*/ |
||||
private Integer batchNum; |
||||
|
||||
/** |
||||
* 编码区间 |
||||
*/ |
||||
private String codeStart; |
||||
|
||||
/** |
||||
* 编码区间 |
||||
*/ |
||||
private String codeEnd; |
||||
|
||||
/** |
||||
* 邮寄时间 |
||||
*/ |
||||
private Date mailTime; |
||||
|
||||
/** |
||||
* 创建时间 |
||||
*/ |
||||
private Date createTime; |
||||
|
||||
/** |
||||
* 状态 0:删除 1:正常 |
||||
*/ |
||||
private Integer status; |
||||
|
||||
/** |
||||
* 二维码 |
||||
*/ |
||||
private String qrCode; |
||||
|
||||
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 getDiscountAgentId() { |
||||
return discountAgentId; |
||||
} |
||||
|
||||
public void setDiscountAgentId(Long discountAgentId) { |
||||
this.discountAgentId = discountAgentId; |
||||
} |
||||
|
||||
public Long getDiscountId() { |
||||
return discountId; |
||||
} |
||||
|
||||
public void setDiscountId(Long discountId) { |
||||
this.discountId = discountId; |
||||
} |
||||
|
||||
public String getDiscountName() { |
||||
return discountName; |
||||
} |
||||
|
||||
public void setDiscountName(String discountName) { |
||||
this.discountName = discountName; |
||||
} |
||||
|
||||
public BigDecimal getDiscountPrice() { |
||||
return discountPrice; |
||||
} |
||||
|
||||
public void setDiscountPrice(BigDecimal discountPrice) { |
||||
this.discountPrice = discountPrice; |
||||
} |
||||
|
||||
public Integer getUsingRange() { |
||||
return usingRange; |
||||
} |
||||
|
||||
public void setUsingRange(Integer usingRange) { |
||||
this.usingRange = usingRange; |
||||
} |
||||
|
||||
public Integer getUseScope() { |
||||
return useScope; |
||||
} |
||||
|
||||
public void setUseScope(Integer useScope) { |
||||
this.useScope = useScope; |
||||
} |
||||
|
||||
public Long getAgentId() { |
||||
return agentId; |
||||
} |
||||
|
||||
public void setAgentId(Long agentId) { |
||||
this.agentId = agentId; |
||||
} |
||||
|
||||
public String getBatchIdentifier() { |
||||
return batchIdentifier; |
||||
} |
||||
|
||||
public void setBatchIdentifier(String batchIdentifier) { |
||||
this.batchIdentifier = batchIdentifier; |
||||
} |
||||
|
||||
public Integer getBatchNum() { |
||||
return batchNum; |
||||
} |
||||
|
||||
public void setBatchNum(Integer batchNum) { |
||||
this.batchNum = batchNum; |
||||
} |
||||
|
||||
public String getCodeStart() { |
||||
return codeStart; |
||||
} |
||||
|
||||
public void setCodeStart(String codeStart) { |
||||
this.codeStart = codeStart; |
||||
} |
||||
|
||||
public String getCodeEnd() { |
||||
return codeEnd; |
||||
} |
||||
|
||||
public void setCodeEnd(String codeEnd) { |
||||
this.codeEnd = codeEnd; |
||||
} |
||||
|
||||
public Date getMailTime() { |
||||
return mailTime; |
||||
} |
||||
|
||||
public void setMailTime(Date mailTime) { |
||||
this.mailTime = mailTime; |
||||
} |
||||
|
||||
public Date getCreateTime() { |
||||
return createTime; |
||||
} |
||||
|
||||
public void setCreateTime(Date createTime) { |
||||
this.createTime = createTime; |
||||
} |
||||
|
||||
public Integer getStatus() { |
||||
return status; |
||||
} |
||||
|
||||
public void setStatus(Integer status) { |
||||
this.status = status; |
||||
} |
||||
|
||||
public String getQrCode() { |
||||
return qrCode; |
||||
} |
||||
|
||||
public void setQrCode(String qrCode) { |
||||
this.qrCode = qrCode; |
||||
} |
||||
|
||||
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; |
||||
} |
||||
HighDiscountAgentBatch other = (HighDiscountAgentBatch) that; |
||||
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) |
||||
&& (this.getDiscountAgentId() == null ? other.getDiscountAgentId() == null : this.getDiscountAgentId().equals(other.getDiscountAgentId())) |
||||
&& (this.getDiscountId() == null ? other.getDiscountId() == null : this.getDiscountId().equals(other.getDiscountId())) |
||||
&& (this.getDiscountName() == null ? other.getDiscountName() == null : this.getDiscountName().equals(other.getDiscountName())) |
||||
&& (this.getDiscountPrice() == null ? other.getDiscountPrice() == null : this.getDiscountPrice().equals(other.getDiscountPrice())) |
||||
&& (this.getUsingRange() == null ? other.getUsingRange() == null : this.getUsingRange().equals(other.getUsingRange())) |
||||
&& (this.getUseScope() == null ? other.getUseScope() == null : this.getUseScope().equals(other.getUseScope())) |
||||
&& (this.getAgentId() == null ? other.getAgentId() == null : this.getAgentId().equals(other.getAgentId())) |
||||
&& (this.getBatchIdentifier() == null ? other.getBatchIdentifier() == null : this.getBatchIdentifier().equals(other.getBatchIdentifier())) |
||||
&& (this.getBatchNum() == null ? other.getBatchNum() == null : this.getBatchNum().equals(other.getBatchNum())) |
||||
&& (this.getCodeStart() == null ? other.getCodeStart() == null : this.getCodeStart().equals(other.getCodeStart())) |
||||
&& (this.getCodeEnd() == null ? other.getCodeEnd() == null : this.getCodeEnd().equals(other.getCodeEnd())) |
||||
&& (this.getMailTime() == null ? other.getMailTime() == null : this.getMailTime().equals(other.getMailTime())) |
||||
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) |
||||
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus())) |
||||
&& (this.getQrCode() == null ? other.getQrCode() == null : this.getQrCode().equals(other.getQrCode())) |
||||
&& (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 + ((getDiscountAgentId() == null) ? 0 : getDiscountAgentId().hashCode()); |
||||
result = prime * result + ((getDiscountId() == null) ? 0 : getDiscountId().hashCode()); |
||||
result = prime * result + ((getDiscountName() == null) ? 0 : getDiscountName().hashCode()); |
||||
result = prime * result + ((getDiscountPrice() == null) ? 0 : getDiscountPrice().hashCode()); |
||||
result = prime * result + ((getUsingRange() == null) ? 0 : getUsingRange().hashCode()); |
||||
result = prime * result + ((getUseScope() == null) ? 0 : getUseScope().hashCode()); |
||||
result = prime * result + ((getAgentId() == null) ? 0 : getAgentId().hashCode()); |
||||
result = prime * result + ((getBatchIdentifier() == null) ? 0 : getBatchIdentifier().hashCode()); |
||||
result = prime * result + ((getBatchNum() == null) ? 0 : getBatchNum().hashCode()); |
||||
result = prime * result + ((getCodeStart() == null) ? 0 : getCodeStart().hashCode()); |
||||
result = prime * result + ((getCodeEnd() == null) ? 0 : getCodeEnd().hashCode()); |
||||
result = prime * result + ((getMailTime() == null) ? 0 : getMailTime().hashCode()); |
||||
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); |
||||
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode()); |
||||
result = prime * result + ((getQrCode() == null) ? 0 : getQrCode().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(", discountAgentId=").append(discountAgentId); |
||||
sb.append(", discountId=").append(discountId); |
||||
sb.append(", discountName=").append(discountName); |
||||
sb.append(", discountPrice=").append(discountPrice); |
||||
sb.append(", usingRange=").append(usingRange); |
||||
sb.append(", useScope=").append(useScope); |
||||
sb.append(", agentId=").append(agentId); |
||||
sb.append(", batchIdentifier=").append(batchIdentifier); |
||||
sb.append(", batchNum=").append(batchNum); |
||||
sb.append(", codeStart=").append(codeStart); |
||||
sb.append(", codeEnd=").append(codeEnd); |
||||
sb.append(", mailTime=").append(mailTime); |
||||
sb.append(", createTime=").append(createTime); |
||||
sb.append(", status=").append(status); |
||||
sb.append(", qrCode=").append(qrCode); |
||||
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,40 @@ |
||||
package com.hai.service; |
||||
|
||||
import com.hai.entity.HighDiscountAgentBatch; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @className: HighDiscountAgentBatchService |
||||
* @author: HuRui |
||||
* @date: 2023/8/16 |
||||
**/ |
||||
public interface HighDiscountAgentBatchService { |
||||
|
||||
/** |
||||
* 编辑数据 |
||||
* @param discountAgentBatch |
||||
*/ |
||||
void editData(HighDiscountAgentBatch discountAgentBatch); |
||||
|
||||
/** |
||||
* 根据标识查询数据 |
||||
* @param identifier |
||||
* @return |
||||
*/ |
||||
HighDiscountAgentBatch getBatchByIdentifier(String identifier); |
||||
|
||||
/** |
||||
* 获取使用统计 |
||||
* @param param |
||||
* @return |
||||
*/List<Map<String,Object>> getUsageCount(Map<String, Object> param); |
||||
|
||||
/** |
||||
* 获取统计 |
||||
* @param param |
||||
* @return |
||||
*/ |
||||
Map<String,Object> getCount(Map<String, Object> param); |
||||
} |
@ -0,0 +1,55 @@ |
||||
package com.hai.service.impl; |
||||
|
||||
import com.hai.dao.HighDiscountAgentBatchMapper; |
||||
import com.hai.entity.HighDiscountAgentBatch; |
||||
import com.hai.entity.HighDiscountAgentBatchExample; |
||||
import com.hai.service.HighDiscountAgentBatchService; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.Date; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @className: HighDiscountAgentBatchServiceImpl |
||||
* @author: HuRui |
||||
* @date: 2023/8/16 |
||||
**/ |
||||
@Service("discountAgentBatchService") |
||||
public class HighDiscountAgentBatchServiceImpl implements HighDiscountAgentBatchService { |
||||
|
||||
@Resource |
||||
private HighDiscountAgentBatchMapper discountAgentBatchMapper; |
||||
@Override |
||||
public void editData(HighDiscountAgentBatch discountAgentBatch) { |
||||
if (discountAgentBatch.getId() == null) { |
||||
discountAgentBatch.setCreateTime(new Date()); |
||||
discountAgentBatch.setStatus(1); |
||||
discountAgentBatchMapper.insert(discountAgentBatch); |
||||
} else { |
||||
discountAgentBatchMapper.updateByPrimaryKey(discountAgentBatch); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public HighDiscountAgentBatch getBatchByIdentifier(String identifier) { |
||||
HighDiscountAgentBatchExample example = new HighDiscountAgentBatchExample(); |
||||
example.createCriteria().andBatchIdentifierEqualTo(identifier).andStatusNotEqualTo(0); |
||||
List<HighDiscountAgentBatch> list = discountAgentBatchMapper.selectByExample(example); |
||||
if (list.size() > 0) { |
||||
return list.get(0); |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public List<Map<String, Object>> getUsageCount(Map<String, Object> param) { |
||||
return discountAgentBatchMapper.queryUsageCount(param); |
||||
} |
||||
|
||||
@Override |
||||
public Map<String, Object> getCount(Map<String, Object> param) { |
||||
return discountAgentBatchMapper.queryCount(param); |
||||
} |
||||
} |
Loading…
Reference in new issue