learning_record_doc/apps/IntelliJ IDEA/IntelliJ IDEA常用设置.md
2024-01-07 21:16:25 +08:00

3.3 KiB

创建新项目或导入项目时总是自动使用IDEA自带的maven 通过以下设置可以更改默认使用的版本

File->New Projects Setup ->Settings for New Projects ->Build,Execution,Deployment->BuildTools->Maven->(Maven Home path,User settings,Local reposit)

设置Git 版本控制文件状态颜色

Setting->Version Control->File Status Colors

状态 颜色
ignore #AAAAAA

设置鼠标滚轮控制文字大小

File->Settings->Editor->General->change font size with Ctrl+Mouse Wheell in:

选择 Active editor 仅作用于当前的窗口

选择 All editors 作用所有的窗口

image-20240107111816430

设置Java文件注释

File->Settings->Editor->File and Code Templates->includes

/**
 * @author ds 
 * @since ${DATE}
 */

image-20240107113228037

设置Java文件注释快捷键

File->Settings->Editor->Live Templates—>Java

新建快捷键cc

/**
 * @author ds 
 * @since $DATE$
 */

image-20240107114939198

点击Edit Variables进行变量设置

image-20240107115139716

设置mybatis xml文件模板

File->Settings->Editor->File and Code Templates->Files->点击加号新建

mapper

<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="${PACKAGE_NAME}.${NAME}">

</mapper>

image-20240107113615287

mapperUp

<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="${PACKAGE_NAME}.${NAME}">

    <resultMap type="" id="">
        <result property="" column=""/>
    </resultMap>

    <sql id="">
    </sql>


    <select id="" parameterType="" resultMap="">
    <!-- refid 为对应 sql 的 id-->
    <include refid =""/>
        <where>
            <if test=""></if>
        </where>
    </select>

    <insert id="" parameterType="">
        <selectKey keyProperty="uuid" resultType="String" order="BEFORE">
        <!-- 添加 uuid -->
            SELECT REPLACE(NEWID(), '-', '') AS uuid
        </selectKey>
        insert into tabel
        <!-- 前后加上括号,去除多余的 逗号 -->
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="value != null and value != ''">value</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="value != null and value != ''">#{value}</if>
        </trim>
    </insert>

    <update id="" parameterType="">
        update table 
        <trim prefix="SET" suffixOverrides=",">
            <if test=""></if>
        </trim>
        <!--   -->
    </update>

    <delete id="" parameterType="">
    <!-- 删除语句 -->
    </delete>

    <delete id="" parameterType="">
        select from table wherer uuid in
        <foreach item="" collection="" open="(" separator="," close=")">
            #{uuid}
        </foreach>
    </delete>

</mapper>

image-20240107113638495