jsp

本文介绍了如何使用SQL语句来修改数据库表结构,包括添加字段、设置字段默认值及注释、删除字段等操作,并提供了具体的实例。此外,还涉及了数据获取、插入和查询等常见数据库操作。
14
插入一个字段并加注释alter table commodity_comment add type int unsigned default 0 comment '评价类型(0好评,1中评,2差评)'

alter table sc_bd_yjjs_b add qz char(10);
ALTER TABLE table1 ADD column1 int default 0
ALTER TABLE 表名 ADD 字段名 bit

alter table commodity_comment add type int unsigned default 0 comment '评价类型(0好评,1中评,2差评)'
alter table commodity_comment add color varchar(20) default NULL comment '商品颜色'
alter table commodity_comment add size_code varchar(20) default NULL comment '商品尺码'
alter table commodity_comment add order_time datetime default NULL comment '购买时间'
alter table commodity_comment add type int unsigned default 0 comment '评价类型(0好评,1中评,2差评)'

1.表结构语句
CREATE TABLE `directory` (
`id` varchar(50) NOT NULL COMMENT '书页ID',
`novel_id` varchar(50) default NULL COMMENT '小说ID',
`site_id` varchar(50) default NULL COMMENT '站点ID',
`dir_url` varchar(256) default NULL COMMENT '书页链接',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC

2.添加带注释列语句
alter table directory add index_url varchar(256) default null comment '章节书目链接' after dir_url;

3.删除列语句

alter table directory drop index_url;


15jsp时间转换
<fmt:formatDate pattern="yyyy-MM-dd HH:mm:ss" value="${cos.createTime}" />

16
数据获取set进新增字段
CommodityComment commodityComment = ReflectionFromParamUtil.getObject( request, CommodityComment.class );
String orderItemId = request.getParameter( "orderItemId" );
OrderItem orderItem = orderItemService.selectByPrimaryKey( Integer.parseInt( orderItemId ) );
Date date = new Date();
commodityComment.setUserNo( UserContext.getCurrentUserNo() );
commodityComment.setUserName( UserContext.getCurrentUser().getName() );
commodityComment.setCreateTime( date );
commodityComment.setStatus( 0 );
// 新增的好中差评价类型
String grade = request.getParameter( "grade" );
if( StringUtil.parseInt( grade, -1 ) >= 0 ) {
int g = StringUtil.parseInt( grade );
if( g == 1 ) {
commodityComment.setType( CommentType.bad.getId() );
}
else if( g >= 4 ) {
commodityComment.setType( CommentType.good.getId() );
}
else {
commodityComment.setType( CommentType.middle.getId() );
}
}
commodityComment.setGrade( 1 );
if( orderItem != null ) {
commodityComment.setColor( orderItem.getColor() );
commodityComment.setSizeCode( orderItem.getSizeCode() );
commodityComment.setOrderTime( orderItem.getOrderTime() );

16
获取集合长度,或者总数comment.getCommentCount()
{fn:length(commodityModel.listComment_a) }

17
插入查询的数据,字段数据可有唯一的才行
INSERT into commodity_comment (order_id, user_name, user_no, commodity_id, commodity_name, brand_id, size_id,
brand_name, grade, shot_comment, content, create_time, status, audit_name, audit_no,
audit_time, pack_satisficing, speed_satisficing, service_satisficing, replay_content,
replay_user_no, replay_time, replay_user_nick_name, order_item_id,type,color,size_code,
order_time)SELECT order_id, user_name, user_no, commodity_id, commodity_name, brand_id, size_id,
brand_name, grade, shot_comment, content, create_time, status, audit_name, audit_no,
audit_time, pack_satisficing, speed_satisficing, service_satisficing, replay_content,
replay_user_no, replay_time, replay_user_nick_name, order_item_id,type,color,size_code,
order_time FROM commodity_comment where commodity_id = 399

18、
jsp ${}显示NAN%,因为{}中运算分母为零,或者结果为零

19.
异步加载数据,就是将div写在js文件,jsp用div的id去加载
controller写好方法数据

20.
Mybatis xmlsql语句,不能定义Java的map对象

21

//默认点击全部评论tab
$(".tab li").eq(0).trigger("click");

//默认点击全部评论tab
$(".tab li").eq(0).trigger("click",true);

22

{{if admin}}
<p>admin</p>
{{else if code > 0}}
<p>master</p>
{{else}}
<p>error!</p>
{{/if}}

23
定义百分比

<fmt:formatNumber pattern="00.0%" value="${(commodityModel.badCount)/(commodityModel.commodityComment.commentCount)}" />
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值