工作问题记录

工作问题记录

1.mac os查看本地ip
1
ifconfig |grep "inet"

服务器git切换分支:

2.修改脚本指向本地分支,通过:
1
git checkout -b localbranchname remotebranchname

3.idea中java文件右下角有个红色的j:

不可编译,File—>Project Structure—>Module—>Sources将右边第一个X点掉,去掉Root路径之后重新添加。

4.引入不必要文件修改.gitignore忽略
1
2
3
git rm -r --cached .
git add .
git commit -m 'update .gitignore'

我们在修改了gitignore文件之后,如果想要被忽略的文件目录已经被git add记录到git工作区中。需要git rm -r –cached .将文件从git中清除再重新add。之后所有被add的文件都会检验.gitignore文件是否忽略。

如果git目录下没有.gitignore文件可以自行添加

修改一下远程分支指向:

1
2
3
4
5
6
//method 1 : 修改命令 
step1: git remote set-url origin [url]
//method 2 : 先删后加
step1: git remote rm origin
step2: git remote add origin [url]
//method 3 : 直接修改config文件
5.关闭linux服务器上所有的tomcat进程
1
ps -ef | grep 'org.apache.catalina.startup.Bootstrap start' | awk '{ print $2 }' | xargs kill -9
6.mvn clean install 找不到symbol问题

会报错maven-compile-plugin的版本问题,实际上是找不到依赖的包。这种问题可以从以下两个方面定位:

1.依赖错误,引用了低版本的jar包,部分本地仓库有低版本的拷贝,不会报错。

2.编译错误

有时候本地的引用类库和远程的类库不一致,或者低版本不被维护了,导致部分引用到低版本的在存在本地复制的情况下不会报错。

7.在最外层依赖jar包完全依赖不到
1
2
3
4
5
6
<!--仓储服务-->
<dependency>
<groupId>com.souche</groupId>
<artifactId>souche-storage-api</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>

这样是不能将远程仓库的jar包直接下载到本地的,需要在parent上级添加依赖:

1
2
3
4
5
<!--仓储服务-->
<dependency>
<groupId>com.souche</groupId>
<artifactId>souche-storage-api</artifactId>
</dependency>

这样就可以将包下载到本地。

8.打包执行了测试用例
1
mvn clean install -DskipTests 或者 mvn clean install -Dmaven.test.skip=true

9.线上数据丢失,被置为空,通过sql从备份中找回

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
update retail_order t1,retail_order_backup t2 set t1.date_update=t2.date_update,
t1.identity_frontage = IFNULL(t1.identity_frontage,t2.identity_frontage),
t1.identity_frontage_upload_date=IFNULL(t1.identity_frontage_upload_date,t2.identity_frontage_upload_date),
t1.identity_opposite=IFNULL(t1.identity_opposite,t2.identity_opposite),
t1.identity_opposite_upload_date=IFNULL(t1.identity_opposite_upload_date,t2.identity_opposite_upload_date),
t1.store_receipt=IFNULL(t1.store_receipt,t2.store_receipt),
t1.store_receipt_upload_date=IFNULL(t1.store_receipt_upload_date,t2.store_receipt_upload_date),
t1.purchase_tax_certificate=IFNULL(t1.purchase_tax_certificate,t2.purchase_tax_certificate),
t1.purchase_tax_certificate_upload_date=IFNULL(t1.purchase_tax_certificate_upload_date,t2.purchase_tax_certificate_upload_date),
t1.driving_license=IFNULL(t1.driving_license,t2.driving_license),
t1.driving_license_upload_date=IFNULL(t1.driving_license_upload_date,t2.driving_license_upload_date),
t1.car_register_certificate=IFNULL(t1.car_register_certificate,t2.car_register_certificate),
t1.car_register_certificate_upload_date=IFNULL(t1.car_register_certificate_upload_date,t2.car_register_certificate_upload_date),
t1.business_license=IFNULL(t1.business_license,t2.business_license),
t1.business_license_upload_date=IFNULL(t1.business_license_upload_date,t2.business_license_upload_date),
t1.rights_obligations_transfer_aggrement=IFNULL(t1.rights_obligations_transfer_aggrement,t2.rights_obligations_transfer_aggrement),
t1.rights_obligations_transfer_aggrement_upload_date=IFNULL(t1.rights_obligations_transfer_aggrement_upload_date,t2.rights_obligations_transfer_aggrement_upload_date),
t1.make_invoice_date=IFNULL(t1.make_invoice_date,t2.make_invoice_date)
where t1.order_code=t2.order_code;
10.UNION用法

