去掉presell_pug_detail表相关信息
parent
5ed374e959
commit
e16d12a92e
|
|
@ -1,14 +0,0 @@
|
|||
package com.cowr.model;
|
||||
|
||||
import com.cowr.model.base.BasePresellPugDetail;
|
||||
|
||||
/**
|
||||
* Generated by COWR Thu Dec 16 15:44:52 CST 2021
|
||||
* TableName: presell_pug
|
||||
* Remarks:
|
||||
* PrimaryKey: id
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class PresellPugDetail extends BasePresellPugDetail<PresellPugDetail> {
|
||||
public static final PresellPugDetail dao = new PresellPugDetail().dao();
|
||||
}
|
||||
|
|
@ -93,7 +93,6 @@ public class _MappingKit {
|
|||
arp.addMapping("product_price_modify", "id", ProductPriceModify.class);
|
||||
arp.addMapping("product_price_modify_log", "id", ProductPriceModifyLog.class);
|
||||
arp.addMapping("presell_order", "id", PresellOrder.class);
|
||||
arp.addMapping("presell_pug_detail", "id", PresellPugDetail.class);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,222 +0,0 @@
|
|||
package com.cowr.model.base;
|
||||
|
||||
import com.cowr.common.base.BaseModel;
|
||||
import com.jfinal.plugin.activerecord.IBean;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
|
||||
/**
|
||||
* Generated by COWR Thu Dec 16 15:44:52 CST 2021
|
||||
* TableName: presell_pug
|
||||
* Remarks:
|
||||
* PrimaryKey: id
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public abstract class BasePresellPugDetail<M extends BasePresellPugDetail<M>> extends BaseModel<M> implements IBean {
|
||||
|
||||
public static final String tablename = "presell_pug_detail";
|
||||
|
||||
@JSONField(serialize=false)
|
||||
public String getTablename(){
|
||||
return tablename;
|
||||
}
|
||||
|
||||
/**
|
||||
* name: id
|
||||
* type: INT UNSIGNED(10)
|
||||
* isNullable: NO
|
||||
* isPrimaryKey: YES
|
||||
* defaultValue:
|
||||
* @param id 主键
|
||||
*/
|
||||
@JSONField(name="id")
|
||||
public void setId(String id) {
|
||||
set("id", id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return id 主键
|
||||
*/
|
||||
@JSONField(name="id")
|
||||
public String getId() {
|
||||
return getStr("id");
|
||||
}
|
||||
|
||||
/**
|
||||
* name: presell_order_id
|
||||
* type: CHAR(32)
|
||||
* isNullable: NO
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue:
|
||||
* @param presellOrderId 预售单的id
|
||||
*/
|
||||
@JSONField(name="presell_order_id")
|
||||
public void setPresellOrderId(String presellOrderId) {
|
||||
set("presell_order_id", presellOrderId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return presell_order_id 预售单的id
|
||||
*/
|
||||
@JSONField(name="presell_order_id")
|
||||
public String getPresellOrderId() {
|
||||
return getStr("presell_order_id");
|
||||
}
|
||||
|
||||
/**
|
||||
* name: amount
|
||||
* type: decimal
|
||||
* isNullable: NO
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue:
|
||||
* @param amount 提货金额
|
||||
*/
|
||||
@JSONField(name="amount")
|
||||
public void setAmount(java.math.BigDecimal amount) {
|
||||
set("amount", amount);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return amount 提货金额
|
||||
*/
|
||||
@JSONField(name="amount")
|
||||
public java.math.BigDecimal getAmount() {
|
||||
return getBigDecimal("amount");
|
||||
}
|
||||
|
||||
/**
|
||||
* name: start_time
|
||||
* type: DATETIME(19)
|
||||
* isNullable: NO
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue:
|
||||
* @param startTime 运输起始时间
|
||||
*/
|
||||
@JSONField(name="start_time")
|
||||
public void setStartTime(java.util.Date startTime) {
|
||||
set("start_time", startTime);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return start_time 运输起始时间
|
||||
*/
|
||||
@JSONField(name="start_time")
|
||||
public java.util.Date getStartTime() {
|
||||
return get("start_time");
|
||||
}
|
||||
|
||||
/**
|
||||
* name: cutoff_time
|
||||
* type: DATETIME(19)
|
||||
* isNullable: NO
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue:
|
||||
* @param cutoffTime 运输截止时间
|
||||
*/
|
||||
@JSONField(name="cutoff_time")
|
||||
public void setCutoffTime(java.util.Date cutoffTime) {
|
||||
set("cutoff_time", cutoffTime);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return cutoff_time 运输截止时间
|
||||
*/
|
||||
@JSONField(name="cutoff_time")
|
||||
public java.util.Date getCutoffTime() {
|
||||
return get("cutoff_time");
|
||||
}
|
||||
|
||||
/**
|
||||
* name: create_time
|
||||
* type: DATETIME(19)
|
||||
* isNullable: YES
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue:
|
||||
* @param createTime 创建时间
|
||||
*/
|
||||
@JSONField(name="create_time")
|
||||
public void setCreateTime(java.util.Date createTime) {
|
||||
set("create_time", createTime);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return create_time 创建时间
|
||||
*/
|
||||
@JSONField(name="create_time")
|
||||
public java.util.Date getCreateTime() {
|
||||
return get("create_time");
|
||||
}
|
||||
|
||||
/**
|
||||
* name: create_user_id
|
||||
* type: INT UNSIGNED(10)
|
||||
* isNullable: YES
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue:
|
||||
* @param createUserId 创建人id
|
||||
*/
|
||||
@JSONField(name="create_user_id")
|
||||
public void setCreateUserId(Long createUserId) {
|
||||
set("create_user_id", createUserId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return create_user_id 创建人id
|
||||
*/
|
||||
@JSONField(name="create_user_id")
|
||||
public Long getCreateUserId() {
|
||||
return getLong("create_user_id");
|
||||
}
|
||||
|
||||
/**
|
||||
* name: create_user_name
|
||||
* type: VARCHAR(20)
|
||||
* isNullable: YES
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue:
|
||||
* @param createUserName 创建人姓名
|
||||
*/
|
||||
@JSONField(name="create_user_name")
|
||||
public void setCreateUserName(String createUserName) {
|
||||
set("create_user_name", createUserName);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return create_user_name 创建人姓名
|
||||
*/
|
||||
@JSONField(name="create_user_name")
|
||||
public String getCreateUserName() {
|
||||
return getStr("create_user_name");
|
||||
}
|
||||
|
||||
/**
|
||||
* name: memo
|
||||
* type: VARCHAR(255)
|
||||
* isNullable: YES
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue:
|
||||
* @param memo 备注
|
||||
*/
|
||||
@JSONField(name="memo")
|
||||
public void setMemo(String memo) {
|
||||
set("memo", memo);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return memo 备注
|
||||
*/
|
||||
@JSONField(name="memo")
|
||||
public String getMemo() {
|
||||
return getStr("memo");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,81 +0,0 @@
|
|||
package com.cowr.ssjygl.presellpugdetail;
|
||||
|
||||
import com.cowr.common.Const;
|
||||
import com.cowr.common.base.BaseService;
|
||||
import com.cowr.common.view.PageParam;
|
||||
import com.cowr.model.PresellPugDetail;
|
||||
import com.jfinal.kit.StrKit;
|
||||
import com.jfinal.plugin.activerecord.Db;
|
||||
import com.jfinal.plugin.activerecord.Page;
|
||||
import com.jfinal.plugin.activerecord.Record;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Generated by COWR Thu Dec 16 15:44:53 CST 2021
|
||||
* TableName: presell_pug
|
||||
* Remarks:
|
||||
* PrimaryKey: id
|
||||
*/
|
||||
public class PresellPugDetailService extends BaseService {
|
||||
public static final PresellPugDetailService me = new PresellPugDetailService();
|
||||
|
||||
public Page<Record> find(PageParam pp, Integer customer_id, Integer supermarket_id, String name, String stm, String etm) {
|
||||
String selectsql = "select t.*, c.name customer_name, s.name supermarket_name, d.name product_name, c.address, c.texpayer_name, c.texpayer_num, c.memo \n";
|
||||
String fromsql = " from presell_pug_detail t \n" +
|
||||
" left join presell_order o on t.presell_order_id = o.id \n" +
|
||||
" left join supermarket s on o.supermarket_id = s.id \n" +
|
||||
" left join product d on o.supermarket_id = d.id \n" +
|
||||
" where 1=1 \n";
|
||||
List<Object> paraList = new ArrayList<>();
|
||||
|
||||
if (StrKit.notBlank(name)) {
|
||||
fromsql += " and c.name like ? \n";
|
||||
paraList.add("%" + name.trim() + "%");
|
||||
}
|
||||
|
||||
if (supermarket_id != null) {
|
||||
fromsql += " and s.id = ?";
|
||||
paraList.add(supermarket_id);
|
||||
}
|
||||
|
||||
if (customer_id != null) {
|
||||
fromsql += " and c.id = ?";
|
||||
paraList.add(customer_id);
|
||||
}
|
||||
|
||||
if (StrKit.notBlank(stm)) {
|
||||
fromsql += " and t.create_time >= ?";
|
||||
paraList.add(stm);
|
||||
}
|
||||
|
||||
if (StrKit.notBlank(etm)) {
|
||||
fromsql += " and t.create_time <= ?";
|
||||
paraList.add(etm);
|
||||
}
|
||||
|
||||
String totalRowSql = "select count(*) " + fromsql;
|
||||
String findSql = selectsql + fromsql;
|
||||
|
||||
// 前端传了排序字段,并且排序字段存在相关表中
|
||||
if (StrKit.notBlank(pp.getSort_field()) && PresellPugDetail.dao.hasColunm(pp.getSort_field())) {
|
||||
findSql += " order by t." + pp.getSort_field() + " is null, t." + pp.getSort_field();
|
||||
|
||||
if (Const.ORDER_BY_ASC.equals(pp.getSort_order())) {
|
||||
findSql += " " + Const.ORDER_BY_ASC;
|
||||
} else {
|
||||
findSql += " " + Const.ORDER_BY_DESC;
|
||||
}
|
||||
} else {
|
||||
findSql += " order by t.create_time desc";
|
||||
}
|
||||
|
||||
return Db.paginateByFullSql(pp.getPage(), pp.getSize(), totalRowSql, findSql, paraList.toArray());
|
||||
}
|
||||
|
||||
public List<PresellPugDetail> list() {
|
||||
return PresellPugDetail.dao.find("select * from presell_pug_detail");
|
||||
}
|
||||
}
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
package com.cowr.local.ssjygl.presellpugdetail;
|
||||
|
||||
import com.cowr.common.view.PageParam;
|
||||
import com.cowr.common.view.Result;
|
||||
import com.cowr.ssjygl.presellpugdetail.PresellPugDetailService;
|
||||
import com.jfinal.core.Controller;
|
||||
|
||||
/**
|
||||
* Generated by COWR Thu Dec 16 15:44:53 CST 2021
|
||||
* TableName: presell_pug
|
||||
* Remarks:
|
||||
* PrimaryKey: id
|
||||
*/
|
||||
public class PresellPugDetailController extends Controller {
|
||||
|
||||
/**
|
||||
* 分页查找 presell_pug
|
||||
*/
|
||||
public void find(){
|
||||
Integer customer_id = getInt("customer_id");
|
||||
Integer supermarket_id = getInt("supermarket_id");
|
||||
String name = get("name");
|
||||
String stm = get("stm");
|
||||
String etm = get("etm");
|
||||
PageParam pp = getBean(PageParam.class, "", true);
|
||||
renderJson(Result.object(PresellPugDetailService.me.find(pp, customer_id, supermarket_id, name, stm, etm)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回所有 presell_pug
|
||||
*/
|
||||
public void list(){
|
||||
renderJson(Result.object(PresellPugDetailService.me.list()));
|
||||
}
|
||||
}
|
||||
|
|
@ -1,73 +0,0 @@
|
|||
package com.cowr.service.ssjygl.presellpugdetail;
|
||||
|
||||
import com.cowr.common.view.PageParam;
|
||||
import com.cowr.common.view.Result;
|
||||
import com.cowr.model.PresellPugDetail;
|
||||
import com.cowr.ssjygl.presellpugdetail.PresellPugDetailService;
|
||||
import com.jfinal.aop.Before;
|
||||
import com.jfinal.core.Controller;
|
||||
|
||||
/**
|
||||
* Generated by COWR Thu Dec 16 15:44:53 CST 2021
|
||||
* TableName: presell_pug
|
||||
* Remarks:
|
||||
* PrimaryKey: id
|
||||
*/
|
||||
public class PresellPugDetailController extends Controller {
|
||||
|
||||
/**
|
||||
* 新增 presell_pug
|
||||
*/
|
||||
@Before(PresellPugDetailValidator.class)
|
||||
public void save(){
|
||||
PresellPugDetail model = getModel(PresellPugDetail.class, "", true); // 忽略不在model中的字段
|
||||
renderJson(PresellPugDetailService.me.save(model));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除 presell_pug
|
||||
*/
|
||||
@Before(PresellPugDetailPKValidator.class)
|
||||
public void del(){
|
||||
PresellPugDetail model = getModel(PresellPugDetail.class, "", true); // 忽略不在model中的字段
|
||||
renderJson(PresellPugDetailService.me.delete(model));
|
||||
}
|
||||
|
||||
/**
|
||||
* 恢复 presell_pug
|
||||
*/
|
||||
@Before(PresellPugDetailPKValidator.class)
|
||||
public void restore(){
|
||||
PresellPugDetail model = getModel(PresellPugDetail.class, "", true); // 忽略不在model中的字段
|
||||
renderJson(PresellPugDetailService.me.restore(model));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改 presell_pug
|
||||
*/
|
||||
@Before(PresellPugDetailValidator.class)
|
||||
public void edit(){
|
||||
PresellPugDetail model = getModel(PresellPugDetail.class, "", true); // 忽略不在model中的字段
|
||||
renderJson(PresellPugDetailService.me.update(model));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查找 presell_pug
|
||||
*/
|
||||
public void find(){
|
||||
Integer customer_id = getInt("customer_id");
|
||||
Integer supermarket_id = getInt("supermarket_id");
|
||||
String name = get("name");
|
||||
String stm = get("stm");
|
||||
String etm = get("etm");
|
||||
PageParam pp = getBean(PageParam.class, "", true);
|
||||
renderJson(Result.object(PresellPugDetailService.me.find(pp, customer_id, supermarket_id, name, stm, etm)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回所有 presell_pug
|
||||
*/
|
||||
public void list(){
|
||||
renderJson(Result.object(PresellPugDetailService.me.list()));
|
||||
}
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
package com.cowr.service.ssjygl.presellpugdetail;
|
||||
|
||||
|
||||
import com.cowr.common.validator.CrudParamValidator;
|
||||
import com.cowr.common.view.Result;
|
||||
import com.jfinal.core.Controller;
|
||||
|
||||
/**
|
||||
* Generated by COWR Thu Dec 16 15:44:53 CST 2021
|
||||
* TableName: presell_pug
|
||||
* Remarks:
|
||||
* PrimaryKey: id
|
||||
*/
|
||||
public class PresellPugDetailPKValidator extends CrudParamValidator {
|
||||
@Override
|
||||
protected void validate(Controller c) {
|
||||
validateRequired("id", "id", "id 必填");
|
||||
validateLong("id", 1, 2147483647, "id", "id 范围 1~2147483647");
|
||||
}
|
||||
|
||||
protected void handleError(Controller c) {
|
||||
c.renderJson(Result.failed(getErrmsg()));
|
||||
}
|
||||
}
|
||||
|
|
@ -1,74 +0,0 @@
|
|||
package com.cowr.service.ssjygl.presellpugdetail;
|
||||
|
||||
import com.cowr.common.base.BaseService;
|
||||
import com.cowr.common.enums.Enums;
|
||||
import com.cowr.common.view.Result;
|
||||
import com.cowr.model.PresellOrder;
|
||||
import com.cowr.model.PresellPugDetail;
|
||||
import com.cowr.model.Sysuser;
|
||||
import com.cowr.ssjygl.modifylog.ModifyLogService;
|
||||
import com.jfinal.kit.StrKit;
|
||||
import com.jfinal.log.Log;
|
||||
import com.jfinal.plugin.activerecord.Db;
|
||||
import com.jfinal.plugin.activerecord.IAtom;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Generated by COWR Thu Dec 16 15:44:53 CST 2021
|
||||
* TableName: presell_pug
|
||||
* Remarks:
|
||||
* PrimaryKey: id
|
||||
*/
|
||||
public class PresellPugDetailService extends BaseService {
|
||||
private static final Log log = Log.getLog(PresellPugDetailService.class);
|
||||
public static final PresellPugDetailService me = new PresellPugDetailService();
|
||||
|
||||
public Result save(PresellPugDetail model, Sysuser sysuser) {
|
||||
try {
|
||||
String presellOrderId = model.getPresellOrderId();
|
||||
PresellOrder order = PresellOrder.dao.findById(presellOrderId);
|
||||
if (order == null) {
|
||||
return Result.failed(false, "未找到对应的预售单");
|
||||
}
|
||||
BigDecimal amount = order.getPresellAmount();
|
||||
model.setAmount(amount);
|
||||
boolean ret = Db.tx(new IAtom() {
|
||||
@Override
|
||||
public boolean run() {
|
||||
try {
|
||||
boolean ret = model.save();
|
||||
|
||||
if (ret) {
|
||||
ret = ModifyLogService.me.save(model, null, Enums.DataOpType.SAVE.getId(), sysuser);
|
||||
}
|
||||
|
||||
return ret;
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return ret ? Result.object(model) : Result.failed(false, "新增失败");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
if (e.getMessage().contains("PRIMARY")) {
|
||||
return Result.failed(false, "主键冲突");
|
||||
} else {
|
||||
return Result.failed(false, e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<PresellPugDetail> getByPresellOrderId(String id) {
|
||||
List<PresellPugDetail> ret = new ArrayList<>();
|
||||
if (StrKit.isBlank(id)) {
|
||||
return ret;
|
||||
}
|
||||
return PresellPugDetail.dao.find("select * from presell_pug where presell_order_id = ?", id);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
package com.cowr.service.ssjygl.presellpugdetail;
|
||||
|
||||
import com.jfinal.core.Controller;
|
||||
import com.cowr.common.validator.CrudParamValidator;
|
||||
import com.cowr.common.view.Result;
|
||||
import com.cowr.model.PresellPugDetail;
|
||||
|
||||
/**
|
||||
* Generated by COWR Thu Dec 16 15:44:53 CST 2021
|
||||
* TableName: presell_pug
|
||||
* Remarks:
|
||||
* PrimaryKey: id
|
||||
*/
|
||||
public class PresellPugDetailValidator extends CrudParamValidator {
|
||||
@Override
|
||||
protected void validate(Controller c) {
|
||||
// 默认新增时,前端不需要传主键。若需要前端传主键,需要去掉这个判断
|
||||
if (!"save".equals(getActionMethodName())) {
|
||||
validateRequired("id", "id", "id 必填");
|
||||
|
||||
validateLong("id", 1, 2147483647, "id", "id 范围 1~2147483647");
|
||||
}
|
||||
|
||||
validateRequired("presell_order_id", "ipresell_order_id", "ipresell_order_id 必填");
|
||||
validateString("presell_order_id", 1, 32, "presell_order_id", "presell_order_id 长度 1~32");
|
||||
|
||||
validateBigDecimal("amount", new java.math.BigDecimal(1), new java.math.BigDecimal(9.9999999999E10), "amount", "amount 范围 1~9.9999999999E10");
|
||||
|
||||
validateString("start_time", 1, 19, "start_time", "start_time 长度 1~19");
|
||||
validateDate("start_time", "yyyy-MM-dd", false, "start_time", "start_time 格式 yyyy-MM-dd"); // 默认时间时间字符串格式,生成后根据情况调整
|
||||
|
||||
validateString("cutoff_time", 1, 19, "cutoff_time", "cutoff_time 长度 1~19");
|
||||
validateDate("cutoff_time", "yyyy-MM-dd", false, "cutoff_time", "cutoff_time 格式 yyyy-MM-dd"); // 默认时间时间字符串格式,生成后根据情况调整
|
||||
|
||||
// 使用 model 更新时,model 不能只有主键有值
|
||||
// 这里用 getActionMethodName 写死,判断是 update 时,才做验证
|
||||
// 如果确实是需要将主键外的字段置为 null,可以在代码生成后删掉这段
|
||||
if ("edit".equals(getActionMethodName())) {
|
||||
validateUpdateModel(PresellPugDetail.class, "", true); // 忽略不在model中的字段
|
||||
}
|
||||
}
|
||||
|
||||
protected void handleError(Controller c) {
|
||||
c.renderJson(Result.failed(getErrmsg()));
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue