Commit 3525cf7d by 兰国旗

字段优化

parent cf023d17
...@@ -4,11 +4,10 @@ const Dao = require("../../dao.base"); ...@@ -4,11 +4,10 @@ const Dao = require("../../dao.base");
class MediaaggregationDao extends Dao { class MediaaggregationDao extends Dao {
constructor() { constructor() {
super(Dao.getModelName(MediaaggregationDao)); super(Dao.getModelName(MediaaggregationDao));
this.redisClient = system.getObject("util.redisClient");
} }
/** /**
* 服务列表 * 产品列表
*/ */
async productList(req) { async productList(req) {
var params = { var params = {
...@@ -19,7 +18,7 @@ class MediaaggregationDao extends Dao { ...@@ -19,7 +18,7 @@ class MediaaggregationDao extends Dao {
rows: [] rows: []
}; };
var dataCount = "select count(1) as dataCount from mc_product where deleted_at is null and product_type_code = :product_type_code and is_enabled = 1 "; var dataCount = "select count(1) as dataCount from mc_product where deleted_at is null and product_type_code = :product_type_code and is_enabled = 1 ";
var sql = "select * from mc_product where deleted_at is null and product_type_code = :product_type_code and is_enabled = 1 order by sequence desc"; var sql = "select product_type_code,product_type_name,code,name,selling_point,price,original_price,sales_volume,product_detail_url,list_thumbnail_url,is_recommend,service_Introduction_info from mc_product where deleted_at is null and product_type_code = :product_type_code and is_enabled = 1 order by sequence desc";
var list = await this.customQuery(sql, params); var list = await this.customQuery(sql, params);
returnRes.rows = list; returnRes.rows = list;
var tmpResultCount = await this.customQuery(dataCount, params); var tmpResultCount = await this.customQuery(dataCount, params);
...@@ -36,12 +35,11 @@ class MediaaggregationDao extends Dao { ...@@ -36,12 +35,11 @@ class MediaaggregationDao extends Dao {
rows: [] rows: []
}; };
var dataCount = "select count(1) as dataCount from mc_rotation_chart where deleted_at is null and pic_type = 2 and is_enabled = 1 "; var dataCount = "select count(1) as dataCount from mc_rotation_chart where deleted_at is null and pic_type = 2 and is_enabled = 1 ";
var sql = "select * from mc_rotation_chart where deleted_at is null and pic_type = 2 and is_enabled = 1 order by sequence desc"; var sql = "select pic_type_name,name,pic_url,jump_link from mc_rotation_chart where deleted_at is null and pic_type = 2 and is_enabled = 1 order by sequence desc";
var list = await this.customQuery(sql); var list = await this.customQuery(sql);
returnRes.rows = list; returnRes.rows = list;
var tmpResultCount = await this.customQuery(dataCount); var tmpResultCount = await this.customQuery(dataCount);
returnRes.total = tmpResultCount && tmpResultCount.length > 0 ? tmpResultCount[0].dataCount : 0; returnRes.total = tmpResultCount && tmpResultCount.length > 0 ? tmpResultCount[0].dataCount : 0;
return returnRes; return returnRes;
} }
...@@ -55,12 +53,11 @@ class MediaaggregationDao extends Dao { ...@@ -55,12 +53,11 @@ class MediaaggregationDao extends Dao {
}; };
var dataCount = "select count(1) as dataCount from mc_rotation_chart where deleted_at is null and pic_type = 1 and is_enabled = 1"; var dataCount = "select count(1) as dataCount from mc_rotation_chart where deleted_at is null and pic_type = 1 and is_enabled = 1";
var sql = "select * from mc_rotation_chart where deleted_at is null and pic_type = 1 and is_enabled = 1 order by sequence desc"; var sql = "select pic_type_name,name,pic_url,jump_link from mc_rotation_chart where deleted_at is null and pic_type = 1 and is_enabled = 1 order by sequence desc";
var list = await this.customQuery(sql); var list = await this.customQuery(sql);
returnRes.rows = list; returnRes.rows = list;
var tmpResultCount = await this.customQuery(dataCount); var tmpResultCount = await this.customQuery(dataCount);
returnRes.total = tmpResultCount && tmpResultCount.length > 0 ? tmpResultCount[0].dataCount : 0; returnRes.total = tmpResultCount && tmpResultCount.length > 0 ? tmpResultCount[0].dataCount : 0;
return returnRes; return returnRes;
} }
...@@ -73,12 +70,11 @@ class MediaaggregationDao extends Dao { ...@@ -73,12 +70,11 @@ class MediaaggregationDao extends Dao {
rows: [] rows: []
}; };
var dataCount = "select count(1) as dataCount from mc_second_level_need_config where deleted_at is null "; var dataCount = "select count(1) as dataCount from mc_second_level_need_config where deleted_at is null ";
var sql = "select * from mc_second_level_need_config where deleted_at is null "; var sql = "select code,name,link_url,top_pic_url,recommend_product_quantity,recommend_product from mc_second_level_need_config where deleted_at is null ";
var list = await this.customQuery(sql); var list = await this.customQuery(sql);
returnRes.rows = list; returnRes.rows = list;
var tmpResultCount = await this.customQuery(dataCount); var tmpResultCount = await this.customQuery(dataCount);
returnRes.total = tmpResultCount && tmpResultCount.length > 0 ? tmpResultCount[0].dataCount : 0; returnRes.total = tmpResultCount && tmpResultCount.length > 0 ? tmpResultCount[0].dataCount : 0;
return returnRes; return returnRes;
} }
...@@ -90,14 +86,12 @@ class MediaaggregationDao extends Dao { ...@@ -90,14 +86,12 @@ class MediaaggregationDao extends Dao {
total: 0,//总记录条数 total: 0,//总记录条数
rows: [] rows: []
}; };
var dataCount = "select count(1) as dataCount from mc_popular_recommendation where deleted_at is null and is_enabled = 1 "; var dataCount = "select count(1) as dataCount from mc_popular_recommendation where deleted_at is null and is_enabled = 1 ";
var sql = "select * from mc_popular_recommendation where deleted_at is null and is_enabled = 1 "; var sql = "select pic_position_name,pic_describe,pic_url,jump_link from mc_popular_recommendation where deleted_at is null and is_enabled = 1 ";
var list = await this.customQuery(sql); var list = await this.customQuery(sql);
returnRes.rows = list; returnRes.rows = list;
var tmpResultCount = await this.customQuery(dataCount); var tmpResultCount = await this.customQuery(dataCount);
returnRes.total = tmpResultCount && tmpResultCount.length > 0 ? tmpResultCount[0].dataCount : 0; returnRes.total = tmpResultCount && tmpResultCount.length > 0 ? tmpResultCount[0].dataCount : 0;
return returnRes; return returnRes;
} }
...@@ -110,12 +104,11 @@ class MediaaggregationDao extends Dao { ...@@ -110,12 +104,11 @@ class MediaaggregationDao extends Dao {
rows: [] rows: []
}; };
var dataCount = "select count(1) as dataCount from mc_product_type where deleted_at is null and p_id = 0 "; var dataCount = "select count(1) as dataCount from mc_product_type where deleted_at is null and p_id = 0 ";
var sql = "select * from mc_product_type where deleted_at is null and p_id = 0 order by sequence asc"; var sql = "select code,name,pic_url,jump_link from mc_product_type where deleted_at is null and p_id = 0 order by sequence asc";
var list = await this.customQuery(sql); var list = await this.customQuery(sql);
returnRes.rows = list; returnRes.rows = list;
var tmpResultCount = await this.customQuery(dataCount); var tmpResultCount = await this.customQuery(dataCount);
returnRes.total = tmpResultCount && tmpResultCount.length > 0 ? tmpResultCount[0].dataCount : 0; returnRes.total = tmpResultCount && tmpResultCount.length > 0 ? tmpResultCount[0].dataCount : 0;
return returnRes; return returnRes;
} }
...@@ -131,7 +124,7 @@ class MediaaggregationDao extends Dao { ...@@ -131,7 +124,7 @@ class MediaaggregationDao extends Dao {
rows: [] rows: []
}; };
var dataCount = "select count(1) as dataCount from mc_product_type where deleted_at is null and p_code = :p_code "; var dataCount = "select count(1) as dataCount from mc_product_type where deleted_at is null and p_code = :p_code ";
var sql = "select * from mc_product_type where deleted_at is null and p_code = :p_code order by sequence desc"; var sql = "select p_id,p_code,p_name,code,name,pic_url,jump_link from mc_product_type where deleted_at is null and p_code = :p_code order by sequence desc";
var list = await this.customQuery(sql, params); var list = await this.customQuery(sql, params);
returnRes.rows = list; returnRes.rows = list;
var tmpResultCount = await this.customQuery(dataCount, params); var tmpResultCount = await this.customQuery(dataCount, params);
...@@ -146,7 +139,7 @@ class MediaaggregationDao extends Dao { ...@@ -146,7 +139,7 @@ class MediaaggregationDao extends Dao {
var params = { var params = {
code: req.actionBody.code code: req.actionBody.code
}; };
var sql = "select * from mc_product where deleted_at is null and is_enabled = 1 and code = :code "; var sql = "select product_type_name,code,name,selling_point,price,original_price,sales_volume,product_detail_url,list_thumbnail_url,is_recommend,service_Introduction_info,process_flow_info,information_required_info,can_get_info,our_advantage_info from mc_product where deleted_at is null and is_enabled = 1 and code = :code ";
var returnRes = await this.customQuery(sql, params); var returnRes = await this.customQuery(sql, params);
return returnRes; return returnRes;
} }
...@@ -160,12 +153,11 @@ class MediaaggregationDao extends Dao { ...@@ -160,12 +153,11 @@ class MediaaggregationDao extends Dao {
rows: [] rows: []
}; };
var dataCount = "select count(1) as dataCount from mc_bottom_menu_config where deleted_at is null "; var dataCount = "select count(1) as dataCount from mc_bottom_menu_config where deleted_at is null ";
var sql = "select * from mc_bottom_menu_config where deleted_at is null "; var sql = "select name,button_position,button_type,is_distinguishtime,strategy_date,strategy_time_start,strategy_time_end,button_name,call_number,else_button_name,else_call_number from mc_bottom_menu_config where deleted_at is null ";
var list = await this.customQuery(sql); var list = await this.customQuery(sql);
returnRes.rows = list; returnRes.rows = list;
var tmpResultCount = await this.customQuery(dataCount); var tmpResultCount = await this.customQuery(dataCount);
returnRes.total = tmpResultCount && tmpResultCount.length > 0 ? tmpResultCount[0].dataCount : 0; returnRes.total = tmpResultCount && tmpResultCount.length > 0 ? tmpResultCount[0].dataCount : 0;
return returnRes; return returnRes;
} }
...@@ -178,12 +170,11 @@ class MediaaggregationDao extends Dao { ...@@ -178,12 +170,11 @@ class MediaaggregationDao extends Dao {
rows: [] rows: []
}; };
var dataCount = "select count(1) as dataCount from mc_cycle_product where deleted_at is null "; var dataCount = "select count(1) as dataCount from mc_cycle_product where deleted_at is null ";
var sql = "select * from mc_cycle_product where deleted_at is null order by sequence desc"; var sql = "select cycle_type,cycle_type_name,pic_describe,pic_url,jump_link from mc_cycle_product where deleted_at is null order by sequence desc";
var list = await this.customQuery(sql); var list = await this.customQuery(sql);
returnRes.rows = list; returnRes.rows = list;
var tmpResultCount = await this.customQuery(dataCount); var tmpResultCount = await this.customQuery(dataCount);
returnRes.total = tmpResultCount && tmpResultCount.length > 0 ? tmpResultCount[0].dataCount : 0; returnRes.total = tmpResultCount && tmpResultCount.length > 0 ? tmpResultCount[0].dataCount : 0;
return returnRes; return returnRes;
} }
...@@ -199,14 +190,12 @@ class MediaaggregationDao extends Dao { ...@@ -199,14 +190,12 @@ class MediaaggregationDao extends Dao {
total: 0,//总记录条数 total: 0,//总记录条数
rows: [] rows: []
}; };
var dataCount = "select count(1) as dataCount from mc_second_level_need_config where deleted_at is null and code = :code "; var dataCount = "select count(1) as dataCount from mc_second_level_need_config where deleted_at is null and code = :code ";
var sql = "select * from mc_second_level_need_config where deleted_at is null and code = :code"; var sql = "select code,name,link_url,top_pic_url,recommend_product_quantity,recommend_product from mc_second_level_need_config where deleted_at is null and code = :code";
var list = await this.customQuery(sql, params); var list = await this.customQuery(sql, params);
returnRes.rows = list; returnRes.rows = list;
var tmpResultCount = await this.customQuery(dataCount, params); var tmpResultCount = await this.customQuery(dataCount, params);
returnRes.total = tmpResultCount && tmpResultCount.length > 0 ? tmpResultCount[0].dataCount : 0; returnRes.total = tmpResultCount && tmpResultCount.length > 0 ? tmpResultCount[0].dataCount : 0;
return returnRes; return returnRes;
} }
...@@ -223,7 +212,6 @@ class MediaaggregationDao extends Dao { ...@@ -223,7 +212,6 @@ class MediaaggregationDao extends Dao {
total: 0,//总记录条数 total: 0,//总记录条数
rows: [] rows: []
}; };
if (apiType && apiType == '1') {//二类产品资质选项(选取数据线索的数据) if (apiType && apiType == '1') {//二类产品资质选项(选取数据线索的数据)
var dataCount = "select count(1) as dataCount from mc_clue_maintenance where deleted_at is null"; var dataCount = "select count(1) as dataCount from mc_clue_maintenance where deleted_at is null";
var sql = "select clue_info from mc_clue_maintenance where deleted_at is null"; var sql = "select clue_info from mc_clue_maintenance where deleted_at is null";
...@@ -236,7 +224,6 @@ class MediaaggregationDao extends Dao { ...@@ -236,7 +224,6 @@ class MediaaggregationDao extends Dao {
returnRes.rows = list; returnRes.rows = list;
var tmpResultCount = await this.customQuery(dataCount, params); var tmpResultCount = await this.customQuery(dataCount, params);
returnRes.total = tmpResultCount && tmpResultCount.length > 0 ? tmpResultCount[0].dataCount : 0; returnRes.total = tmpResultCount && tmpResultCount.length > 0 ? tmpResultCount[0].dataCount : 0;
return returnRes; return returnRes;
} }
...@@ -253,12 +240,11 @@ class MediaaggregationDao extends Dao { ...@@ -253,12 +240,11 @@ class MediaaggregationDao extends Dao {
rows: [] rows: []
}; };
var dataCount = "select count(1) as dataCount from mc_cycle_product where deleted_at is null and cycle_type = :cycle_type "; var dataCount = "select count(1) as dataCount from mc_cycle_product where deleted_at is null and cycle_type = :cycle_type ";
var sql = "select * from mc_cycle_product where deleted_at is null and cycle_type = :cycle_type"; var sql = "select code,cycle_type,cycle_type_name,pic_describe,pic_url,jump_link from mc_cycle_product where deleted_at is null and cycle_type = :cycle_type";
var list = await this.customQuery(sql, params); var list = await this.customQuery(sql, params);
returnRes.rows = list; returnRes.rows = list;
var tmpResultCount = await this.customQuery(dataCount, params); var tmpResultCount = await this.customQuery(dataCount, params);
returnRes.total = tmpResultCount && tmpResultCount.length > 0 ? tmpResultCount[0].dataCount : 0; returnRes.total = tmpResultCount && tmpResultCount.length > 0 ? tmpResultCount[0].dataCount : 0;
return returnRes; return returnRes;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment