|
|
@@ -28,7 +28,7 @@ public class AdvertiseImplDao implements AdvertiseDao {
|
|
|
}
|
|
|
|
|
|
public int insertAdvertise(Advertise advertise){
|
|
|
- String sql = "insert into `advertise`(logo_url,title,image_url,jump_way,jump_direction,jump_point,state,sort_level,create_time,town_id) values(:logo_url,:title,:image_url,:jump_way,:jump_direction,:jump_point,:state,:sort_level,:create_time,:town_id) ";
|
|
|
+ String sql = "insert into `advertise`(logo_url,title,image_url,jump_way,jump_direction,jump_point,state,sort_level,create_time,town_id,sub_title) values(:logo_url,:title,:image_url,:jump_way,:jump_direction,:jump_point,:state,:sort_level,:create_time,:town_id,:sub_title) ";
|
|
|
MapSqlParameterSource sps = new MapSqlParameterSource();
|
|
|
sps.addValue("logo_url", advertise.getLogoUrl());
|
|
|
sps.addValue("title", advertise.getTitle());
|
|
|
@@ -40,6 +40,7 @@ public class AdvertiseImplDao implements AdvertiseDao {
|
|
|
sps.addValue("sort_level", advertise.getSortLevel());
|
|
|
sps.addValue("create_time", advertise.getCreateTime());
|
|
|
sps.addValue("town_id", advertise.getTownId());
|
|
|
+ sps.addValue("sub_title",advertise.getSubTitle());
|
|
|
int num = 0;
|
|
|
try{
|
|
|
num = namedParameterJdbcTemplate.update(sql, sps);
|
|
|
@@ -51,7 +52,7 @@ public class AdvertiseImplDao implements AdvertiseDao {
|
|
|
}
|
|
|
|
|
|
public int updateAdvertise(Advertise advertise){
|
|
|
- String sql = "update `advertise` set logo_url=:logo_url,title=:title,image_url=:image_url,jump_way=:jump_way,jump_direction=:jump_direction,jump_point=:jump_point,state=:state,sort_level=:sort_level,create_time=:create_time,town_id=:town_id where id=:id ";
|
|
|
+ String sql = "update `advertise` set logo_url=:logo_url,title=:title,image_url=:image_url,jump_way=:jump_way,jump_direction=:jump_direction,jump_point=:jump_point,state=:state,sort_level=:sort_level,create_time=:create_time,town_id=:town_id,sub_title=:sub_title where id=:id ";
|
|
|
MapSqlParameterSource sps = new MapSqlParameterSource();
|
|
|
sps.addValue("logo_url", advertise.getLogoUrl());
|
|
|
sps.addValue("title", advertise.getTitle());
|
|
|
@@ -63,6 +64,7 @@ public class AdvertiseImplDao implements AdvertiseDao {
|
|
|
sps.addValue("sort_level", advertise.getSortLevel());
|
|
|
sps.addValue("create_time", advertise.getCreateTime());
|
|
|
sps.addValue("town_id", advertise.getTownId());
|
|
|
+ sps.addValue("sub_title",advertise.getSubTitle());
|
|
|
sps.addValue("id", advertise.getId());
|
|
|
int num = 0;
|
|
|
try{
|
|
|
@@ -143,4 +145,20 @@ public class AdvertiseImplDao implements AdvertiseDao {
|
|
|
MapSqlParameterSource sps = new MapSqlParameterSource();
|
|
|
return namedParameterJdbcTemplate.queryForInt(sql, sps);
|
|
|
}
|
|
|
+
|
|
|
+ // 操作广告开启状态
|
|
|
+ public int updateState(Integer id, Integer state){
|
|
|
+ String sql = "update `advertise` set state=:state where id=:id ";
|
|
|
+ MapSqlParameterSource sps = new MapSqlParameterSource();
|
|
|
+ sps.addValue("id", id);
|
|
|
+ sps.addValue("state", state);
|
|
|
+ int num = 0;
|
|
|
+ try{
|
|
|
+ num = namedParameterJdbcTemplate.update(sql, sps);
|
|
|
+ }
|
|
|
+ catch(Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return num;
|
|
|
+ }
|
|
|
}
|