UNION 用于合并两个或多个 SELECT 语句的结果集,并消去表中任何重复行。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
SELECT
t1.id, t1.order_code, t1.status, t1.date_create, t1.date_update,t1.reject_reason,
t2.date_create AS date_order_create, t2.model_name,t2.business_type,
t3.purchaser_name AS purchaser_shop_name, t3.seller_shop_name AS supplier_shop_name, t3.order_code AS
retail_purchase_code,t3.plate_deposit_status,t3.deposit
FROM audit_order t1
LEFT JOIN retail_order t2 ON t1.order_code = t2.order_code
LEFT JOIN retail_purchase t3 ON t2.purchase_order_id = t3.purchase_order_id
<where>
<if test="statusList != null">
AND t1.status IN
<foreach collection="statusList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="orderCode != null">
AND t2.order_code = #{orderCode}
</if>
<if test="startDateUpdate != null">
<![CDATA[AND t1.date_update >= #{startDateUpdate, jdbcType=TIMESTAMP}]]>
</if>
<if test="endDateUpdate != null">
<![CDATA[AND t1.date_update <= #{endDateUpdate, jdbcType=TIMESTAMP}]]>
</if>
<if test="startMakeInvoiceDate != null">
<![CDATA[AND t2.make_invoice_date >= #{startMakeInvoiceDate, jdbcType=TIMESTAMP}]]>
</if>
<if test="endMakeInvoiceDate != null">
<![CDATA[AND t2.make_invoice_date <= #{endMakeInvoiceDate, jdbcType=TIMESTAMP}]]>
</if>
<if test="manufactorId != null">
AND t2.manufactor_id = #{manufactorId}
</if>
<if test="businessType != null">
AND t2.business_type = #{businessType}
</if>
</where>
UNION SELECT
t1.id, t1.order_code, t1.status, t1.date_create, t1.date_update,t1.reject_reason,
t2.date_create AS date_order_create, t2.model_name,t2.business_type,
t3.purchaser_name AS purchaser_shop_name, t3.seller_shop_name AS supplier_shop_name, t3.order_code AS
retail_purchase_code,t3.plate_deposit_status,t3.deposit
FROM audit_order t1
LEFT JOIN retail_order t2 ON t1.order_code = t2.order_code
LEFT JOIN retail_purchase t3 ON t2.purchase_order_id = t3.purchase_order_id
<where>
<if test="statusList != null">
AND t1.status IN
<foreach collection="statusList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="orderCode != null">
AND t3.order_code = #{orderCode}
</if>
<if test="startDateUpdate != null">
<![CDATA[AND t1.date_update >= #{startDateUpdate, jdbcType=TIMESTAMP}]]>
</if>
<if test="endDateUpdate != null">
<![CDATA[AND t1.date_update <= #{endDateUpdate, jdbcType=TIMESTAMP}]]>
</if>
<if test="startMakeInvoiceDate != null">
<![CDATA[AND t2.make_invoice_date >= #{startMakeInvoiceDate, jdbcType=TIMESTAMP}]]>
</if>
<if test="endMakeInvoiceDate != null">
<![CDATA[AND t2.make_invoice_date <= #{endMakeInvoiceDate, jdbcType=TIMESTAMP}]]>
</if>
<if test="manufactorId != null">
AND t2.manufactor_id = #{manufactorId}
</if>
<if test="businessType != null">
AND t2.business_type = #{businessType}
</if>
</where>

11.mybatis报错

1
java.lang.RuntimeException: org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'dateUpateAt' in 'class com.souche.topgear.model.AuditOrderVO'

xml配置文件中的字段写错了,是dateUpdateAt

12.查看分支操作记录

1
git reflog --date=local --all | grep branchName

13.找不到方法

java.lang.NoSuchMethodError如何定位问题,一般导致这个问题的原因是可能:

  • 1.重复引用。
  • 2.没有mvn clean导致class类之间不同步。

主要可以从上面两种思路找。