*Mapper.java和*Mapper.xml中的insert方法改名为putin,哪果不改运行时会产生警告,警告insert已经加载过了,实际是MyBattisPlus的默认实现BaseMapper.java中已经存有instert方法
|  |  |  | 
|---|
|  |  |  | * @param record the record | 
|---|
|  |  |  | * @return insert count | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | int insert(BaBlock record); | 
|---|
|  |  |  | int putin(BaBlock record); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * insert record to table selective | 
|---|
|  |  |  | 
|---|
|  |  |  | * @param record the record | 
|---|
|  |  |  | * @return insert count | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | int insert(BaClient record); | 
|---|
|  |  |  | int putin(BaClient record); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * insert record to table selective | 
|---|
|  |  |  | 
|---|
|  |  |  | * @param record the record | 
|---|
|  |  |  | * @return insert count | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | int insert(BaClientType record); | 
|---|
|  |  |  | int putin(BaClientType record); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * insert record to table selective | 
|---|
|  |  |  | 
|---|
|  |  |  | * @param record the record | 
|---|
|  |  |  | * @return insert count | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | int insert(BaDistrict record); | 
|---|
|  |  |  | int putin(BaDistrict record); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * insert record to table selective | 
|---|
|  |  |  | 
|---|
|  |  |  | * @param record the record | 
|---|
|  |  |  | * @return insert count | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | int insert(BaDivide record); | 
|---|
|  |  |  | int putin(BaDivide record); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * insert record to table selective | 
|---|
|  |  |  | 
|---|
|  |  |  | * @param record the record | 
|---|
|  |  |  | * @return insert count | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | int insert(BaPrivilege record); | 
|---|
|  |  |  | int putin(BaPrivilege record); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * insert record to table selective | 
|---|
|  |  |  | 
|---|
|  |  |  | * @param record the record | 
|---|
|  |  |  | * @return insert count | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | int insert(BaRole record); | 
|---|
|  |  |  | int putin(BaRole record); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * insert record to table selective | 
|---|
|  |  |  | 
|---|
|  |  |  | * @param record the record | 
|---|
|  |  |  | * @return insert count | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | int insert(BaRolePrivilege record); | 
|---|
|  |  |  | int putin(BaRolePrivilege record); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * insert record to table selective | 
|---|
|  |  |  | 
|---|
|  |  |  | * @param record the record | 
|---|
|  |  |  | * @return insert count | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | int insert(BaUser record); | 
|---|
|  |  |  | int putin(BaUser record); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * insert record to table selective | 
|---|
|  |  |  | 
|---|
|  |  |  | * @param record the record | 
|---|
|  |  |  | * @return insert count | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | int insert(BaUserRole record); | 
|---|
|  |  |  | int putin(BaUserRole record); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * insert record to table selective | 
|---|
|  |  |  | 
|---|
|  |  |  | * @param record the record | 
|---|
|  |  |  | * @return insert count | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | int insert(DemoRole record); | 
|---|
|  |  |  | int putin(DemoRole record); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * insert record to table selective | 
|---|
|  |  |  | 
|---|
|  |  |  | @Mapper | 
|---|
|  |  |  | public interface DemoUserMapper extends BaseMapper<DemoUser> { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int insert(DemoUser user) ; | 
|---|
|  |  |  | int putin(DemoUser user) ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | DemoUser selectById1(@Param("id") Long id); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.alibaba.fastjson2.annotation.JSONField; | 
|---|
|  |  |  | import com.alibaba.fastjson2.writer.ObjectWriterImplToString; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.annotation.IdType; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.annotation.TableField; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.annotation.TableId; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.annotation.TableName; | 
|---|
|  |  |  | import com.dy.common.po.BaseEntity; | 
|---|
|  |  |  | import lombok.*; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.alibaba.fastjson2.annotation.JSONField; | 
|---|
|  |  |  | import com.alibaba.fastjson2.writer.ObjectWriterImplToString; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.annotation.IdType; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.annotation.TableField; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.annotation.TableId; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.annotation.TableName; | 
|---|
|  |  |  | import com.dy.common.po.BaseEntity; | 
|---|
|  |  |  | import lombok.*; | 
|---|
|  |  |  | 
|---|
|  |  |  | </trim> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoBa.BaBlock"> | 
|---|
|  |  |  | <insert id="putin" parameterType="com.dy.pipIrrGlobal.pojoBa.BaBlock"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | insert into ba_block (id, `name`, `header`, phone, area, color, remark, deleted) | 
|---|
|  |  |  | values (#{id,jdbcType=BIGINT}, | 
|---|
|  |  |  | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </trim> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoBa.BaClient"> | 
|---|
|  |  |  | <insert id="putin" parameterType="com.dy.pipIrrGlobal.pojoBa.BaClient"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | insert into ba_client (id, countyId, townId, villageId, blockId, divideId, | 
|---|
|  |  |  | typeId, `name`, num, phone, | 
|---|
|  |  |  | 
|---|
|  |  |  | </trim> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoBa.BaClientType"> | 
|---|
|  |  |  | <insert id="putin" parameterType="com.dy.pipIrrGlobal.pojoBa.BaClientType"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | insert into ba_client_type (id, `name`) | 
|---|
|  |  |  | values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}) | 
|---|
|  |  |  | 
|---|
|  |  |  | where deleted != 1 and supperId = #{supperId,jdbcType=BIGINT} | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoBa.BaDistrict"> | 
|---|
|  |  |  | <insert id="putin" parameterType="com.dy.pipIrrGlobal.pojoBa.BaDistrict"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | insert into ba_district (id, supperId, `name`, num, `level`, deleted) | 
|---|
|  |  |  | values (#{id,jdbcType=BIGINT}, | 
|---|
|  |  |  | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </trim> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoBa.BaDivide"> | 
|---|
|  |  |  | <insert id="putin" parameterType="com.dy.pipIrrGlobal.pojoBa.BaDivide"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | insert into ba_divide (id, `name`, countyId, | 
|---|
|  |  |  | townId, villageId, blockId, | 
|---|
|  |  |  | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoBa.BaPrivilege"> | 
|---|
|  |  |  | <insert id="putin" parameterType="com.dy.pipIrrGlobal.pojoBa.BaPrivilege"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | insert into ba_privilege (<include refid="Base_Column_List" />) | 
|---|
|  |  |  | values (#{id,jdbcType=BIGINT}, | 
|---|
|  |  |  | 
|---|
|  |  |  | </trim> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoBa.BaRole"> | 
|---|
|  |  |  | <insert id="putin" parameterType="com.dy.pipIrrGlobal.pojoBa.BaRole"> | 
|---|
|  |  |  | insert into ba_role (<include refid="Base_Column_List" />) | 
|---|
|  |  |  | values (#{id,jdbcType=BIGINT}, | 
|---|
|  |  |  | #{name,jdbcType=VARCHAR}, | 
|---|
|  |  |  | 
|---|
|  |  |  | roleId, privilegeId | 
|---|
|  |  |  | </sql> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoBa.BaRolePrivilege"> | 
|---|
|  |  |  | <insert id="putin" parameterType="com.dy.pipIrrGlobal.pojoBa.BaRolePrivilege"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | insert into ba_role_privilege (roleId, privilegeId) | 
|---|
|  |  |  | values (#{roleId,jdbcType=BIGINT}, #{privilegeId,jdbcType=BIGINT}) | 
|---|
|  |  |  | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </trim> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoBa.BaUser"> | 
|---|
|  |  |  | <insert id="putin" parameterType="com.dy.pipIrrGlobal.pojoBa.BaUser"> | 
|---|
|  |  |  | insert into ba_user (<include refid="Base_Column_List" />) | 
|---|
|  |  |  | values (#{id,jdbcType=BIGINT}, | 
|---|
|  |  |  | #{name,jdbcType=VARCHAR}, | 
|---|
|  |  |  | 
|---|
|  |  |  | userId, roleId | 
|---|
|  |  |  | </sql> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoBa.BaUserRole"> | 
|---|
|  |  |  | <insert id="putin" parameterType="com.dy.pipIrrGlobal.pojoBa.BaUserRole"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | insert into ba_user_role (userId, roleId) | 
|---|
|  |  |  | values (#{userId,jdbcType=BIGINT}, #{roleId,jdbcType=BIGINT}) | 
|---|
|  |  |  | 
|---|
|  |  |  | where id = #{id,jdbcType=BIGINT} | 
|---|
|  |  |  | </delete> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoDemo.DemoRole"> | 
|---|
|  |  |  | <insert id="putin" parameterType="com.dy.pipIrrGlobal.pojoDemo.DemoRole"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | insert into demo_role (id, `name`, deleted | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!--对应mapper接口方法public void insert(DemoUser user);--> | 
|---|
|  |  |  | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoDemo.DemoUser"> | 
|---|
|  |  |  | <insert id="putin" parameterType="com.dy.pipIrrGlobal.pojoDemo.DemoUser"> | 
|---|
|  |  |  | insert into | 
|---|
|  |  |  | demo_user (id, name, password, roleId, disabled, deleted) | 
|---|
|  |  |  | values (#{id},#{name},#{password},#{roleId}, | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private static final Integer maxNodeAddWorkThread = 500 ;//缓存达到这个数量,将增加线程 | 
|---|
|  |  |  | private static final Integer maxWorkThread = 5 ;//最大工作线程数 | 
|---|
|  |  |  | private static final Object maxWorkThreadSynObj = new Object() ;//最大工作线程数 | 
|---|
|  |  |  | private static int workThread = 0 ;//工作线程数 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private RtuLogManager(){ | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(RtuLogManager.logQueue.size() > maxNodeAddWorkThread){ | 
|---|
|  |  |  | if(workThread < maxWorkThread){ | 
|---|
|  |  |  | synchronized(maxWorkThread){ | 
|---|
|  |  |  | synchronized(maxWorkThreadSynObj){ | 
|---|
|  |  |  | if(workThread < maxWorkThread){ | 
|---|
|  |  |  | startWorkThread() ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Transactional | 
|---|
|  |  |  | public int save(BaBlock po){ | 
|---|
|  |  |  | return this.dao.insert(po) ; | 
|---|
|  |  |  | return this.dao.putin(po) ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Transactional | 
|---|
|  |  |  | public int save(BaDistrict po){ | 
|---|
|  |  |  | return this.dao.insert(po) ; | 
|---|
|  |  |  | return this.dao.putin(po) ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Transactional | 
|---|
|  |  |  | public int save(BaRole po){ | 
|---|
|  |  |  | return this.dao.insert(po) ; | 
|---|
|  |  |  | return this.dao.putin(po) ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Transactional | 
|---|
|  |  |  | public int save(BaUser po){ | 
|---|
|  |  |  | return this.dao.insert(po) ; | 
|---|
|  |  |  | return this.dao.putin(po) ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | 
|---|
|  |  |  | po.num = num ; | 
|---|
|  |  |  | po.level = DistrictLevel.get(level.byteValue()) ; | 
|---|
|  |  |  | po.deleted = Deleted.NO ; | 
|---|
|  |  |  | this.distriDao.insert(po) ; | 
|---|
|  |  |  | this.distriDao.putin(po) ; | 
|---|
|  |  |  | return po.getId() ; | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | return null ; | 
|---|
|  |  |  | 
|---|
|  |  |  | po.supperAdmin = supperAdmin.byteValue() ; | 
|---|
|  |  |  | po.disabled = Disabled.NO ; | 
|---|
|  |  |  | po.deleted = Deleted.NO ; | 
|---|
|  |  |  | this.userDao.insert(po) ; | 
|---|
|  |  |  | this.userDao.putin(po) ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|